Skip to Content
Admin APIAvailability

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

ParameterTypeRequiredDescription
pageintegerNoPage number for pagination
page_sizeintegerNoNumber of items per page
provider_idintegerNoFilter by provider ID
start_datestringNoStart date filter (YYYY-MM-DD)
end_datestringNoEnd date filter (YYYY-MM-DD)
availablebooleanNoFilter 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_here

Search Available Slots

Endpoint: GET /v1/admin/clinic/availability/available_slots/search
Authentication: Required (Admin role)

Query Parameters

ParameterTypeRequiredDescription
provider_idintegerNoProvider ID
datestringNoSpecific date (YYYY-MM-DD)
durationintegerNoRequired duration in minutes
appointment_typestringNoType of appointment

Create Available Slot

Endpoint: POST /v1/admin/clinic/availability/available_slots
Authentication: Required (Admin role)

Request Body Parameters

ParameterTypeRequiredDescription
available_slotobjectYesSlot data object
available_slot.provider_idintegerYesProvider ID
available_slot.start_timestringYesStart time (ISO 8601)
available_slot.end_timestringYesEnd time (ISO 8601)
available_slot.appointment_typestringNoType of appointment
available_slot.recurringbooleanNoWhether slot is recurring
available_slot.recurrence_patternstringNoRecurrence 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

ParameterTypeRequiredDescription
provider_idintegerYesProvider ID
slotsarrayYesArray of slot objects
slots[].start_timestringYesStart time (ISO 8601)
slots[].end_timestringYesEnd time (ISO 8601)
slots[].appointment_typestringNoType 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

ParameterTypeRequiredDescription
provider_idintegerYesProvider ID
slot_idsarrayYesArray 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

ParameterTypeRequiredDescription
bookobjectYesBooking data object
book.available_slot_idintegerYesAvailable slot ID
book.patient_idintegerYesPatient ID
book.appointment_typestringNoType of appointment
book.notesstringNoBooking 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 daily
  • weekly - Repeats weekly
  • biweekly - Repeats every two weeks
  • monthly - Repeats monthly
  • custom - Custom recurrence pattern

Appointment Types

Common appointment types:

  • therapy - Therapy session
  • consultation - Initial consultation
  • follow_up - Follow-up appointment
  • assessment - Assessment session
  • group_therapy - Group therapy session
  • medication_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