Skip to main content
POST
Create New Role

Create Role

Create a new custom user role with specific permissions.

Endpoint

Description

This endpoint allows administrators to create new custom user roles. Custom roles can have specific permissions tailored to your organization’s needs. You can specify the role name, description, and permissions during creation.

Authentication

Required: API Key with admin privileges

Request Body

Example Request

Success Response

Status Code: 201 Created

Response Fields

Example Usage

JavaScript

Python

cURL

Error Responses

400 Bad Request

401 Unauthorized

403 Forbidden

409 Conflict

429 Too Many Requests

Available Permission Sections

Available Permission Levels

Use Cases

  • Custom Roles: Create roles tailored to your organization’s needs
  • Access Control: Define specific permissions for different user types
  • Security: Implement least-privilege access principles
  • Compliance: Create roles that meet regulatory requirements
  • Integration: Define roles for third-party system integration

Rate Limits

  • Default: 50 requests per minute
  • Daily: 5,000 requests per day
  • Monthly: 150,000 requests per month

Notes

  • Admin Only: This endpoint requires admin privileges
  • Required Fields: name, displayName, and description are required
  • Permission Structure: Permissions are objects with section and level properties
  • System Roles: Custom roles are never system roles
  • Flat Response: Response is not nested under data object
  • Creator Info: Shows who created the role
  • User Count: Starts at 0 for new roles
  • Role names must be unique within the system
  • The role is immediately available for user assignment

Authorizations

Authorization
string
header
required

API key authentication using Bearer token format. Example: Authorization: Bearer sk-your-api-key-here

Body

application/json
name
string
required

Role name (lowercase, no spaces)

Example:

"custom_role"

displayName
string
required

Display name for the role

Example:

"Custom Role"

description
string
required

Role description

Example:

"Custom role with specific permissions"

hasAdminPanelAccess
boolean
default:false

Whether role has admin panel access

Example:

true

permissions
object[]

Array of permission objects

Example:
canInteractWithAI
boolean
default:true

Whether role can interact with AI

Example:

true

canUseChat
boolean
default:true

Whether role can use chat

Example:

true

Response

Role created successfully

success
boolean
Example:

true

message
string
Example:

"Role created successfully"

role
object