List Custom Roles
Overview
Retrieve a paginated list of roles for your tenant - both built-in system roles (Admin, User) and custom roles you created in the client Platform.
Use this endpoint to power the Custom Roles table, role pickers when editing users, and search for roles by name or slug.
When to use this endpoint?
Use List Custom Roles when:
- Loading Platform → Custom Roles for the admin roles table.
- Filling a role dropdown when creating or updating a Platform user.
- Searching roles by name or slug with pagination.
- Distinguishing system roles (
isSystem: true) from custom ones before allowing edit or delete.
Part of the client Platform Custom Roles module. Requires a client Access Token with tenant admin privileges.
Response Data
Each item in data.list typically includes:
GET
{baseUrl}/api/{apiVersion}/user-role/list?search=&page=1&limit=10- Authentication
- Required (Bearer token)
- Tenant-scoped
- Yes (tenant DB - requires x-client-id)
Request Headers
Query Parameters
Success Response (HTTP 200 OK)
On success, the API returns list and pagination. The example includes system Admin / User plus one custom role.
json
{ "success": true, "message": "Role list fetched successfully", "data": { "list": [ { "_id": "66bp...0001", "name": "Admin", "slug": "admin", "description": "Full tenant administrator", "permissions": [ "*" ], "isDefault": true, "isSystem": true, "metadata": {}, "createdAt": "2026-06-22T05:40:02.000Z", "updatedAt": "2026-06-22T05:40:02.000Z" }, { "_id": "66b0...0002", "name": "User", "slug": "user", "description": "Standard chat user", "permissions": [], "isDefault": true, "isSystem": true, "metadata": {}, "createdAt": "2026-06-22T05:40:02.000Z", "updatedAt": "2026-06-22T05:40:02.000Z" }, { "_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" } ], "pagination": { "currentPage": 1, "totalCount": 3, "hasNextPage": false, "hasPreviousPage": false, "pageSize": 10 } }, "error": null}Common Errors
List fails when the token is missing or lacks tenant admin access.
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}Best Practices
- Hide or disable Delete for rows where
isSystemis true. - Cache the list briefly for role pickers; refresh after Create / Update / Delete.
- Use
slug(not_id) when assigning a role on a user. - Always send tenant headers with a client Bearer token over HTTPS.
Roles list ready
Bind the list to your Custom Roles table, then open a row with Get by ID or start Create for a new custom role.