HTTP Method | URL | Requires Auth |
---|---|---|
POST | /api/v1/roles.delete | yes |
{% hint style="info" %}
- Permission required:
access-permissions
- Roles that have the
protected
value astrue
can't be deleted (such as:admin
,moderator
,user
and so on). - You cannot delete roles that are assigned to users. To do that, you must first remove this role from all the users. {% endhint %}
Key | Example Value | Description |
---|---|---|
roleId * | vEpePE7wK6vkYbDDx | The ID of an existing role. |
curl --location 'http://http://localhost:3000/api/v1/roles.delete' \
--header 'X-Auth-Token: x65a7F7aZZtW_H2hTgKEsp_RFxUkLPI6j0G5GNqvoyF' \
--header 'X-User-Id: CkCPNcvsvCDfmWLqC' \
--header 'Content-Type: text/plain' \
--data '{
"roleId": "6579adcf2dd9f9d9514f6"
}'
{
"success": true
}
Any of the following errors can occur on the endpoint.
- Authorization: Requires an authentication token for the request to be made.
- Invalid RoleId: This occurs when the
roleId
does not exist on your workspace.
{% tabs %} {% tab title="Authorization" %}
{
"status": "error",
"message": "You must be logged in to do this."
}
{% endtab %}
{% tab title="Invalid RoleId" %}
{
"success": false,
"error": "This role does not exist [error-invalid-roleId]",
"errorType": "error-invalid-roleId"
}
{% endtab %} {% endtabs %}
Version | Description |
---|---|
3.17.0 | Added |