> ## 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.

# Errors

> Status codes and error codes.

Errors come back as JSON with a stable `error` code, sometimes with details:

```json theme={null}
{ "error": "outside_hours", "details": { "periods": "16:00-18:00, 19:00-22:00" } }
```

Branch on `error`, not on the message.

| Status | Meaning |
| - | - |
| 400 | The request is invalid (`invalid_phone`, `name_required`, `invalid_start`, ...) |
| 401 | `unauthorized`: no key, wrong key or revoked key |
| 403 | `api_access_not_approved`, `docistra_is_master`, `not_a_clinic` |
| 404 | `not_found`, or `unknown_doctor` / `unknown_branch` / `unknown_patient` for a body reference |
| 409 | The request clashes with the current state |
| 422 | `idempotency_key_reused` |
| 429 | `rate_limited` (see `Retry-After`) |
| 500 | `server_error`: retry with the same `Idempotency-Key` |

## Booking errors (409 unless noted)

| Error | Meaning |
| - | - |
| `slot_taken` | Another booking is at that time |
| `outside_hours` | Not inside the doctor's working hours that day (`details.periods`) |
| `not_working_day` | The doctor doesn't work that day at that branch |
| `off_override` | The doctor is off that day |
| `fully_booked` | A queue day with no places left |
| `not_queue_day` | You sent `date` for a day that has times |
| `past` (400) | The time already passed |
| `clinic_unavailable` (404) | The clinic can't take bookings right now (billing) |
| `doctor_unavailable` (404) | The doctor is inactive |
| `not_editable` | Only a `reserved` appointment can be moved |
| `queue_visit` | A queue-day visit can't be moved to a time |
| `paid_locked` | A paid visit can't be cancelled or marked no-show |
| `not_allowed` | That status change isn't allowed (for example completed to reserved) |
| `conflict` | Someone changed it at the same moment: read it again |

## Other conflicts

| Error | Meaning |
| - | - |
| `external_id_taken` | Another record already has that `external_id` |
| `external_id_conflict` | The matched patient is linked to a different `external_id` |
| `file_number_taken` | Another patient has that file number |
| `has_booked_patients` | New hours would leave booked patients outside them (`appointment_ids`) |
| `future_bookings` | A branch with upcoming bookings can't be deactivated |
| `plan_limit` | The clinic's plan doesn't allow another active doctor |


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