Creates a new user account with SMS phone verification. The registration process requires two steps:
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
| phone | string | Yes | User phone number (optional) | "+1234567890" |
| string | No | User email address | "user@example.com" | |
| username | string | Yes | Username | "johndoe" |
| first_name | string | No | First name of the user | "John" |
| last_name | string | No | Last name of the user | "Doe" |
| password | string | Yes | User password | "password123" |
| referral_code | string | No | Optional referral code | "REF123" |
| confirmation_code | string | No | 6-digit SMS verification code (required for account creation) |
Send user data without confirmation_code to receive SMS verification code.
{
"email": "user@example.com",
"phone": "+1234567890",
"username": "johndoe",
"first_name": "John",
"last_name": "Doe",
"password": "password123",
"referral_code": "REF123"
}
Send the same data plus the 6-digit confirmation_code received via SMS to create the account.
{
"email": "user@example.com",
"phone": "+1234567890",
"username": "johndoe",
"first_name": "John",
"last_name": "Doe",
"password": "password123",
"referral_code": "REF123",
"confirmation_code": "123456"
}
When confirmation_code is not provided, returns a success message indicating the verification code was sent.
{
"message": "Phone verification code has been sent to your phone.",
"phone": "+1234567890"
}
When confirmation_code is provided and valid, returns the created user resource and API token.
{
"user": { /* user resource */ },
"token": "<the API token will be set here>"
}
For a full schema, see User Resource.
When referral score of a user increases, they receive premium subscription as a reward. For each 5 points, they receive 7 days of premium subscription.
confirmation_codeconfirmation_code|| Status | Description | Example/Reference |
||--------|------------------------------------------|--------------------------------------------------------|
|| 409 | Email/phone/username already in use | { "error": "Email address/phone number/username is already in use" } |
|| 422 | Validation error | Validation error |
|| 422 | Invalid or expired verification code | See below |
|| 429 | Too many requests | Rate-limit error |
|| 500 | SMS sending failed | See below |
Invalid verification code:
{
"message": "Invalid verification code.",
"errors": {
"confirmation_code": ["Invalid verification code."]
}
}
Expired verification code:
{
"message": "Verification code has expired.",
"errors": {
"confirmation_code": ["Verification code has expired."]
}
}
{
"message": "Failed to send SMS. Please try again later."
}