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.io/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_params400Invalid or missing request parameters, headers, or body.
invalid_authorization_token401Unauthorized request. The authorization token is missing or invalid.
insufficient_permission403Insufficient permissions to access this resource.
project_not_found404The requested project could not be found.
role_not_found404The requested role could not be found.
user_external_id_already_used409A user with this external ID already exists in the project.
user_email_already_used409A user with this email address already exists.
system_error500An unexpected error occurred. Please try again later.