Skip to content

deleteRole

DELETE
/api/v1/roles/{key}
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.

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
/^[a-z][a-z0-9.-]{1,63}$/
X-CSRF-Token
required
string

Role deleted

Dashboard authentication required

Insufficient role or capability outside the caller’s authority

Role not found

Built-in role or role still assigned