Explore documentation

AllergyIntolerance

Learn about recording patient allergies and intolerances.

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 AllergyIntolerance resource records allergies and adverse reactions to substances, medications, foods, and other agents. It is critical for patient safety.

API convention: the patient reference is sent as a flat string field (patientId, not subjectId). encounterId is optional for recording context. All ids are raw UUIDs (v4).

Creating an Allergy Record

REST
curl -X POST https://api.esus.health/fhir/AllergyIntolerance \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/fhir+json" \
  -d '{
    "patientId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "clinicalStatus": {
      "coding": [{
        "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
        "code": "active",
        "display": "Active"
      }]
    },
    "verificationStatus": {
      "coding": [{
        "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
        "code": "confirmed",
        "display": "Confirmed"
      }]
    },
    "type": "allergy",
    "category": ["medication"],
    "criticality": "high",
    "code": {
      "coding": [{
        "system": "http://snomed.info/sct",
        "code": "387458008",
        "display": "Penicillin"
      }]
    },
    "reaction": [
      {
        "manifestation": [
          { "coding": [{ "system": "http://snomed.info/sct", "code": "126485001", "display": "Urticaria" }] }
        ],
        "severity": "severe"
      }
    ]
  }'
SDK
const created = await esus.fhir.create("AllergyIntolerance", {
  "patientId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "clinicalStatus": {
    "coding": [
      {
        "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
        "code": "active",
        "display": "Active"
      }
    ]
  },
  "verificationStatus": {
    "coding": [
      {
        "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
        "code": "confirmed",
        "display": "Confirmed"
      }
    ]
  },
  "type": "allergy",
  "category": [
    "medication"
  ],
  "criticality": "high",
  "code": {
    "coding": [
      {
        "system": "http://snomed.info/sct",
        "code": "387458008",
        "display": "Penicillin"
      }
    ]
  },
  "reaction": [
    {
      "manifestation": [
        {
          "coding": [
            {
              "system": "http://snomed.info/sct",
              "code": "126485001",
              "display": "Urticaria"
            }
          ]
        }
      ],
      "severity": "severe"
    }
  ]
});

The only required field is patientId. code is optional: for a verbal history without a coded substance you can record just the reactions. The patient and encounter must exist in your organization; otherwise the API answers 400. Other optional fields: onsetDateTime, recordedDate, lastOccurrence, recorder, asserter, note, and identifier (identifier can only be sent on create).

Clinical Status

CodeDescription
activeCurrently affects the patient
inactiveNo longer active
resolvedPreviously existed, now resolved

Type and Criticality

type accepts allergy or intolerance. criticality is the potential risk of a future reaction:

LevelMeaning
lowLow risk if exposed
highHigh risk if exposed
unable-to-assessCannot be determined

Categories

category is a list with one or more of these values:

  • medication — medications
  • food — foods
  • environment — pollen, dust, animal dander
  • biologic — biologic products

Reaction Details

Each entry in reaction[] needs manifestation (a list of CodeableConcepts) and may include:

FieldDescription
substanceThe specific agent that triggered this reaction (CodeableConcept)
exposureRouteHow the patient was exposed (oral, topical, etc.)
severitymild, moderate, or severe
noteFree-text notes

Searching Allergies

ParameterBehavior
_idExact id
patientPatient id (<uuid> or Patient/<uuid>)
encounterEncounter id
type, criticalityExact
clinical-status, verification-status, categoryPartial text
codeExact system|code, or partial text
dateDate of recordedDate, with optional prefix eq, gt, lt, ge, or le; repeat it for a range (date=ge2026-01-01&date=lt2026-02-01)
onsetDate of onsetDateTime, with the same prefixes
recorder, asserterReference, partial match

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

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

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

Why It Matters

Allergy information must be available to everyone caring for the patient. Many medical errors happen when it is not communicated properly.