Digital Signing
Digital Signing
In DELPHOS, signing a prescription is a status transition — not a
separate cryptographic endpoint. The physician advances the prescription to
the signed status by calling the status transition endpoint with the
required fields.
Prerequisites for Signing
Before a prescription can be signed, all of the following must be true:
- The prescription is in
validatedstatus. - All
criticalandcontraindicateddrug interactions have been acknowledged. - The
signed_byUUID is provided in the request body.
If unacknowledged blocking interactions exist, the endpoint returns 409
with an unacknowledged_interactions error listing the interaction IDs and
severities.
Signing a Prescription
PATCH /v1/prescriptions/{prescription_id}/statusRequest body:
{ "status": "signed", "signed_by": "e5f6a7b8-c9d0-1234-efab-345678901234"}| Field | Type | Required | Description |
|---|---|---|---|
status | string | Yes | Must be "signed" |
signed_by | UUID | Yes | UUID of the doctor performing the signing |
Responses:
| Code | Meaning |
|---|---|
200 | Prescription signed — response contains updated PrescriptionDetail |
404 | Prescription not found |
409 | Unacknowledged interactions exist, or invalid status transition |
curl -X PATCH "https://your-instance.delphos.app/v1/prescriptions/PRESCRIPTION_ID/status" \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"status": "signed", "signed_by": "e5f6a7b8-c9d0-1234-efab-345678901234"}'import httpx
response = httpx.patch( f"https://your-instance.delphos.app/v1/prescriptions/{prescription_id}/status", headers={"x-api-key": "YOUR_API_KEY"}, json={ "status": "signed", "signed_by": "e5f6a7b8-c9d0-1234-efab-345678901234", },)
if response.status_code == 409: error = response.json() if error.get("error") == "unacknowledged_interactions": print(f"Must acknowledge {error['interaction_count']} interactions first")else: signed = response.json() print(f"Signed at: {signed['signed_at']}")Handling Blocked Signing
If blocking interactions exist, the 409 response contains:
{ "error": "unacknowledged_interactions", "prescription_id": "a7b8c9d0-...", "interaction_count": 2, "interactions": [ {"id": "b1c2d3e4-...", "severity": "critical"}, {"id": "c2d3e4f5-...", "severity": "contraindicated"} ], "message": "..."}Acknowledge each interaction (or all at once), then retry the sign transition:
import httpx
# Acknowledge all blocking interactionshttpx.post( f"https://your-instance.delphos.app/v1/prescriptions/{prescription_id}/interactions/acknowledge-all", headers={"x-api-key": "YOUR_API_KEY"}, json={"doctor_id": "e5f6a7b8-c9d0-1234-efab-345678901234"},)
# Retry signingresponse = httpx.patch( f"https://your-instance.delphos.app/v1/prescriptions/{prescription_id}/status", headers={"x-api-key": "YOUR_API_KEY"}, json={ "status": "signed", "signed_by": "e5f6a7b8-c9d0-1234-efab-345678901234", },)Signed Prescription Fields
After signing, the PrescriptionDetail response includes:
| Field | Type | Description |
|---|---|---|
status | string | "signed" |
signed_at | datetime | Timestamp when the prescription was signed |
signed_by | UUID | UUID of the doctor who signed |
Full Signing Workflow
-
Ensure
validatedstatus — transition throughdraft→pending_review→validated, providingvalid_untilon the validation step. -
Run safety check —
POST /v1/prescriptions/{id}/safety-checkto detect interactions. -
Acknowledge blocking interactions —
POST /v1/prescriptions/{id}/interactions/acknowledge-allor acknowledge individually. -
Verify readiness —
GET /v1/prescriptions/{id}and confirmcan_sign: true. -
Sign —
PATCH /v1/prescriptions/{id}/statuswith{"status": "signed", "signed_by": "doctor-uuid"}.