Update a patient

PATCHhttps://zwhwryofdsgmzgqbcghl.supabase.co/functions/v1/api/v1/patients/{id}

Requires the patients:write scope. See keys and scopes.

Only the fields you send are changed.

Try it

10 requests a minute

Kept in this tab only (sessionStorage), never saved to disk and never put in the code sample. It is sent to CuspFlow's own proxy on this domain, not to a third party.

Confirm the clinic id (optional)

Fill this in and the request is refused unless the key really belongs to that clinic. It guards against pasting the wrong key, not against an attacker: the clinic is already in the key and anyone holding it can read it from whoami.

Path parameters

Headers (2)
curl --request PATCH \
  --url 'https://zwhwryofdsgmzgqbcghl.supabase.co/functions/v1/api/v1/patients/{id}' \
  --header 'Authorization: Bearer '"$CUSPFLOW_API_KEY" \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{ "branch_id": "", "family_id": "", "first_name": "" }'
Paste a key to run this.

Path parameters

id
string<uuid>
required
—

Headers

If-Match
string
The ETag from a previous GET. The write then applies only if nothing changed in between, otherwise 412. Not supported on resources with no updated_at column.
Idempotency-Key
string
Replay protection. Resending the SAME key with the SAME body returns the first response instead of acting twice; the same key with a DIFFERENT body is rejected with 422. The window is 24 hours.

Body

33 optional fields. Only the fields you send are changed.

branch_id
string<uuid>
—
family_id
string<uuid>
—
first_name
string
—
last_name
string
—
dob
string<date>
—
age_group
string
—
gender
string
—
phone
string
—
email
string
—
address
string
—
location
string
—
allergies
string
—
current_medications
string
—
medical_history_notes
string
—
dental_history_notes
string
—
patient_since
string<date-time>
—
is_active
boolean
—
is_head_of_family
boolean
—
emergency_contact_name
string
—
emergency_contact_relationship
string
—
emergency_contact_phone
string
—
emergency_contact_email
string
—
emergency_contact_location
string
—
insurance_carrier_id
string<uuid>
—
insurance_provider
string
—
insurance_policy_number
string
—
insurance_group_number
string
—
insurance_holder_name
string
—
whatsapp_number
string
—
whatsapp_opted_in
boolean
—
whatsapp_consent_at
string<date-time>
—
reminders_email_opted_out
boolean
—
reminders_whatsapp_opted_out
boolean
—

Responses

200The updated row, under `data`.
{
  "data": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "clinic_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "branch_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "family_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "patient_code": "string",
    "first_name": "Amina",
    "last_name": "Okello",
    "dob": "2026-11-05",
    "...": "…"
  }
}
400Body is not JSON, or names a field that cannot be patched. See `errors[]`. `appointments.status` and `treatment_plans.status` report `create_only` here.
401Missing, malformed, revoked or expired key.
403Key lacks `patients:write`, or the clinic is read-only.
404No such row in this clinic. Also returned for another clinic's row.
412If-Match did not match, or the row changed between read and write.
429Rate limited.

Every error is application/problem+json and carries a code you can branch on. The full catalogue is in error codes.