Skip to main content
POST
/
api
/
admin
/
users
curl -X POST "https://panel.example.com/api/admin/users" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "username": "john.doe",
    "email": "[email protected]",
    "password": "SecurePassword123!",
    "language": "en",
    "role": "user"
  }'
{
  "data": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "username": "john.doe",
    "email": "[email protected]",
    "role": "user",
    "createdAt": "2024-01-15T10:30:00Z"
  }
}

Authentication

This endpoint requires admin authentication and the users:write permission.

Request Body

username
string
required
Username (minimum 1 character, trimmed)
email
string
required
Valid email address (trimmed)
password
string
required
Password (minimum 8 characters)
language
string
Language code (defaults to DEFAULT_LANGUAGE env var or “en”)
role
string
default:"user"
User role: user or admin

Response

data
object
Created user information
curl -X POST "https://panel.example.com/api/admin/users" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "username": "john.doe",
    "email": "[email protected]",
    "password": "SecurePassword123!",
    "language": "en",
    "role": "user"
  }'
{
  "data": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "username": "john.doe",
    "email": "[email protected]",
    "role": "user",
    "createdAt": "2024-01-15T10:30:00Z"
  }
}

Process

  1. Email uniqueness is verified
  2. Password is hashed using bcrypt (cost: 12)
  3. User account is created with email automatically verified
  4. Credential account is linked for authentication
  5. Welcome email is sent to the user (if email is configured)

Error Responses

  • 409 Conflict: A user with this email already exists
  • 400 Bad Request: Validation failed (invalid email, short password, etc.)

Notes

  • Email is automatically marked as verified
  • If role is “admin”, rootAdmin is set to true
  • Password must meet minimum 8 character requirement
  • Creation email may fail silently if email service is not configured

Build docs developers (and LLMs) love