Register

Create a new user account and receive JWT access and refresh tokens.

Register

POST/api/v1/auth/register

Create a new user account and receive JWT access and refresh tokens.

Authentication:No Auth Required

Request Parameters

ParameterTypeRequiredDescription
emailstring RequiredEmail address for the new account. Must be a valid email format. Maximum 255 characters.
passwordstring RequiredAccount password. Must be between 8 and 100 characters.
first_namestringOptionalUser's first name. Maximum 100 characters.
last_namestringOptionalUser's last name. Maximum 100 characters.
countrystringOptionalUser's country of residence. Maximum 100 characters.
languagestringOptionalPreferred language code, e.g. "en", "fa", "de". Maximum 10 characters.
referral_codestringOptionalReferral code from an existing user. Maximum 20 characters. The referrer earns rewards when the new user subscribes.
device_idstringOptionalUnique device identifier (UUID recommended).
platformstringOptionalClient platform. One of: ios, android, windows, macos, linux, web.
device_namestringOptionalHuman-readable device name, e.g. "Pixel 8 Pro" or "Firefox on Windows".
fcm_tokenstringOptionalFirebase Cloud Messaging token for push notifications.

Code Examples

curl -X POST https://api.orbai.world/api/v1/auth/register \
  -H "Content-Type: application/json" \
  -d '{
        "email": "newuser@example.com",
        "password": "secureP@ssw0rd",
        "first_name": "Jane",
        "last_name": "Doe",
        "country": "Germany",
        "language": "de",
        "referral_code": "REF_ABC123",
        "device_id": "550e8400-e29b-41d4-a716-446655440000",
        "platform": "android",
        "device_name": "Pixel 8 Pro",
        "fcm_token": "eyJhbGciOiJIUzI1NiIs..."
    }'

Responses

200Account created successfully. Returns the same AuthResponse structure as the login endpoint.
{
  "success": true,
  "data": {
    "user": {
      "id": 42,
      "uuid": "usr_def456",
      "username": "jane_doe",
      "email": "newuser@example.com",
      "role": "USER",
      "active": true
    },
    "tokens": {
      "access_token": "eyJhbGciOiJIUzI1NiIs...",
      "refresh_token": "dGhpcyBpcyBhIHJlZnJlc2...",
      "access_token_expires_at": "2026-02-09T12:00:00Z",
      "refresh_token_expires_at": "2026-03-08T12:00:00Z",
      "token_type": "Bearer"
    },
    "subscription": {
      "plan_name": "Free",
      "status": "active",
      "expires_at": null
    },
    "requires_2fa": false
  }
}
409An account with this email address already exists.
{
  "success": false,
  "error": {
    "code": "EMAIL_ALREADY_EXISTS",
    "message": "An account with this email address already exists. Please log in or use a different email."
  }
}
422Validation error. One or more fields failed validation.
{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Validation failed.",
    "details": {
      "email": "Must be a valid email address.",
      "password": "Must be at least 8 characters."
    }
  }
}