Pharmacy API
Push e-prescriptions, record dispense events, and sync inventory from your POS or dispensing system into CuraRx on the Curably Platform.
Last updated June 2026
Overview
The Pharmacy API is part of CuraRx — prescription and pharmacy verification on the Curably Platform. It lets pharmacy chains and POS vendors integrate without the full provider portal UI.
Sandbox
PHARMACY_API_SECRET in your environment. Production secrets are issued per pharmacy organization during onboarding.HMAC authentication
All Pharmacy API requests must include a signature header computed over the raw JSON body (before parsing).
X-Cura-Signature: sha256=<hex>
Content-Type: application/jsonconst crypto = require("crypto");
function sign(body, secret) {
const h = crypto.createHmac("sha256", secret).update(body, "utf8").digest("hex");
return "sha256=" + h;
}Invalid signatures return 401 Invalid signature. The platform uses timing-safe comparison to prevent oracle attacks.
e-Prescription intake
/api/pharmacy/erxIngest an incoming e-prescription and link it to a verified Curably beneficiary.
{
"rxId": "RX-7781",
"orgId": "pharmacy-org-uuid",
"patient": {
"cura_id": "CURA-XXXX",
"name": "Ada Okafor"
},
"drug": "Amoxicillin 500mg",
"qty": 20,
"prescriber": "Dr. Emeka Nwosu",
"directions": "1 capsule TID x 7 days"
}| Field | Required | Notes |
|---|---|---|
| rxId | Yes | Unique prescription identifier from prescriber or HMO |
| patient.cura_id | Yes | Must resolve to an existing profile |
| drug | Yes | Display name or formulary code |
| qty | No | Quantity to dispense |
| orgId | No | Pharmacy organization UUID |
Success returns { ok: true, id: "..." } with the persisted medical record ID. Unknown patients return 404.
Dispense events
/api/pharmacy/dispenseRecord that a prescription was dispensed — creates auditable evidence for claims and adherence.
{
"rxId": "RX-7781",
"drug": "Amoxicillin 500mg",
"qty": 20,
"actor": "Pharmacist Ada",
"dispensedAt": "2026-06-10T11:45:00Z",
"batchNumber": "LOT-2026-0412"
}- Links to the original eRx via
rxId - Emit audit events visible in Audit & compliance
- Supports offline queue: POST when connectivity returns (use Idempotency-Key)
Inventory sync
/api/pharmacy/inventoryBulk upsert SKU stock levels from your POS.
{
"items": [
{ "sku": "RX-001", "name": "Amoxicillin 500mg", "stock": 120 },
{ "sku": "RX-002", "name": "Metformin 850mg", "stock": 80 }
]
}Inventory history is available via GET /api/pharmacy/inventory/history for controlled-substance and NAFDAC audit trails.
Patient lookup
/api/pharmacy/patient-dataFetch consent-scoped patient data at dispense time (allergies, active meds).
Requires active consent with medications.read and/or allergies.read scopes. See Consent & privacy.
Errors
| Code | Body | Resolution |
|---|---|---|
| 401 | Invalid signature | Recompute HMAC on raw body |
| 400 | Missing rxId/patient/drug | Include required fields |
| 404 | Patient not found | Verify cura_id enrollment |
| 500 | Persistence failed | Retry; contact support with rxId |