Skip to main content

POST /api/auth/create-account

Creates a new user account and sends a confirmation email with a 6-digit token.

Authentication

No authentication required.

Request Body

username
string
required
User’s display name. Cannot be empty.
email
string
required
Valid email address. Must be unique in the system.
password
string
required
User password. Minimum length: 8 characters.

Request Example

{
  "username": "johndoe",
  "email": "[email protected]",
  "password": "securePassword123"
}

Response

message
string
Success message confirming user creation.

Success Response (201 Created)

"User created successfully"

Error Responses

409 Conflict - User Already Exists

{
  "error": "There is a problem creating user"
}

400 Bad Request - Validation Errors

{
  "errors": [
    {
      "msg": "Username can not be empty",
      "param": "username"
    },
    {
      "msg": "Email not valid",
      "param": "email"
    },
    {
      "msg": "Password min length has to be 8 characters",
      "param": "password"
    }
  ]
}

500 Internal Server Error

{
  "error": "Error creating user"
}

cURL Example

curl -X POST https://api.example.com/api/auth/create-account \
  -H "Content-Type: application/json" \
  -d '{
    "username": "johndoe",
    "email": "[email protected]",
    "password": "securePassword123"
  }'

Notes

  • Password is automatically hashed before storage
  • A 6-digit confirmation token is generated and sent via email
  • Account starts in unconfirmed state until token is verified
  • Rate limiting is applied to this endpoint

Build docs developers (and LLMs) love