Skip to main content

Your system to Docistra

When a patient is created or changed in your system, send it:
POST /patients never makes a second copy of a person. It finds the patient in this order:
  1. already linked to this external_id
  2. the same phone and the same name. Arabic and English spellings of the same name match (“منى سامي” and “Mona Samy”)
  3. the same phone with a different name: a family member who uses that phone. They’re created under the phone’s holder (holder_id), so messages still reach that phone
A matched patient is updated with what you sent and linked to your external_id; you get 200 with "created": false. A new patient is 201 with "created": true. For later changes, use PATCH /patients/ext:P-10293 with only the fields that changed. null clears a field.

Phones

Egyptian mobiles are accepted in any spelling (01012345678, +201012345678, 201012345678) and returned as +201012345678. International numbers must start with + or 00.

Family members

To add a child under a parent explicitly, send holder_id (the parent, as an id or ext:) and relationship (son, daughter, wife, husband, father, mother, brother, sister, grandson, granddaughter, grandfather, grandmother, other).

Docistra to your system

Patients also appear in Docistra without you: the AI agent registers new patients from WhatsApp, and patients book on the clinic’s page. Listen to patient.created and patient.updated:
  1. If data.object.external_id is set, it’s a patient you already have: update it.
  2. If not, create it in your system, then link it back: PATCH /patients/{id} with {"external_id": "<your new id>"}.
That PATCH doesn’t come back to you as a webhook.