Explore documentation

Immunization

Learn about the Immunization resource for vaccination records.

Set up the SDK server client to run the examples using esus. The REST examples use a session token. To run them with the SDK’s API key, send X-API-Key instead of Authorization.

The Immunization resource records vaccine administration: which vaccine was given, when, and who administered it.

API convention: the patient, encounter, and location references are sent as flat string fields (patientId, encounterId, locationId). Performer references use the standard FHIR shape. All ids are raw UUIDs (v4).

Creating an Immunization Record

REST
curl -X POST https://api.esus.health/fhir/Immunization \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/fhir+json" \
  -d '{
    "status": "completed",
    "patientId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "vaccineCode": {
      "coding": [{
        "system": "http://hl7.org/fhir/sid/cvx",
        "code": "208",
        "display": "COVID-19 mRNA vaccine"
      }]
    },
    "occurrenceDateTime": "2026-04-21",
    "primarySource": true,
    "lotNumber": "EK5730",
    "performer": [
      {
        "actor": {
          "reference": "Practitioner/a7b1c2d3-e4f5-6789-abcd-ef0123456789",
          "display": "Dr. Ana Lopez"
        }
      }
    ]
  }'
SDK
const created = await esus.fhir.create("Immunization", {
  "status": "completed",
  "patientId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "vaccineCode": {
    "coding": [
      {
        "system": "http://hl7.org/fhir/sid/cvx",
        "code": "208",
        "display": "COVID-19 mRNA vaccine"
      }
    ]
  },
  "occurrenceDateTime": "2026-04-21",
  "primarySource": true,
  "lotNumber": "EK5730",
  "performer": [
    {
      "actor": {
        "reference": "Practitioner/a7b1c2d3-e4f5-6789-abcd-ef0123456789",
        "display": "Dr. Ana Lopez"
      }
    }
  ]
});

Required: patientId and vaccineCode. If you omit status, it is stored as completed. The patient, encounter, and location must exist in your organization; otherwise the API answers 400.

Immunization Statuses

StatusMeaning
completedThe vaccine was administered
entered-in-errorRecorded in error
not-doneThe vaccine was not given

Important Fields

FieldDescription
patientIdThe patient who received the vaccine (UUID)
vaccineCodeThe vaccine administered (CVX or SNOMED codes)
occurrenceDateTimeDate of administration
recordedWhen it was recorded
primarySourcetrue if the data comes from whoever administered the vaccine
performer[]Who administered it: actor (reference, required) and optional function
lotNumber / expirationDateLot and expiration
manufacturerManufacturer (reference)
site / routeAdministration site and route (CodeableConcept)
doseQuantityAmount administered
reasonCode[]Why it was given
isSubpotenttrue if the dose is considered subpotent (can only be sent on create)
note[]Free-text notes

Protocol Applied

{
  "protocolApplied": [
    {
      "series": "Primary series",
      "doseNumber": "1",
      "targetDisease": [
        {
          "coding": [{
            "system": "http://snomed.info/sct",
            "code": "840539006",
            "display": "COVID-19"
          }]
        }
      ]
    }
  ]
}

doseNumber identifies this dose within a series and must be sent as a string (e.g. "1"). An integer does not match the schema and the API answers 422.

Searching Immunizations

ParameterBehavior
_idExact id
patientPatient id (<uuid> or Patient/<uuid>)
encounterEncounter id
statusExact
vaccine-codeExact system|code, or partial text
dateDate of occurrenceDateTime, with optional prefix eq, gt, lt, ge, or le; repeat it for a range (date=ge2026-01-01&date=lt2026-02-01)
locationLocation id
lot-numberPartial text
seriesPartial text inside protocolApplied

Page with _count and _offset, and sort with _sort by _lastUpdated, date, or status.

REST
curl "https://api.esus.health/fhir/Immunization?patient=3fa85f64-5717-4562-b3fc-2c963f66afa6&_sort=-date" \
  -H "Authorization: Bearer YOUR_TOKEN"
SDK
const { resources, total } = await esus.fhir.search("Immunization", {
  "patient": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "_sort": "-date"
});

Read, update (PUT/PATCH), delete, and _history work the same as for Patient: see CRUD Operations.

Why Track Immunizations

Immunization records are essential for:

  • Patient safety — avoiding duplicate doses
  • Public health tracking
  • School and travel requirements
  • Knowing when the next dose is due