General Users API
Endpoints for user management and authentication.
List Users
Get a paginated list of users.
Endpoint: GET /v1/users
Authentication: Required
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | No | Page number for pagination |
page_size | integer | No | Number of items per page (default: 50) |
Example Request
GET /v1/users?page=1&page_size=25 HTTP/1.1
Content-Type: application/json
X-User-Token: your_token_hereCreate User
Create a new user account.
Endpoint: POST /v1/users
Authentication: Not required for registration
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
user | object | Yes | User data object |
user.email | string | Yes | User’s email address |
user.password | string | Yes | User’s password |
user.first_name | string | Yes | User’s first name |
user.last_name | string | Yes | User’s last name |
user.phone | string | No | User’s phone number |
user.date_of_birth | string | No | Date of birth (YYYY-MM-DD) |
user.language | string | No | Preferred language (default: “en”) |
template | boolean | No | Whether this is a template user |
clinical | boolean | No | Whether this is a clinical user |
native_signup | boolean | No | Whether this is a native app signup |
Example Request
POST /v1/users HTTP/1.1
Content-Type: application/json
{
"user": {
"email": "[email protected]",
"password": "securepassword123",
"first_name": "John",
"last_name": "Doe",
"phone": "+1-555-123-4567",
"date_of_birth": "1990-05-15",
"language": "en"
},
"clinical": true,
"native_signup": false
}Update User
Update user information.
Endpoint: PUT /v1/users/{id}
Authentication: Required
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | User ID |
Request Body Parameters
Same as Create User endpoint, but all fields are optional.
Example Request
PUT /v1/users/123 HTTP/1.1
Content-Type: application/json
X-User-Token: your_token_here
{
"user": {
"first_name": "Jonathan",
"phone": "+1-555-987-6543"
}
}Cancel User Account
Deactivate a user account.
Endpoint: POST /v1/users/{id}/cancel
Authentication: Required
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | User ID |
Delete User
Permanently delete a user account.
Endpoint: DELETE /v1/users/{id}
Authentication: Required (Admin role)
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | User ID |
User Confirmation
Confirm user account with verification code.
Endpoint: POST /v1/users/confirmation
Authentication: Not required
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
user_id | integer | Yes | User ID |
confirmation_code | string | Yes | Verification code sent via SMS |
Example Request
POST /v1/users/confirmation HTTP/1.1
Content-Type: application/json
{
"user_id": 123,
"confirmation_code": "123456"
}Resend Confirmation
Resend verification code to user.
Endpoint: POST /v1/users/resend_confirmation
Authentication: Required
Example Request
POST /v1/users/resend_confirmation HTTP/1.1
Content-Type: application/json
X-User-Token: your_token_hereCheck Email Account
Check if an email address already has an account.
Endpoint: POST /v1/users/email_has_account
Authentication: Not required
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
email | string | Yes | Email address to check |
Example Request
POST /v1/users/email_has_account HTTP/1.1
Content-Type: application/json
{
"email": "[email protected]"
}Response
{
"has_account": true
}Password Management
Create Password Reset
Endpoint: POST /v1/users/passwords
Authentication: Not required
Validate Password Reset
Endpoint: GET /v1/users/passwords/validate
Authentication: Not required
Reset Password
Endpoint: POST /v1/users/passwords/reset
Authentication: Not required
Response Format
User Response
{
"id": 123,
"email": "[email protected]",
"first_name": "John",
"last_name": "Doe",
"phone": "+1-555-123-4567",
"date_of_birth": "1990-05-15",
"language": "en",
"role": "parent",
"active": true,
"clinical": true,
"confirmed": true,
"created_at": "2023-10-20T10:00:00.000Z",
"updated_at": "2023-10-20T15:30:00.000Z"
}Confirmation Response
{
"verified": true,
"user": {
"id": 123,
"email": "[email protected]",
"confirmed": true
}
}Error Responses
422 Unprocessable Entity
{
"errors": {
"email": ["can't be blank", "has already been taken"],
"password": ["is too short (minimum is 8 characters)"],
"first_name": ["can't be blank"]
}
}404 Not Found
{
"errors": "User not found"
}401 Unauthorized
{
"errors": "Invalid Code"
}Notes
- User registration requires email verification via SMS
- Passwords must meet minimum security requirements
- The
rolefield is automatically set to “parent” for new registrations - Clinical users have additional permissions for healthcare operations
- Template users are used for testing and development purposes
- Account cancellation sets the user as inactive but preserves data
- Account deletion permanently removes all user data and cannot be undone