Skip to content

Create User

Register a new user in a project using either email/password (Fully Managed) or external user ID (BYOU).

Endpoint

/api/v1/projects/{project_id}/users

Method

POST

Path Parameters

ParameterTypeRequiredDescription
project_idstringYesUnique ID of the project

Headers

HeaderRequiredDescription
Content-TypeYesapplication/json
AuthorizationYesBearer access token: Bearer <access_token>

Request Body

FieldTypeRequiredDescription
display_namestringYesUser display name (max 50 chars)
avatar_urlstringNoURL to avatar image
external_user_idstringConditionalRequired if email is not provided (max 100 chars)
emailstringConditionalOptional if external_user_id is provided (max 100 chars)
passwordstringConditionalRequired if email is provided (min 8 chars)
role_idstringNoRole ID to assign to the user

Required Permission

users:create

Examples

curl --request POST \
  --url https://auth.roled.id/api/v1/projects/2JUSLUee46xG6iEwG8JwPc/users \
  --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJo...' \
  --header 'Content-Type: application/json' \
  --data '{
    "display_name": "Alice Smith",
    "avatar_url": "https://example.com/profiles/alice-smith.jpg",
    "external_user_id": "921f28239dcd",
    "email": "alice.smith@example.com",
    "password": "SecurePassword123!",
    "role_id": "2JRtjyxfZudzaJkFczgoUY"
  }'

Error Codes

CodeHTTP StatusDescription
invalid_params400Missing or invalid request params, headers, or body
invalid_authorization_token401Missing or invalid authorization token
insufficient_permission403Insufficient permission
project_not_found404Project not found
role_not_found404Role not found
user_external_id_already_used409User with the same external user ID already exists
user_email_already_used409User with the same email already exists
system_error500Internal server error