Explore documentation

Your first Patient resource

Represent a patient and try your first query.

Patient represents a person receiving care. We will use a fictional patient to see how that information is stored and retrieved.

Set up the SDK server client to run the examples using esus. Use the fictional patient’s ID as patientId.

What is Patient?

The Patient resource represents the individual receiving healthcare services. It contains demographic data, identifiers, and links to all clinical data related to that person.

Fields in this example

These are the fields we will use in this example. resourceType identifies the resource type; the other fields describe the person and none of them is required:

FieldDescriptionExample
resourceType”Patient”. The API takes the type from the URL and does not validate this fieldPatient
identifierExternal identifiers (national ID, medical record number)See example below
namePatient namesSee example below
genderAdministrative gendermale, female, other, unknown
birthDateDate of birth1990-01-15

Creating a Patient

REST
curl -X POST https://api.esus.health/fhir/Patient \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/fhir+json" \
  -d '{
    "resourceType": "Patient",
    "active": true,
    "identifier": [
      { "system": "urn:oid:2.16.32.1.2.1", "value": "30123456" }
    ],
    "name": [
      {
        "use": "official",
        "family": "Smith",
        "given": ["John", "Michael"]
      }
    ],
    "gender": "male",
    "birthDate": "1990-01-15"
  }'
SDK
const patient = await esus.fhir.create("Patient", {
  "active": true,
  "identifier": [
    { "system": "urn:oid:2.16.32.1.2.1", "value": "30123456" }
  ],
  "name": [
    {
      "use": "official",
      "family": "Smith",
      "given": ["John", "Michael"]
}
],
"gender": "male",
"birthDate": "1990-01-15"
  });

Response:

{
  "resourceType": "Patient",
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "meta": {
    "versionId": "1",
    "lastUpdated": "2024-01-15T10:30:00Z"
  },
  "active": true,
  "identifier": [
    { "system": "urn:oid:2.16.32.1.2.1", "value": "30123456" }
  ],
  "name": [
    {
      "use": "official",
      "family": "Smith",
      "given": ["John", "Michael"]
    }
  ],
  "gender": "male",
  "birthDate": "1990-01-15"
}

The id field is a UUID (v4) generated by the server and is your identifier for all future operations on this patient. The API does not use type-prefixed ids — raw UUIDs are returned.

Reading a Patient

REST
curl -X GET https://api.esus.health/fhir/Patient/3fa85f64-5717-4562-b3fc-2c963f66afa6 \
  -H "Authorization: Bearer YOUR_TOKEN"
SDK
const { patient, etag } = await esus.fhir.read("Patient", patientId);

Common Fields

FieldDescription
telecomPhone, email contacts
addressHome/work addresses
contactEmergency contacts
communicationPreferred languages

Next Steps

Learn how to search for patients efficiently.