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

# Your IDs (external_id)

> Point at Docistra records with your own ids.

Patients, appointments, doctors and branches each have an `external_id`: your system's id for the same record. Set it once and you never need to store Docistra's ids.

## Use your id anywhere

Every path `{id}` takes either Docistra's id or yours with the `ext:` prefix:

```bash theme={null}
GET /api/v1/patients/ext:P-10293
POST /api/v1/appointments/ext:A-55012/cancel
POST /api/v1/doctors/ext:D-7/days/2026-12-03/off
```

Body references work the same way: `"doctor_id": "ext:D-7"`, `"branch_id": "ext:B-1"`, `"patient_id": "ext:P-10293"`.

## Setting it

* **Patients:** send `external_id` on `POST /patients`. A patient already in Docistra (same phone and name) is matched and linked, not copied.
* **Appointments:** send `external_id` on `POST /appointments`. For a booking made in Docistra (by the AI agent, the booking page or reception), link it later with `PATCH /appointments/{id}` `{"external_id": "A-55013"}` after you get the `appointment.created` webhook.
* **Doctors and branches:** `PATCH /doctors/{id}` / `PATCH /branches/{id}` with `{"external_id": "..."}`. Every organization can do this.

## Rules

* An `external_id` is unique per organization and record type. Reusing one returns `409 external_id_taken`.
* Up to 200 characters.
* Send `null` to unlink.
* Webhook payloads carry your ids too: `external_id`, plus `patient_external_id`, `doctor_external_id` and `branch_external_id` on appointments.


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