Custom Roles API
Overview
The Custom Roles API enables organization administrators and owners to create, manage, and assign custom roles with fine-grained permissions. Custom roles are organization-specific and can be assigned to members alongside built-in roles (owner, admin, member, staff).Base URL
Authentication
All endpoints require JWT authentication via theAuthorization header:
Endpoints
Create Custom Role
POST/:orgId/roles
Create a new custom role in the organization. Requires owner or admin role.
Request Body
Parameters
name(string, required): Unique role name within the organizationdescription(string, optional): Human-readable role descriptionpermissions(array, required): Array of permission strings inresource:actionformat
Response
201 CreatedErrors
400 Bad Request: Validation failed or name already exists in organization403 Forbidden: User is not a member or lacks admin/owner role
Example
List Custom Roles
GET/:orgId/roles
List all custom roles in the organization with pagination support. Requires organization membership.
Query Parameters
page(number, optional, default: 1): Page number for paginationpageSize(number, optional, default: 20): Number of roles per page
Response
200 OKErrors
403 Forbidden: User is not a member of the organization
Example
Get Custom Role
GET/:orgId/roles/:roleId
Retrieve a specific custom role by ID. Requires organization membership.
Response
200 OKErrors
403 Forbidden: User is not a member of the organization404 Not Found: Role not found or belongs to different organization
Example
Update Custom Role
PATCH/:orgId/roles/:roleId
Update permissions or description of a custom role. Requires owner or admin role. Built-in roles cannot be modified.
Request Body
Parameters
name(string, optional): New role namedescription(string, optional): New description (can be set to null)permissions(array, optional): Updated permissions array
Response
200 OKErrors
400 Bad Request: Validation failed403 Forbidden: User lacks admin/owner role or role is built-in404 Not Found: Role not found
Example
Delete Custom Role
DELETE/:orgId/roles/:roleId
Delete a custom role. Requires owner or admin role. Built-in roles cannot be deleted. Role must not be assigned to any members.
Response
204 No ContentErrors
400 Bad Request: Role is assigned to members403 Forbidden: User lacks admin/owner role or role is built-in404 Not Found: Role not found
Example
Permission Format
Permissions follow theresource:action format:
Supported Resources & Actions
| Resource | Actions |
|---|---|
| content | read, write, publish, delete, archive |
| team | read, write, manage |
| settings | read, write, admin |
| billing | read, write |
Member Role Assignment
Custom roles are assigned to members via the organization member API: PATCH/api/v1/organizations/:orgId/members/:memberId
Built-in Roles
The following roles are built-in and cannot be modified or deleted:- owner: Full organization access (automatically assigned on creation)
- admin: Organization administration (invite, remove members, manage roles)
- member: Basic member access (view organization, list members)
- staff: Limited staff access (organization-specific)
Error Responses
400 Bad Request
403 Forbidden
404 Not Found
Access Control
- List/View Roles: Any organization member
- Create/Update/Delete Roles: Owner or Admin only
- Assign Roles: Owner or Admin only (via member API)
Rate Limiting
All endpoints are subject to rate limiting. See Rate Limiting Documentation for details.Webhooks (Future)
Role changes will trigger webhooks in a future release:role.createdrole.updatedrole.deleted