Contents
On this page
Import Roles - Plugixa Advanced User Role Editor
POST /plugixa-aure/v1/transfer/import
Import the roles of an export file, with a decision for each role.
Needs the Edit roles permission: plugixa_aure_edit_roles. Part of the Export and import feature: when it is switched off in Settings the route is not registered and answers 404.
Note. Only the grants are checked before anything is written. A role that is then refused for another reason (taking away a capability you lack, or locking you out) stops the import with the roles before it already saved. Every role is still covered by the one restore point the request takes.
Request
POST https://your-site.example/wp-json/plugixa-aure/v1/transfer/import
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
file |
string |
Yes | The file’s contents as text: a JSON string inside the JSON body, not an upload. At most 1 MB. Accepted: this plugin’s exports, Members JSON exports and User Role Editor CSV exports. |
decisions |
object |
Yes | Role slug to add, overwrite or skip. Any other word, and any role left out, means skip. add creates a role that does not exist yet and skips one that does; overwrite creates it or replaces the existing role’s name and whole capability map. |
{
"file": "{\"format\":\"plugixa-aure/roles\",\"version\":1,\"meta\":{\"generated\":\"2026-11-12 09:30:00\",\"site\":\"https://your-site.example\",\"plugin\":\"1.0.0\",\"wordpress\":\"6.8.3\",\"roles\":1},\"roles\":{\"support_agent\":{\"name\":\"Support agent\",\"capabilities\":{\"edit_posts\":true,\"moderate_comments\":true,\"read\":true,\"upload_files\":false}}},\"checksum\":\"7c1d9a5e0b3f48a26e9d1c07b4a8f53e2d6c90b1a7e4f3d28c5b6a09e1f7d4c2\"}",
"decisions": {
"support_agent": "add"
}
}
Responses
200 OK. The import ran.
{
"success": true,
"data": {
"created": [
"support_agent"
],
"updated": [],
"skipped": []
}
}
| Field | Type | Meaning |
|---|---|---|
data.created |
array |
Roles created |
data.updated |
array |
Existing roles overwritten |
data.skipped |
array |
Roles left alone |
Errors
| Status | Code | When |
|---|---|---|
413 |
plugixa_aure_file_too_large |
file is over 1 MB. |
422 |
plugixa_aure_file_empty |
file is empty. |
422 |
plugixa_aure_bad_bundle |
file is not in a format the plugin reads. |
422 |
plugixa_aure_empty_bundle |
file contains no usable role. |
422 |
plugixa_aure_bad_slug |
A role slug in the file is longer than 60 characters. |
403 |
plugixa_aure_cannot_grant |
The change grants, or lifts a block on, a capability you do not hold yourself. |
403 |
plugixa_aure_cannot_revoke |
The change takes away, or blocks, a capability you do not hold yourself. |
409 |
plugixa_aure_self_lockout |
The change would remove your own access to the editor. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-aure/v1/transfer/import" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"file":"{\"format\":\"plugixa-aure/roles\",\"version\":1,\"meta\":{\"generated\":\"2026-11-12 09:30:00\",\"site\":\"https://your-site.example\",\"plugin\":\"1.0.0\",\"wordpress\":\"6.8.3\",\"roles\":1},\"roles\":{\"support_agent\":{\"name\":\"Support agent\",\"capabilities\":{\"edit_posts\":true,\"moderate_comments\":true,\"read\":true,\"upload_files\":false}}},\"checksum\":\"7c1d9a5e0b3f48a26e9d1c07b4a8f53e2d6c90b1a7e4f3d28c5b6a09e1f7d4c2\"}","decisions":{"support_agent":"add"}}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-aure/v1/transfer/import');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => 'admin:' . getenv('WP_APP_PASSWORD'),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'file' => '{"format":"plugixa-aure/roles","version":1,"meta":{"generated":"2026-11-12 09:30:00","site":"https://your-site.example","plugin":"1.0.0","wordpress":"6.8.3","roles":1},"roles":{"support_agent":{"name":"Support agent","capabilities":{"edit_posts":true,"moderate_comments":true,"read":true,"upload_files":false}}},"checksum":"7c1d9a5e0b3f48a26e9d1c07b4a8f53e2d6c90b1a7e4f3d28c5b6a09e1f7d4c2"}',
'decisions' => [
'support_agent' => 'add',
],
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-aure/v1/transfer/import', {
method: 'POST',
headers: {
'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
'Content-Type': 'application/json',
},
body: JSON.stringify({ file: '{"format":"plugixa-aure/roles","version":1,"meta":{"generated":"2026-11-12 09:30:00","site":"https://your-site.example","plugin":"1.0.0","wordpress":"6.8.3","roles":1},"roles":{"support_agent":{"name":"Support agent","capabilities":{"edit_posts":true,"moderate_comments":true,"read":true,"upload_files":false}}},"checksum":"7c1d9a5e0b3f48a26e9d1c07b4a8f53e2d6c90b1a7e4f3d28c5b6a09e1f7d4c2"}', decisions: { support_agent: 'add' } }),
});
const { data } = await response.json();
Quick Links
Share