deleteRole
DELETE
/api/v1/roles/{key}
const url = 'https://example.com/api/v1/roles/owner';const options = {method: 'DELETE', headers: {'X-CSRF-Token': 'example'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request DELETE \ --url https://example.com/api/v1/roles/owner \ --header 'X-CSRF-Token: example'Delete a custom role that no account holds. Requires the roles.manage capability and the admin scope. Cookie-authenticated unsafe requests require X-CSRF-Token.
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters”key
required
Role key. The built-in roles are owner, administrator, editor, contributor, and viewer. Custom role keys start with “custom.”. Decide authorization from the capabilities the server reports, not from the role key.
string
Header Parameters
Section titled “Header Parameters”X-CSRF-Token
required
string
Responses
Section titled “ Responses ”Role deleted
Dashboard authentication required
Insufficient role or capability outside the caller’s authority
Role not found
Built-in role or role still assigned