curl and jq; every step is the same over any HTTP client.
Before you start
- An organization API key with
services.read,professionals.read,calendar.read,appointments.read,appointments.create,appointments.rescheduleandappointments.cancel, pluspatients.administrative.readto find the patient. - The
agendaandteamdata areas on (the default). Finding the patient by name needs thepatientsarea too; if it is off, use a patient id you already have.
1. Get the ids
centerId from GET /v1/centers and send it in the next steps.
2. Find free slots
Response
- Slots follow the clinic’s opening hours and agenda step, and leave out what the professional already has booked or blocked: exactly what Brelio’s agenda would accept.
- Times are UTC. The clinic in this example is in Madrid (UTC+1), so
08:00Zis 09:00 local time. - The window is at most 31 days, and at most 50 slots come back. The length is the service’s duration unless you send
durationMinutes.
3. Book it
Send one of thestartAt values as start, with a new Idempotency-Key:
201 Created
id. It is opaque: it can contain : and a date, and the date in it does not change when the appointment moves. Use it as is.
If someone took the slot since you searched, the answer is 409 APPOINTMENT_OVERLAP_DETECTED: search again and offer another time.
4. Read it
Response
GET /v1/agenda?from=…&to=… lists the same appointments for a window, with the same ids.
5. Reschedule it
Send theversion you just read as expectedVersion, and a new start from a new availability search:
Response
409 VERSION_CONFLICT: read it again and decide again. See concurrency.
6. Cancel it
Response
reasonis administrative only. Never put clinical information in it.- Cancelling cannot be undone through the API.
- An appointment that already has a session (checked in or later) is cancelled in Brelio:
409 APPOINTMENT_CANCEL_IN_BRELIO.
Limits of this version
- Only one-off appointments. Recurring series answer
422 APPOINTMENT_RECURRING_UNSUPPORTEDon reschedule and cancel. - Booking, rescheduling and cancelling are REST only; MCP assistants can read the agenda and free slots but not write yet.
patientIdin the agenda isnullunless the clinic’spatientsarea is on and your key was accepted for patient data.
The whole flow in Node.js
book.mjs