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

Autorizações

Authorization
string
header
obrigatório

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

Corpo

application/json
name
string
obrigatório

Role name (lowercase, no spaces)

Exemplo:

"custom_role"

displayName
string
obrigatório

Display name for the role

Exemplo:

"Custom Role"

description
string
obrigatório

Role description

Exemplo:

"Custom role with specific permissions"

hasAdminPanelAccess
boolean
padrão:false

Whether role has admin panel access

Exemplo:

true

permissions
object[]

Array of permission objects

Exemplo:
canInteractWithAI
boolean
padrão:true

Whether role can interact with AI

Exemplo:

true

canUseChat
boolean
padrão:true

Whether role can use chat

Exemplo:

true

Resposta

Role created successfully

success
boolean
Exemplo:

true

message
string
Exemplo:

"Role created successfully"

role
object