Admin Users API
Administrative endpoints for managing users across the entire system.
List All Users
Get a comprehensive list of all users in the system.
Endpoint: GET /v1/admin/clinic/users
Authentication: Required (Admin role)
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | No | Page number for pagination |
page_size | integer | No | Number of items per page |
sort_by | string | No | Field to sort by |
sort_dir | string | No | Sort direction (“ASC” or “DESC”) |
search | string | No | Search term |
Example Request
GET /v1/admin/clinic/users?page=1&page_size=100 HTTP/1.1
Content-Type: application/json
X-User-Token: your_admin_token_hereFilter Users
Filter users with advanced administrative criteria.
Endpoint: POST /v1/admin/clinic/users/filter_users
Authentication: Required (Admin role)
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
search | string | No | Search term |
sort_by | string | No | Field to sort by |
sort_dir | string | No | Sort direction |
filters | object | No | Filter criteria with available parameters: active (boolean), roles (array), date (object with start_date/end_date), patient_name (string) |
page_size | integer | No | Number of items per page |
Example Request
POST /v1/admin/clinic/users/filter_users HTTP/1.1
Content-Type: application/json
X-User-Token: your_admin_token_here
{
"search": "john",
"filters": {
"role": "parent",
"active": true,
"clinical": true
},
"page_size": 50
}Get Archived Users
Get users who have been archived.
Endpoint: GET /v1/admin/clinic/users/archived
Authentication: Required (Admin role)
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | No | Page number for pagination |
page_size | integer | No | Number of items per page |
Get User Details
Endpoint: GET /v1/admin/clinic/users/{id}
Authentication: Required (Admin role)
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | User ID |
Example Request
GET /v1/admin/clinic/users/123 HTTP/1.1
Content-Type: application/json
X-User-Token: your_admin_token_hereUpdate User
Endpoint: PUT /v1/admin/clinic/users/{id}
Authentication: Required (Admin role)
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
user | object | Yes | User data object |
user.first_name | string | No | User’s first name |
user.last_name | string | No | User’s last name |
user.email | string | No | User’s email address |
user.phone | string | No | User’s phone number |
user.role | string | No | User’s role |
user.active | boolean | No | Whether user is active |
user.clinical | boolean | No | Whether user is clinical |
Example Request
PUT /v1/admin/clinic/users/123 HTTP/1.1
Content-Type: application/json
X-User-Token: your_admin_token_here
{
"user": {
"first_name": "Jonathan",
"role": "provider",
"active": true,
"clinical": true
}
}Archive User
Archive a user (soft delete).
Endpoint: POST /v1/admin/clinic/users/{id}/archive
Authentication: Required (Admin role)
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | User ID |
Unarchive User
Restore an archived user.
Endpoint: POST /v1/admin/clinic/users/{id}/unarchive
Authentication: Required (Admin role)
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | User ID |
Delete User
Permanently delete a user.
Endpoint: DELETE /v1/admin/clinic/users/{id}
Authentication: Required (Admin role)
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | User ID |
User Dashboard
Get dashboard information for admin users.
Endpoint: GET /v1/admin/users/dashboard
Authentication: Required (Admin role)
Response Format
{
"total_users": 1250,
"active_users": 1100,
"new_users_this_month": 45,
"clinical_users": 850,
"provider_users": 25,
"recent_activity": [
{
"user_id": 123,
"action": "login",
"timestamp": "2023-10-27T14:30:00.000Z"
}
]
}User Filters
Get available filter options for admin user searches.
Endpoint: GET /v1/admin/clinic/users/filters
Authentication: Required (Admin role)
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",
"role": "parent",
"active": true,
"clinical": true,
"confirmed": true,
"last_login": "2023-10-27T14:30:00.000Z",
"created_at": "2023-10-20T10:00:00.000Z",
"updated_at": "2023-10-20T15:30:00.000Z",
"patient": {
"id": 1049,
"active": true
}
}User Roles
Available user roles:
parent- Parent or guardianprovider- Healthcare providersupervisor- Supervisory provideradmin- System administratorsupport- Support staffbilling- Billing staff
User Status Values
active- User is active and can access the systeminactive- User is inactive but not deletedarchived- User has been archivedpending- User account is pending activationsuspended- User account is temporarily suspended
Error Responses
403 Forbidden
{
"errors": "Admin access required"
}422 Unprocessable Entity
{
"errors": {
"email": ["can't be blank", "has already been taken"],
"role": ["is not included in the list"]
}
}404 Not Found
{
"errors": "User not found"
}Notes
- All admin user endpoints require administrative privileges
- User archiving is reversible, but deletion is permanent
- Clinical users have access to patient health information
- Role changes may affect user permissions and access levels
- The dashboard provides overview metrics for system monitoring
- User activity is tracked for security and audit purposes
- Bulk operations may be available for administrative efficiency