# Delete custom role Delete a custom role from an organization. System roles cannot be deleted. Roles with active members must have their members reassigned first. Requires the `manage_roles` capability. #### Path Parameters **`organization_id`** string required Organization ID (org_ prefixed string). **`role_id`** string required Role ID (role_ prefixed string). Must be a custom role with no active members. ## Returns No content on success (204). Request ```bash cURL curl -X DELETE "https://api.aitronos.com/v1/organizations/org_abc123/roles/role_xyz789" \ -H "Authorization: Bearer $ACCESS_TOKEN" ``` ```python Python SDK from aitronos import Aitronos client = Aitronos(api_key="your-api-key") client.organizations.roles.delete( organization_id="org_abc123", role_id="role_xyz789", ) ``` ```python Python import requests response = requests.delete( "https://api.aitronos.com/v1/organizations/org_abc123/roles/role_xyz789", headers={"Authorization": "Bearer YOUR_ACCESS_TOKEN"}, ) print(response.status_code) # 204 ``` ```javascript JavaScript const response = await fetch( "https://api.aitronos.com/v1/organizations/org_abc123/roles/role_xyz789", { method: "DELETE", headers: { Authorization: "Bearer YOUR_ACCESS_TOKEN" }, } ); console.log(response.status); // 204 ``` Response ```text 204 No Content (empty response body) ``` ```json 403 System Role { "success": false, "error": { "code": "SYSTEM_ROLE_IMMUTABLE", "message": "System roles cannot be modified or deleted.", "system_message": "System roles cannot be deleted", "type": "client_error", "status": 403, "details": { "role_id": "role_admin123", "role_name": "Admin" }, "trace_id": "abc-123-def", "timestamp": "2026-02-28T12:00:00Z" } } ``` ```json 409 Has Members { "success": false, "error": { "code": "ROLE_HAS_MEMBERS", "message": "Cannot delete role with active members. Reassign members first.", "system_message": "Cannot delete role with active members. Reassign members first.", "type": "client_error", "status": 409, "details": { "role_id": "role_xyz789", "member_count": 5 }, "trace_id": "abc-123-def", "timestamp": "2026-02-28T12:00:00Z" } } ``` ## Related Resources - [Retrieve role](/docs/api-reference/organizations/roles/retrieve) - [Create custom role](/docs/api-reference/organizations/roles/create-role) - [Update custom role](/docs/api-reference/organizations/roles/update-role) - [List role members](/docs/api-reference/organizations/roles/list-members) - [Remove role member](/docs/api-reference/organizations/roles/remove-member)