Skip to Content
General APIUsers

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

ParameterTypeRequiredDescription
pageintegerNoPage number for pagination
page_sizeintegerNoNumber 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_here

Create User

Create a new user account.

Endpoint: POST /v1/users
Authentication: Not required for registration

Request Body Parameters

ParameterTypeRequiredDescription
userobjectYesUser data object
user.emailstringYesUser’s email address
user.passwordstringYesUser’s password
user.first_namestringYesUser’s first name
user.last_namestringYesUser’s last name
user.phonestringNoUser’s phone number
user.date_of_birthstringNoDate of birth (YYYY-MM-DD)
user.languagestringNoPreferred language (default: “en”)
templatebooleanNoWhether this is a template user
clinicalbooleanNoWhether this is a clinical user
native_signupbooleanNoWhether 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

ParameterTypeRequiredDescription
idintegerYesUser 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

ParameterTypeRequiredDescription
idintegerYesUser ID

Delete User

Permanently delete a user account.

Endpoint: DELETE /v1/users/{id}
Authentication: Required (Admin role)

Path Parameters

ParameterTypeRequiredDescription
idintegerYesUser ID

User Confirmation

Confirm user account with verification code.

Endpoint: POST /v1/users/confirmation
Authentication: Not required

Request Body Parameters

ParameterTypeRequiredDescription
user_idintegerYesUser ID
confirmation_codestringYesVerification 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_here

Check Email Account

Check if an email address already has an account.

Endpoint: POST /v1/users/email_has_account
Authentication: Not required

Request Body Parameters

ParameterTypeRequiredDescription
emailstringYesEmail 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 role field 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