Get Custom Role
Overview
Fetch a single role by its roleId for the client Platform Custom Roles detail or edit screen.
Returns name, slug, description, permissions, system/default flags, and metadata so you can hydrate an edit form before calling Update.
When to use this endpoint?
Use Get Custom Role when:
- Opening a role detail drawer from Platform → Custom Roles.
- Loading the latest permissions before an Update request.
- Confirming a role still exists before Delete.
- Showing whether the role is system-managed (
isSystem) so the UI can lock edits.
Part of the client Platform Custom Roles module. Get roleId from List Custom Roles.
Response Data
The data object typically includes:
GET
{baseUrl}/api/{apiVersion}/user-role/:roleId- Authentication
- Required (Bearer token)
- Tenant-scoped
- Yes (tenant DB - requires x-client-id)
Request Headers
Path Parameters
Success Response (HTTP 200 OK)
On success, the API returns the full role document.
json
{ "success": true, "message": "Role fetched successfully", "data": { "_id": "66b0...c9d0", "name": "Sales Manager", "slug": "sales-manager", "description": "Manages the sales desk", "permissions": [ "chat.read", "chat.assign" ], "isDefault": false, "isSystem": false, "metadata": { "color": "#3b82f6" }, "createdAt": "2026-06-23T10:00:00.000Z", "updatedAt": "2026-06-23T10:00:00.000Z" }, "error": null}Common Errors
Get fails when the token is invalid or the role id does not exist.
HTTP 401 Unauthorized - No token
json
{ "success": false, "message": "No token, authorization denied", "data": null, "error": "Unauthorized"}HTTP 403 Forbidden - Tenant admin required
json
{ "success": false, "message": "Access denied: tenant admin privileges required", "data": null, "error": null}HTTP 404 Not Found - Role missing
json
{ "success": false, "message": "Entity not found", "data": null, "error": "Entity not found"}Best Practices
- Validate
roleIdis a 24-character ObjectId before calling Get. - If
isSystemis true, disable delete (and optionally edit) in the Platform UI. - Prefer List for tables; use Get when opening a single role editor.
- Always send tenant headers with a client Bearer token over HTTPS.
Role details ready
Bind fields to your edit form, then call Update to save changes or Delete if the role is custom and unused.