ثبت‌نام

حساب کاربری تازه‌ای بسازید و توکن دسترسی و توکن تازه‌سازی JWT دریافت کنید.

ثبت‌نام

POST/api/v1/auth/register

حساب کاربری تازه‌ای بسازید و توکن دسترسی و توکن تازه‌سازی JWT دریافت کنید.

احراز هویت:بدون احراز هویت

پارامترهای درخواست

پارامترنوعالزامیتوضیحات
emailstring الزامیEmail address for the new account. Must be a valid email format. Maximum 255 characters.
passwordstring الزامیAccount password. Must be between 8 and 100 characters.
first_namestringاختیاریUser's first name. Maximum 100 characters.
last_namestringاختیاریUser's last name. Maximum 100 characters.
countrystringاختیاریUser's country of residence. Maximum 100 characters.
languagestringاختیاریPreferred language code, e.g. "en", "fa", "de". Maximum 10 characters.
referral_codestringاختیاریReferral code from an existing user. Maximum 20 characters. The new user gets the current referral offer, if one is running. The referrer earns commission on the money we receive and keep from the new user's payments.
device_idstringاختیاریUnique device identifier (UUID recommended).
platformstringاختیاریClient platform. One of: ios, android, windows, macos, linux, web.
device_namestringاختیاریHuman-readable device name, e.g. "Pixel 8 Pro" or "Firefox on Windows".
fcm_tokenstringاختیاریFirebase Cloud Messaging token for push notifications.

نمونه‌های کد

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

200حساب با موفقیت ساخته شد. همان ساختار AuthResponse نقطه پایانی ورود را بازمی‌گرداند.
{
  "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
  }
}
409حسابی با این نشانی ایمیل از پیش وجود دارد.
{
  "success": false,
  "error": {
    "code": "EMAIL_ALREADY_EXISTS",
    "message": "An account with this email address already exists. Please log in or use a different email."
  }
}
422خطای اعتبارسنجی. یک یا چند فیلد اعتبارسنجی را رد کردند.
{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Validation failed.",
    "details": {
      "email": "Must be a valid email address.",
      "password": "Must be at least 8 characters."
    }
  }
}

نقاط پایانی مرتبط