Getting started
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:
| Field | Description | Example |
|---|---|---|
| resourceType | ”Patient”. The API takes the type from the URL and does not validate this field | Patient |
| identifier | External identifiers (national ID, medical record number) | See example below |
| name | Patient names | See example below |
| gender | Administrative gender | male, female, other, unknown |
| birthDate | Date of birth | 1990-01-15 |
Creating a Patient
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"
}'
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
curl -X GET https://api.esus.health/fhir/Patient/3fa85f64-5717-4562-b3fc-2c963f66afa6 \
-H "Authorization: Bearer YOUR_TOKEN"
const { patient, etag } = await esus.fhir.read("Patient", patientId);
Common Fields
| Field | Description |
|---|---|
| telecom | Phone, email contacts |
| address | Home/work addresses |
| contact | Emergency contacts |
| communication | Preferred languages |
Next Steps
Learn how to search for patients efficiently.