Authentication
All medication endpoints require Bearer token or API-key authentication:
curl -X POST https://api.esus.health/fhir/MedicationRequest \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/fhir+json" \
-d '{ ... }'
Creating a MedicationRequest
POST to /fhir/MedicationRequest:
curl -X POST https://api.esus.health/fhir/MedicationRequest \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/fhir+json" \
-d '{
"status": "active",
"intent": "order",
"medicationCodeableConcept": {
"coding": [{
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "197361",
"display": "Amoxicillin 500mg capsule"
}]
},
"subjectId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"requesterId": "a7b1c2d3-e4f5-6789-abcd-ef0123456789",
"authoredOn": "2026-04-21T10:30:00Z",
"dosageInstruction": [{
"text": "Take 1 capsule by mouth 3 times a day for 10 days",
"timing": {
"repeat": {
"frequency": 3,
"period": 1,
"periodUnit": "d"
}
},
"route": {
"coding": [{
"system": "http://snomed.info/sct",
"code": "26643006",
"display": "Oral"
}]
},
"doseAndRate": [{
"doseQuantity": { "value": 500, "unit": "mg" }
}]
}]
}'
Response
A successful creation returns 201 Created with the resource:
{
"resourceType": "MedicationRequest",
"id": "c1a2e3d4-5b6f-7890-abcd-ef1234567890",
"meta": {
"versionId": "1",
"lastUpdated": "2026-04-21T10:30:00Z"
},
"status": "active",
"intent": "order",
"subjectId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
Common Status Values
| Status | Meaning |
|---|---|
draft | Not yet active |
active | The order is currently active |
on-hold | Temporarily suspended |
completed | The order has been fulfilled |
cancelled | The order was cancelled |
stopped | The order was stopped early |
entered-in-error | Recorded in error |
unknown | Status unknown |
Error Handling
| Code | Meaning |
|---|---|
400 | Invalid resource or missing required fields |
401 | Missing or invalid token |
403 | User lacks permission to create orders |
422 | Business-rule violation (e.g., duplicate order) |