Skip to content

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:

  1. The prescription is in validated status.
  2. All critical and contraindicated drug interactions have been acknowledged.
  3. The signed_by UUID 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}/status

Request body:

{
"status": "signed",
"signed_by": "e5f6a7b8-c9d0-1234-efab-345678901234"
}
FieldTypeRequiredDescription
statusstringYesMust be "signed"
signed_byUUIDYesUUID of the doctor performing the signing

Responses:

CodeMeaning
200Prescription signed — response contains updated PrescriptionDetail
404Prescription not found
409Unacknowledged interactions exist, or invalid status transition
Terminal window
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"}'

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 interactions
httpx.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 signing
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",
},
)

Signed Prescription Fields

After signing, the PrescriptionDetail response includes:

FieldTypeDescription
statusstring"signed"
signed_atdatetimeTimestamp when the prescription was signed
signed_byUUIDUUID of the doctor who signed

Full Signing Workflow

  1. Ensure validated status — transition through draftpending_reviewvalidated, providing valid_until on the validation step.

  2. Run safety checkPOST /v1/prescriptions/{id}/safety-check to detect interactions.

  3. Acknowledge blocking interactionsPOST /v1/prescriptions/{id}/interactions/acknowledge-all or acknowledge individually.

  4. Verify readinessGET /v1/prescriptions/{id} and confirm can_sign: true.

  5. SignPATCH /v1/prescriptions/{id}/status with {"status": "signed", "signed_by": "doctor-uuid"}.