Update a medical history entry
https://zwhwryofdsgmzgqbcghl.supabase.co/functions/v1/api/v1/medical_history/{id}Requires the clinical: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/medical_history/{id}' \
--header 'Authorization: Bearer '"$CUSPFLOW_API_KEY" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{ "patient_id": "", "condition_type": "", "condition_name": "" }'Path parameters
idstring<uuid> required | — |
Headers
If-Matchstring | 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-Keystring | 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
7 optional fields. Only the fields you send are changed.
patient_idstring<uuid> | — |
condition_typestring | — |
condition_namestring | — |
notesstring | — |
is_ongoingboolean | — |
added_by_staff_idstring<uuid> | — |
updated_by_staff_idstring<uuid> | — |
Responses
{
"data": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"clinic_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"patient_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"condition_type": "string",
"condition_name": "Example",
"is_ongoing": false,
"notes": "",
"added_by_staff_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"...": "…"
}
}400 | Body is not JSON, or names a field that cannot be patched. See `errors[]`. `appointments.status` and `treatment_plans.status` report `create_only` here. |
401 | Missing, malformed, revoked or expired key. |
403 | Key lacks `clinical:write`, or the clinic is read-only. |
404 | No such row in this clinic. Also returned for another clinic's row. |
412 | If-Match did not match, or the row changed between read and write. |
429 | Rate limited. |
Every error is application/problem+json and carries a code you can branch on. The full catalogue is in error codes.
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/medical_history/{id}' \
--header 'Authorization: Bearer '"$CUSPFLOW_API_KEY" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{ "patient_id": "", "condition_type": "", "condition_name": "" }'