Admin Availability API
Administrative endpoints for managing provider availability and scheduling.
Available Slots
List Available Slots
Get a list of available appointment slots.
Endpoint: GET /v1/admin/clinic/availability/available_slots
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 |
provider_id | integer | No | Filter by provider ID |
start_date | string | No | Start date filter (YYYY-MM-DD) |
end_date | string | No | End date filter (YYYY-MM-DD) |
available | boolean | No | Filter by availability status |
Example Request
GET /v1/admin/clinic/availability/available_slots?provider_id=456&start_date=2023-10-27 HTTP/1.1
Content-Type: application/json
X-User-Token: your_admin_token_hereSearch Available Slots
Endpoint: GET /v1/admin/clinic/availability/available_slots/search
Authentication: Required (Admin role)
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
provider_id | integer | No | Provider ID |
date | string | No | Specific date (YYYY-MM-DD) |
duration | integer | No | Required duration in minutes |
appointment_type | string | No | Type of appointment |
Create Available Slot
Endpoint: POST /v1/admin/clinic/availability/available_slots
Authentication: Required (Admin role)
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
available_slot | object | Yes | Slot data object |
available_slot.provider_id | integer | Yes | Provider ID |
available_slot.start_time | string | Yes | Start time (ISO 8601) |
available_slot.end_time | string | Yes | End time (ISO 8601) |
available_slot.appointment_type | string | No | Type of appointment |
available_slot.recurring | boolean | No | Whether slot is recurring |
available_slot.recurrence_pattern | string | No | Recurrence pattern |
Example Request
POST /v1/admin/clinic/availability/available_slots HTTP/1.1
Content-Type: application/json
X-User-Token: your_admin_token_here
{
"available_slot": {
"provider_id": 456,
"start_time": "2023-10-27T14:00:00.000Z",
"end_time": "2023-10-27T15:00:00.000Z",
"appointment_type": "therapy",
"recurring": true,
"recurrence_pattern": "weekly"
}
}Get Available Slot Details
Endpoint: GET /v1/admin/clinic/availability/available_slots/{id}
Authentication: Required (Admin role)
Update Available Slot
Endpoint: PUT /v1/admin/clinic/availability/available_slots/{id}
Authentication: Required (Admin role)
Delete Available Slot
Endpoint: DELETE /v1/admin/clinic/availability/available_slots/{id}
Authentication: Required (Admin role)
Provider Available Slots
List Provider Available Slots
Endpoint: GET /v1/admin/clinic/availability/providers/available_slots
Authentication: Required (Admin role)
Create Provider Available Slots in Batch
Endpoint: POST /v1/admin/clinic/availability/providers/available_slots/create_in_batch
Authentication: Required (Admin role)
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
provider_id | integer | Yes | Provider ID |
slots | array | Yes | Array of slot objects |
slots[].start_time | string | Yes | Start time (ISO 8601) |
slots[].end_time | string | Yes | End time (ISO 8601) |
slots[].appointment_type | string | No | Type of appointment |
Example Request
POST /v1/admin/clinic/availability/providers/available_slots/create_in_batch HTTP/1.1
Content-Type: application/json
X-User-Token: your_admin_token_here
{
"provider_id": 456,
"slots": [
{
"start_time": "2023-10-27T09:00:00.000Z",
"end_time": "2023-10-27T10:00:00.000Z",
"appointment_type": "therapy"
},
{
"start_time": "2023-10-27T10:00:00.000Z",
"end_time": "2023-10-27T11:00:00.000Z",
"appointment_type": "therapy"
}
]
}Delete Provider Available Slots in Batch
Endpoint: DELETE /v1/admin/clinic/availability/providers/available_slots/destroy_in_batch
Authentication: Required (Admin role)
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
provider_id | integer | Yes | Provider ID |
slot_ids | array | Yes | Array of slot IDs to delete |
Booking Management
List Books
Get a list of booking records.
Endpoint: GET /v1/admin/clinic/availability/books
Authentication: Required (Admin role)
Create Book
Endpoint: POST /v1/admin/clinic/availability/books
Authentication: Required (Admin role)
Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
book | object | Yes | Booking data object |
book.available_slot_id | integer | Yes | Available slot ID |
book.patient_id | integer | Yes | Patient ID |
book.appointment_type | string | No | Type of appointment |
book.notes | string | No | Booking notes |
Example Request
POST /v1/admin/clinic/availability/books HTTP/1.1
Content-Type: application/json
X-User-Token: your_admin_token_here
{
"book": {
"available_slot_id": 789,
"patient_id": 1049,
"appointment_type": "therapy",
"notes": "Initial consultation"
}
}Response Format
Available Slot Response
{
"id": 789,
"provider_id": 456,
"start_time": "2023-10-27T14:00:00.000Z",
"end_time": "2023-10-27T15:00:00.000Z",
"appointment_type": "therapy",
"available": true,
"recurring": true,
"recurrence_pattern": "weekly",
"created_at": "2023-10-20T10:00:00.000Z",
"updated_at": "2023-10-20T10:00:00.000Z",
"provider": {
"id": 456,
"first_name": "Dr. Jane",
"last_name": "Smith"
}
}Batch Creation Response
{
"created_slots": 2,
"failed_slots": 0,
"slot_ids": [789, 790],
"errors": []
}Book Response
{
"id": 123,
"available_slot_id": 789,
"patient_id": 1049,
"appointment_type": "therapy",
"notes": "Initial consultation",
"status": "confirmed",
"created_at": "2023-10-27T12:00:00.000Z",
"updated_at": "2023-10-27T12:00:00.000Z"
}Recurrence Patterns
Available recurrence patterns:
daily- Repeats dailyweekly- Repeats weeklybiweekly- Repeats every two weeksmonthly- Repeats monthlycustom- Custom recurrence pattern
Appointment Types
Common appointment types:
therapy- Therapy sessionconsultation- Initial consultationfollow_up- Follow-up appointmentassessment- Assessment sessiongroup_therapy- Group therapy sessionmedication_review- Medication review
Error Responses
403 Forbidden
{
"errors": "Admin access required"
}422 Unprocessable Entity
{
"errors": {
"provider_id": ["can't be blank"],
"start_time": ["can't be blank", "must be in the future"],
"end_time": ["must be after start time"]
}
}409 Conflict
{
"errors": "Time slot conflicts with existing availability"
}Notes
- All admin availability endpoints require administrative privileges
- Available slots can be created individually or in batches for efficiency
- Recurring slots automatically generate future availability
- Booking management helps track slot utilization
- Time conflicts are automatically detected and prevented
- Batch operations support bulk availability management
- Provider availability can be filtered by multiple criteria