> ## Documentation Index
> Fetch the complete documentation index at: https://developers.docistra.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Doctor day off

> A doctor can't come: cancel the day and tell every patient.

When a doctor won't come on a day, one call does everything:

* closes the day in Docistra, so nobody (the AI agent, the booking page, reception) can book it
* cancels every reserved booking that day
* messages each patient on WhatsApp from the clinic's own number: a normal message when the patient wrote in the last 23 hours, otherwise Docistra's approved `appointment_cancelled` template. When WhatsApp can't reach them, an SMS
* tells the patients on the waiting list that places opened, and rings the clinic's staff once

```bash theme={null}
curl -X POST https://docistra.com/api/v1/doctors/ext:D-7/days/2026-12-03/off \
  -H "Authorization: Bearer $DOCISTRA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 0d2c4b1a-day-off-D7-2026-12-03" \
  -d '{ "reason": "Doctor is sick" }'
```

```json theme={null}
{
  "data": {
    "doctor_id": "9b1c...",
    "date": "2026-12-03",
    "branch_ids": ["5e0a..."],
    "cancelled": [
      { "appointment_id": "c2a1...", "patient_id": "77de...", "patient_notified": { "via": "whatsapp_template" } },
      { "appointment_id": "d4f0...", "patient_id": "a1b2...", "patient_notified": { "via": "sms" } }
    ],
    "not_cancelled": [
      { "appointment_id": "e9c3...", "patient_id": "c3d4...", "error": "paid_locked" }
    ],
    "kept": []
  }
}
```

## Options

| Field | Default | |
| - | - | - |
| `branch_id` | every branch | Close the day at one branch only |
| `cancel_bookings` | `true` | `false` keeps the bookings and asks each patient to pick another time instead |
| `notify_patient` | `true` | `false` cancels without messaging (when your system tells the patients itself) |
| `reason` | | Saved on the day and as each booking's `cancel_reason` (`doctor_day_off` when empty) |

## Good to know

* Paid visits are never cancelled automatically. They come back in `not_cancelled` with `paid_locked`, for reception to handle.
* `patient_notified.via` is `null` with a `reason` when a patient couldn't be messaged: `no_phone`, `consent` (they declined messages), `test_org` (the clinic is still in test mode in Docistra), `no_channel`.
* Calling it again for the same day is safe: the day stays closed, and bookings already cancelled are skipped.
* To reopen the day: `DELETE /doctors/{id}/days/{date}/off`. Bookings cancelled by the day off stay cancelled.
* Running late instead of absent? Use `POST /doctors/{id}/delay` with `minutes`: every visit still ahead that day moves later and each patient is told the new time.
* If the clinic closes a day in Docistra itself, you get a `doctor.day_off` webhook, plus `appointment.cancelled` for each booking reception cancels.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.