The CitaBox REST API is an HTTP/JSON interface that powers the CitaBox clinic management platform. Every feature available in the CitaBox dashboard — scheduling, patient records, billing, and analytics — is accessible programmatically through this API. This page covers the foundational conventions you need to understand before calling any endpoint.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/FerchoSG/healthcare-web/llms.txt
Use this file to discover all available pages before exploring further.
Base URL
All API requests are made to the base URL configured via theNEXT_PUBLIC_API_URL environment variable. If the variable is not set, the client defaults to http://localhost:3001.
NEXT_PUBLIC_API_URL in your environment to point at the production or staging server.
Request format
All requests must send and receive JSON. Include theContent-Type: application/json header on every request that has a body (POST, PATCH).
Authentication headers
Most endpoints require two headers to identify both the calling user and the clinic context.| Header | Value | Required |
|---|---|---|
Authorization | Bearer <access_token> | Yes (authenticated endpoints) |
x-clinic-id | UUID of the active clinic | Yes (authenticated endpoints) |
Content-Type | application/json | Yes (POST / PATCH) |
access_token and clinic_id by calling POST /auth/login. See the authentication page for the full login flow.
Public endpoints
Booking and public clinic endpoints are exempt from authentication. These paths are designed for the patient-facing booking widget and do not requireAuthorization or x-clinic-id headers.
Public path prefixes:
/public/clinics/:slug/booking/*
Response structure
Successful responses return JSON bodies with HTTP 2xx status codes. The shape of the body depends on the endpoint. Common patterns:- Single object — most GET, POST, and PATCH endpoints return the affected resource directly.
- Paginated list —
GET /patientsreturns aPaginatedResponse<T>wrapper:
- 204 No Content — DELETE endpoints return HTTP 204 with no body.
Error handling
When a request fails, the API returns a non-2xx status code and a JSON error body:message field may be a string or an array of strings (validation errors). The optional error field contains the HTTP reason phrase.
Receiving a
401 Unauthorized response automatically invalidates the stored auth session on the client. You must re-authenticate via POST /auth/login to obtain a new token.Example: authenticated request
Explore the API
Authentication
Login, token management, and the /auth/me endpoint.
Appointments
Schedule, update, cancel appointments, and manage time blocks.
Patients
Search, create, and retrieve patient profiles.
Medical records
Create and retrieve electronic medical records including prescriptions.
Billing
Manage invoices and Costa Rica Hacienda e-billing integration.
Public booking
Unauthenticated endpoints for the patient-facing booking flow.
Analytics
KPI metrics and revenue trends for the admin dashboard.