Delete a custom role
Deletes a custom role of your company. A role somebody still holds is refused: give those people another role first.
DELETE/ api/ roles/ {id}/ delete
Path parameters
idintegerRequired
The id of a custom role of your company, as GET /team/roles lists it. Digits only; anything else answers 404. At least 1.
Returns
200 The role was deleted.
Fields of the 200 answer
dataany
The result. Each endpoint says what it holds.
messagestringRequired
statusstringRequired
If it is refused
| Status | Reason | What to do |
|---|---|---|
401 | none | Send a valid token as Authorization: Bearer <token>. |
403 | forbidden | The person is not allowed to do this. |
403 | scope_required | Use a token with the scope named in scope. |
404 | none | Check the id. You see only what your account can reach. |
409 | in_use | It is still in use, still being removed, or managed somewhere else. Read the message: wait for the removal, remove what uses it first, or remove it where the message says. |
429 | rate_limited | Wait for the seconds in Retry-After. |
Reasons are listed by name in Errors and refusals.
The same task elsewhere
curl -X DELETE https://manage.corefinity.com/api/roles/3107/delete \
-H "Authorization: Bearer $COREFINITY_TOKEN" \
-H "Accept: application/json"use Illuminate\Support\Facades\Http;
$response = Http::withToken(env('COREFINITY_TOKEN'))
->acceptJson()
->delete('https://manage.corefinity.com/api/roles/3107/delete');
$data = $response->json();const res = await fetch('https://manage.corefinity.com/api/roles/3107/delete', {
method: 'DELETE',
headers: {
Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
Accept: 'application/json',
},
});
// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);import os
import requests
res = requests.delete(
"https://manage.corefinity.com/api/roles/3107/delete",
headers={
"Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
"Accept": "application/json",
},
)
data = res.json() if res.content else None{
"message": "Role deleted.",
"status": "success"
}{
"message": "Unauthenticated."
}{
"code": "forbidden",
"message": "You are not allowed to delete roles.",
"reason": "forbidden",
"status": "error"
}{
"message": "Not found."
}{
"code": "in_use",
"message": "This custom role has users assigned to it. Please reassign them before deleting the role.",
"reason": "in_use",
"status": "error"
}{
"code": "rate_limited",
"message": "Too many requests. Try again in 60 seconds.",
"reason": "rate_limited",
"retry_after_seconds": 60
}Try it
Try it is off for this endpointIt deletes data that cannot be brought back. Copy the request and run it yourself when you are sure.
Was this helpful?