Skip to main content

Create Role

Create a custom role with permissions.

Outline

Endpoint

POST /api/v1/roles

Headers

HeaderRequiredDescription
AuthorizationYesBearer <access_token>
Content-TypeYesapplication/json

Request Body

{
"name": "Custom Developer",
"permissions": ["workspace.read", "workspace.write"],
"organization_id": 1
}

Response

Success (201)

{
"success": true,
"data": {
"role": {
"id": 1,
"name": "Custom Developer",
"permissions": ["workspace.read", "workspace.write"],
"created_at": "2024-01-01T00:00:00Z"
},
"message": "Role created successfully"
},
"message": "Role created successfully"
}

Error Codes

StatusCodeDescription
400VALIDATION_ERRORValidation error
401UNAUTHORIZEDInvalid or missing token
403FORBIDDENInsufficient permissions
409ROLE_ALREADY_EXISTSRole already exists

Features

  • Custom role creation
  • Permission assignment
  • Role validation
  • Audit logging

Status

[WARNING] TODO: Not Implemented

This endpoint is defined in the router but the implementation logic is not yet complete.