Skip to main content
GET
System-Level Search
curl --request GET \
  --url http://localhost:8080/fhir/ \
  --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 across all resource types in the system.

Endpoint

GET /fhir/_search
POST /fhir/_search
Use GET for simple searches with query parameters, or POST for complex searches with a search body.

GET Request

Search using query parameters:
curl "https://your-server.com/fhir/_search?_count=10&_sort=-_lastUpdated"

POST Request

Search using a search body for complex queries:
POST /fhir/_search
Content-Type: application/x-www-form-urlencoded

_count=10&_sort=-_lastUpdated&_type=Patient,Observation

Search Parameters

Common Parameters

  • _count - Maximum number of results (default: 10)
  • _sort - Sort order (e.g., -_lastUpdated for descending)
  • _summary - Summary mode (true, text, data, count)
  • _total - Include total count (none, estimate, accurate)
  • _type - Filter by resource types (comma-separated)
  • _lastUpdated - Filter by last updated date

Example

GET /fhir/_search?_type=Patient,Observation&_count=20&_sort=-_lastUpdated&_lastUpdated=ge2024-01-01

Response

Success (200 OK)

Returns a Bundle containing search results:
{
  "resourceType": "Bundle",
  "type": "searchset",
  "total": 42,
  "link": [
    {
      "relation": "self",
      "url": "https://your-server.com/fhir/_search?_count=10"
    },
    {
      "relation": "next",
      "url": "https://your-server.com/fhir/_search?_count=10&_offset=10"
    }
  ],
  "entry": [
    {
      "fullUrl": "https://your-server.com/fhir/Patient/123",
      "resource": {
        "resourceType": "Patient",
        "id": "123",
        ...
      }
    }
  ]
}

Pagination

Use _offset and _count for pagination:
GET /fhir/_search?_offset=0&_count=10
GET /fhir/_search?_offset=10&_count=10
The response includes next and previous links when available.

Notes

  • System-level search can be resource-intensive
  • Use _type to limit the search to specific resource types
  • Results are sorted by relevance or the specified _sort parameter
  • The total count may be an estimate for performance reasons

Authorizations

Authorization
string
header
required

Bearer token authentication

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
_type
string

Filter by resource types (comma-separated)

_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