Loading…
Create a new user in the system.
| Permission | Description |
|---|---|
users.create | Create users |
| Name | Type | Required | Description |
|---|---|---|---|
first_name | string | No | First name (max 255) |
last_name | string | No | Last name (max 255) |
email | string | No | Email (max 255, unique) |
phone | string | Yes | Phone number (unique, E.164 format) |
username | string | Yes | Username (max 255, unique; letters, digits, _ and . only: /^[a-zA-Z0-9_.]+$/) |
height | integer | No | User's height in CM |
birth_date | date | No | User's birth date |
gender | string | No | User's gender (male, female, other) |
password | string | Yes | Password (max 255 characters, will be hashed) |
bank_account_number | string | No | Bank account number (max 50 characters, nullable) |
Returns the created user resource.
{
"data": { /* user resource */ }
}
See User Resource.
| Status | Description | Reference |
|---|---|---|
| 409 | Email, phone, or username already in use | See below |
| 422 | Validation error | Validation error |
| 401 | Unauthorized | Authentication error |
| 403 | Forbidden | Permission error |
Checked in this order: email, then phone, then username; the first match answers. error is the localized
sentence (kept for released clients); branch on code, which never changes with the locale.
code | When |
|---|---|
email_in_use | The email belongs to another account |
phone_in_use | The phone number belongs to another account |
username_in_use | The username belongs to another account |
{
"error": "This email is already in use.",
"code": "email_in_use"
}