POST
/users
curl \
--request POST 'https://api.your-domain.com/api/users' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{"email":"john.doe@acme.com","name":"John Doe","user_role_ids":["rol_abc123def456","rol_xyz789abc123"],"organization_id":"org_xyz789","phone":"+39 333 123456","custom_data":{"position":"Senior Developer","department":"IT"}}'
Request examples
{
"email": "john.doe@acme.com",
"name": "John Doe",
"user_role_ids": [
"rol_abc123def456",
"rol_xyz789abc123"
],
"organization_id": "org_xyz789",
"phone": "+39 333 123456",
"custom_data": {
"position": "Senior Developer",
"department": "IT"
}
}
Response examples (201)
{
"code": 201,
"message": "user created successfully",
"data": {
"id": "usr_123456789",
"logto_id": "user_abc123def456",
"username": "john.doe",
"email": "john@example.com",
"name": "John Doe",
"phone": "+39 333 123456",
"organization": {
"id": "12345678-1234-1234-1234-123456789abc",
"logto_id": "org_123456789",
"name": "ACME Corp"
},
"roles": [
{
"id": "rol_admin_123",
"name": "Admin"
}
],
"custom_data": {
"position": "Senior Developer",
"department": "IT"
},
"created_at": "2025-06-20T14:30:00Z",
"updated_at": "2025-06-21T10:45:00Z",
"logto_synced_at": "2025-06-21T10:45:00Z",
"latest_login_at": "2025-06-21T15:30:45Z",
"deleted_at": "2025-05-04T09:42:00Z",
"suspended_at": "2025-05-04T09:42:00Z"
}
}
Response examples (400)
{
"code": 400,
"message": "validation failed",
"data": {
"type": "validation_error",
"errors": [
{
"key": "username",
"message": "required",
"value": "string"
}
]
}
}
Response examples (401)
{
"code": 401,
"message": "invalid token",
"data": {}
}
Response examples (403)
{
"code": 403,
"message": "insufficient permissions",
"data": {}
}
Response examples (422)
{
"code": 400,
"message": "validation failed",
"data": {
"type": "validation_error",
"errors": [
{
"key": "username",
"message": "required",
"value": "string"
}
]
}
}