Skip to main content
GET
/
{resourceType}
Search Resources by Type
curl --request GET \
  --url http://localhost:8080/fhir/{resourceType} \
  --header 'Authorization: Bearer <token>'
{
  "resourceType": "Bundle",
  "type": "document",
  "total": 123,
  "link": [
    {
      "relation": "<string>",
      "url": "<string>"
    }
  ],
  "entry": [
    {
      "fullUrl": "<string>",
      "resource": {
        "resourceType": "<string>",
        "id": "<string>",
        "meta": {
          "versionId": "<string>",
          "lastUpdated": "2023-11-07T05:31:56Z",
          "profile": [
            "<string>"
          ],
          "tag": [
            {
              "system": "<string>",
              "version": "<string>",
              "code": "<string>",
              "display": "<string>"
            }
          ],
          "security": [
            {
              "system": "<string>",
              "version": "<string>",
              "code": "<string>",
              "display": "<string>"
            }
          ]
        }
      },
      "request": {
        "method": "GET",
        "url": "<string>"
      },
      "response": {
        "status": "<string>",
        "location": "<string>",
        "etag": "<string>",
        "lastModified": "2023-11-07T05:31:56Z",
        "outcome": {
          "resourceType": "OperationOutcome",
          "issue": [
            {
              "severity": "fatal",
              "code": "invalid",
              "details": {
                "coding": [
                  {
                    "system": "<string>",
                    "version": "<string>",
                    "code": "<string>",
                    "display": "<string>"
                  }
                ],
                "text": "<string>"
              },
              "diagnostics": "<string>",
              "location": [
                "<string>"
              ]
            }
          ]
        }
      }
    }
  ]
}
Search for resources of a specific type using search parameters.
resource_type
string
required
The FHIR resource type to search (e.g., Patient, Observation, Encounter)

Endpoint

GET /fhir/:resource_type
GET /fhir/:resource_type/_search
POST /fhir/:resource_type/_search

GET Request

Search using query parameters:
curl "https://your-server.com/fhir/Patient?name=Doe&gender=male&_count=10"

POST Request

Use POST for complex searches or when query string length is a concern:
POST /fhir/Patient/_search
Content-Type: application/x-www-form-urlencoded

name=Doe&gender=male&_count=10

Search Parameters

Search parameters are resource-type specific. Common examples:
  • name - Search by patient name
  • identifier - Search by identifier (e.g., identifier=http://example.org/mrn|12345)
  • gender - Filter by gender (male, female, other, unknown)
  • birthdate - Filter by birth date (supports prefixes: eq, gt, lt, ge, le)
  • address - Search by address
  • telecom - Search by contact information
  • patient - Filter by patient reference
  • code - Filter by observation code
  • date - Filter by observation date
  • value-quantity - Filter by value
  • status - Filter by status

Common Parameters (All Types)

  • _id - Filter by resource ID
  • _lastUpdated - Filter by last updated date
  • _tag - Filter by tags
  • _profile - Filter by profile
  • _security - Filter by security labels
  • _count - Maximum number of results
  • _sort - Sort order
  • _summary - Summary mode
  • _total - Include total count

Examples

Search Patients by Name

GET /fhir/Patient?name=Doe

Search Patients by Identifier

GET /fhir/Patient?identifier=http://example.org/mrn|12345

Search Observations for a Patient

GET /fhir/Observation?patient=Patient/123&code=http://loinc.org|29463-7

Search with Date Range

GET /fhir/Observation?patient=Patient/123&date=ge2024-01-01&date=le2024-12-31

Search with Multiple Parameters

GET /fhir/Patient?name=Doe&gender=male&birthdate=ge1990-01-01&_count=20&_sort=-birthdate

Response

Success (200 OK)

Returns a Bundle containing matching resources:
{
  "resourceType": "Bundle",
  "type": "searchset",
  "total": 5,
  "link": [
    {
      "relation": "self",
      "url": "https://your-server.com/fhir/Patient?name=Doe"
    }
  ],
  "entry": [
    {
      "fullUrl": "https://your-server.com/fhir/Patient/123",
      "resource": {
        "resourceType": "Patient",
        "id": "123",
        "name": [{"family": "Doe", "given": ["John"]}],
        ...
      }
    }
  ]
}

No Results

Returns an empty bundle if no resources match:
{
  "resourceType": "Bundle",
  "type": "searchset",
  "total": 0,
  "entry": []
}

Modifiers

Search parameters support modifiers:
  • :exact - Exact match
  • :contains - Contains substring
  • :text - Text search
  • :above - Above in hierarchy
  • :below - Below in hierarchy
  • :not - Negation
  • :in - Value in set
  • :not-in - Value not in set

Example with Modifiers

GET /fhir/Patient?name:contains=John&birthdate:ge1990-01-01

Chaining

Chain searches through references:
GET /fhir/Observation?patient.name=Doe&patient.gender=male
This searches for observations where the patient’s name is “Doe” and gender is “male”.

Reverse Chaining

Search resources that reference a specific resource:
GET /fhir/Observation?_has:Patient:identifier=http://example.org/mrn|12345
This finds observations for patients with a specific identifier.

Notes

  • Search parameters are case-sensitive
  • Multiple values for the same parameter use AND logic
  • Different parameters use AND logic
  • Use _include and _revinclude to include related resources
  • Check the resource’s search parameters in the capability statement

Authorizations

Authorization
string
header
required

Bearer token authentication

Path Parameters

resourceType
string
required

The FHIR resource type (e.g., Patient, Observation, Encounter)

id
string
required

The logical ID of the resource

Query Parameters

_count
integer
default:10

Maximum number of results to return

Required range: x >= 0
_sort
string

Sort order (prefix with - for descending)

_summary
enum<string>

Summary mode

Available options:
true,
text,
data,
count
_total
enum<string>

Include total count

Available options:
none,
estimate,
accurate
_lastUpdated
string

Filter by last updated date

Response

Search results

A container for a collection of resources

resourceType
enum<string>
required

Resource type

Available options:
Bundle
type
enum<string>
required

Indicates the purpose of this bundle

Available options:
document,
message,
transaction,
transaction-response,
batch,
batch-response,
history,
searchset,
collection
total
integer

If search, the total number of matches

Links related to this Bundle

entry
object[]

Entry in the bundle