Getting started
Find patients
Find a record by name, identifier, or other details.
The Esus FHIR API supports a pragmatic subset of the FHIR search specification: search parameters for the most common clinical and administrative fields, combined filters, and offset-based pagination. Advanced features such as custom search modifiers (:exact, :contains) and chained search are not supported today.
Set up the SDK server client to run the examples using esus.
Basic Search
Get all patients (paginated):
curl -X GET https://api.esus.health/fhir/Patient \
-H "Authorization: Bearer YOUR_TOKEN"
const { resources, total } = await esus.fhir.search("Patient");
Response (Bundle):
{
"resourceType": "Bundle",
"type": "searchset",
"total": 2,
"entry": [
{
"resource": {
"resourceType": "Patient",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": [{ "family": "Smith", "given": ["John"] }]
}
},
{
"resource": {
"resourceType": "Patient",
"id": "b8c2d3e4-f5a6-7890-bcde-f01234567890",
"name": [{ "family": "Johnson", "given": ["Mary"] }]
}
}
]
}
Search Parameters
By Name
# Patients with "Smith" anywhere in their name
GET /fhir/Patient?name=Smith
# Several words: all of them must match
GET /fhir/Patient?name=John%20Smith
await esus.fhir.search("Patient", { name: "Smith" });
await esus.fhir.search("Patient", { name: "John Smith" });
Names are encrypted, so search compares whole words: it ignores case but not accents, and Smi does not find Smith. given and family behave like name (they match any part of the name).
By Identifier
# By value
GET /fhir/Patient?identifier=30123456
# By system and value
GET /fhir/Patient?identifier=urn:oid:2.16.32.1.2.1|30123456
await esus.fhir.search("Patient", { identifier: "30123456" });
await esus.fhir.search("Patient", {
identifier: "urn:oid:2.16.32.1.2.1|30123456",
});
Matching is exact: 3012 does not find 30123456. The same applies to phone (only digits are compared) and email.
By Gender and Birth Date
Birth-date supports the standard FHIR date prefixes (eq, ne, gt, lt, ge, le):
# Male patients born after 1990-01-01
GET /fhir/Patient?gender=male&birthdate=gt1990-01-01
# Born in the 1990s (repeat the parameter for a range)
GET /fhir/Patient?birthdate=ge1990-01-01&birthdate=lt2000-01-01
await esus.fhir.search("Patient", { gender: "male", birthdate: "gt1990-01-01" });
await esus.fhir.search("Patient", {
birthdate: ["ge1990-01-01", "lt2000-01-01"],
});
Pagination
Pagination is offset-based. Use _count to control page size (20 by default, 100 at most) and _offset to skip results.
# First page, 20 items
GET /fhir/Patient?_count=20
# Next page (offset by one page)
GET /fhir/Patient?_count=20&_offset=20
const first = await esus.fhir.search("Patient", { _count: 20 });
const next = await first.next?.();
Response Links
The Bundle includes navigation links (self, next, and previous). These URLs keep your search filters (for example name) plus the page’s _count and _offset, so you can follow link.next until it is absent.
{
"link": [
{ "relation": "self", "url": "/fhir/Patient?_count=20&_offset=0" },
{ "relation": "next", "url": "/fhir/Patient?_count=20&_offset=20" }
]
}
Common Search Parameters
| Parameter | Description |
|---|---|
_id | Filter by resource id (UUID) |
_count | Page size (items per response) |
_offset | Items to skip (for pagination) |
name, given, family | Search by whole words of the name |
gender | Filter by administrative gender |
birthdate | Filter by date of birth, with date prefixes |
identifier | Search by external identifier (value or system|value) |
phone | Search by phone number |
email | Search by email |
telecom | Search by phone or email: matches an email (exact, case-insensitive) or a phone number (digits only) |
active | Filter by active/inactive status |
Next Steps
Next, learn how to update and delete test records.