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

StatusMeaning
draftNot yet active
activeThe order is currently active
on-holdTemporarily suspended
completedThe order has been fulfilled
cancelledThe order was cancelled
stoppedThe order was stopped early
entered-in-errorRecorded in error
unknownStatus unknown

Error Handling

CodeMeaning
400Invalid resource or missing required fields
401Missing or invalid token
403User lacks permission to create orders
422Business-rule violation (e.g., duplicate order)