Authorize · Guide
Review clinical orders
Use clinician ordering when an AI agent proposes a prescription, lab or referral that a licensed clinician must approve. The agent submits the order with its reasoning, and the clinician reviews both and authorizes with a passkey. You get a signed record of who authorized exactly what, when, with which verified credential. Your system then places the order.
Before you begin: export the sandbox Enterprise key. Its account has a seeded prescriber whose NPI is verified.
export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
Limitations: Provenance authorizes and records; it doesn't place orders, make clinical decisions or check drug interactions. It isn't certified for electronic prescribing of controlled substances (EPCS), so a controlled order is authorized for the record and your system transmits it under its own authority.
1. Register the prescriber
Register each clinician with POST /. Provenance checks the credentials itself and assigns a tier; a tier sent by the client is ignored.
tier | Confirmed by |
|---|---|
self_ | Nothing yet: a name on file |
npi_ | A valid NPI whose name matches the CMS NPPES registry |
license_ | An active state license with no disciplinary action, from a credential vendor |
dea_ | A valid DEA registration, from a credential vendor |
A match on a federal exclusion list sets excluded: true, and that prescriber's orders are refused whatever their tier.
curl $PROVENANCE_API/v1/authorize/prescribers \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "full_name": "Jane Doe, MD", "npi": "1234567893", "license_state": "MA" }'
import { Provenance } from "@provenanceauth/sdk";
const prov = new Provenance({ apiKey: process.env.PROVENANCE_KEY!, baseUrl: process.env.PROVENANCE_API });
const prescriber = await prov.authorize.prescribers.create({ fullName: "Jane Doe, MD", npi: "1234567893", licenseState: "MA" });
import os
import httpx
api, headers = os.environ["PROVENANCE_API"], {"Authorization": f"Bearer {os.environ['PROVENANCE_KEY']}"}
prescriber = httpx.post(f"{api}/v1/authorize/prescribers", json={"full_name": "Jane Doe, MD", "npi": "1234567893", "license_state": "MA"}, headers=headers).json()
The response, trimmed:
{
"id": "presc_01M5Q2ZT9RZK82MNZTBANQV36H",
"object": "prescriber",
"full_name": "Jane Doe, MD",
"npi": "1234567893",
"excluded": false,
"exclusion_checked": false
}
The tier field shows the result, and evidence lists each credential source and what it found. A source that isn't set up on the server says so, and the tier stops below it: without a credential vendor, the highest tier is npi_verified.
2. Check which orders need which tier
The clinical_order policy sets the tier each kind of order needs, and which need a second clinician. Read it with GET /:
curl "$PROVENANCE_API/v1/authorize/clinical_order_policies" \
-H "Authorization: Bearer $PROVENANCE_KEY"
const policy = await prov.mandate.policies.get({ domain: "clinical_order" });
policy = httpx.get(f"{api}/v1/mandate/policies", params={"domain": "clinical_order"}, headers=headers).json()
{
"object": "policy",
"domain": "clinical_order",
"document": {
"rules": [
{ "id": "controlled-substance", "match": { "controlled": true }, "required_tier": "dea_verified", "cosign": true },
{ "id": "prescription", "match": { "order_type": "rx" }, "required_tier": "npi_verified" }
],
"default_required_tier": "self_attested"
},
"is_default": true
}
By default a controlled substance needs a dea_verified prescriber and a second clinician's co-sign, and a prescription needs npi_verified. Change it with PUT /v1/authorize/clinical_order_policies.
3. Submit the agent's order
The agent submits the order with POST /. The payload is bound by hash, so the order placed can't differ from the one authorized. The reasoning is the agent's own account, bound into the record and shown to the clinician labelled as agent-supplied.
curl -s $PROVENANCE_API/v1/authorize/clinical_orders \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"prescriber_id": "presc_00000000000000000000000048",
"order_type": "rx",
"payload": { "drug": "amoxicillin", "dose": "500mg", "route": "PO", "quantity": 30, "frequency": "TID" },
"reasoning": { "diagnosis": "strep pharyngitis", "rapid_strep": "positive" }
}' | tee order.json
export ORDER_ID=$(jq -r .id order.json)
const order = await prov.authorize.clinicalOrders.create({
prescriberId: "presc_00000000000000000000000048",
orderType: "rx",
payload: { drug: "amoxicillin", dose: "500mg", route: "PO", quantity: 30, frequency: "TID" },
reasoning: { diagnosis: "strep pharyngitis", rapid_strep: "positive" },
});
order = httpx.post(f"{api}/v1/authorize/clinical_orders", json={
"prescriber_id": "presc_00000000000000000000000048",
"order_type": "rx",
"payload": {"drug": "amoxicillin", "dose": "500mg", "route": "PO", "quantity": 30, "frequency": "TID"},
"reasoning": {"diagnosis": "strep pharyngitis", "rapid_strep": "positive"},
}, headers=headers).json()
The response, trimmed:
{
"id": "ord_01M5Q30H0NRZKYZAC2SGFRGVRX",
"object": "order",
"status": "pending_review",
"order_type": "rx",
"controlled": false,
"clinical_summary": "amoxicillin · 500mg · PO · 30 · TID",
"prescriber": { "full_name": "Jane Doe, MD", "npi": "1234567893", "tier": "npi_verified", "excluded": false },
"required_tier": "npi_verified",
"approvals_needed": 1,
"policy": { "id": "pol_3F9A1C7E52B04D8E6A1F27C9B4", "version": null, "rule": { "id": "prescription", "name": null, "phase": "assess", "action": "review", "conditions": [] } }
}
Orders wait 24 hours for review, then expire.
4. The clinician reviews and decides
Show the clinician the order and its reasoning, in your EHR with the <provenance-clinical-order> embed or on your own screen. They authorize with a passkey, as in biometric approval, through POST /. Re-sending the payload checks that it hasn't changed.
{
"id": "ord_01M5Q30H0NRZKYZAC2SGFRGVRX",
"object": "order",
"status": "authorized",
"authorized_tier": "npi_verified",
"outcome": "authorized"
}
To refuse, the clinician declines with POST /. A decided order can't be decided again.
curl $PROVENANCE_API/v1/authorize/clinical_orders/$ORDER_ID/decline \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "reason": "Penicillin allergy on file" }'
await prov.authorize.clinicalOrders.decline(order.id, "Penicillin allergy on file");
httpx.post(f"{api}/v1/authorize/clinical_orders/{order['id']}/decline", json={"reason": "Penicillin allergy on file"}, headers=headers)
{
"id": "ord_01M5Q30H0NRZKYZAC2SGFRGVRX",
"object": "order",
"status": "declined",
"decline_reason": "Penicillin allergy on file",
"outcome": "declined"
}
5. Place the authorized order
Subscribe a webhook to authorize.clinical_order.authorized; your system places the order when it arrives. Read the order to confirm the status rather than trusting a browser event. For the record, GET / returns an ES256-signed receipt with the prescriber's tier and the sealed reasoning, verifiable offline against the published keys.
Errors you might see
| Symptom | Cause | Fix |
|---|---|---|
outcome: "denied", reason: "prescriber_ | The prescriber's tier is below what the policy requires | Verify more credentials, or route to a qualified prescriber. |
outcome: "denied", reason: "prescriber_ | The prescriber is on a federal exclusion list | The order can't be authorized by this prescriber. |
outcome: "cosign_, reason: "controlled_ | A controlled order needs a second clinician | Have a second clinician authorize too. |
400 approval_ | Authorize was sent without a passkey assertion | Have the clinician confirm with a passkey. |
payload_ | The payload sent at authorize differs from the one submitted | Send the order's payload unchanged. |