Execute a FHIR Bulk Data $export at the system level with _typeFilter to export only specific resource types meeting a filter criteria, then download and process the resulting NDJSON files
Send a GET or POST request to [base]/$export with the Prefer: respond-async header and query parameters including _type (comma-separated resource types) and _typeFilter (FHIR search parameter expressions per resource type)
Receive the 202 Accepted response and capture the Content-Location header, which contains the polling URL for the export job
Poll the Content-Location URL using exponential backoff until the server returns 200 OK with a manifest JSON body listing output file URLs, error file URLs, and deleted file URLs
Download each output file (NDJSON format) using an authenticated GET request and stream-process each line as an individual FHIR resource to avoid loading entire files into memory
Process the error files and deleted file arrays from the manifest to handle partial export failures and resource deletions before loading data into the target system
Known gotchas
_typeFilter syntax is server-dependent and may not be supported on all implementations; test against the target server's capability statement before relying on it in production
Export jobs can take minutes to hours for large patient populations; the polling interval should be adaptive and the client must handle 202 responses indefinitely without timing out
NDJSON files may be gzip-compressed; always check the Content-Encoding header when downloading output files and decompress before parsing
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp