Implement FHIR R4 resource versioning and use the history interaction ([base]/[Resource]/[id]/_history) to retrieve the complete version history of a clinical resource and detect changes between versions
Enable versioning on the FHIR server (if configurable) and verify support by checking the CapabilityStatement versioning field for each resource type (versioned, versioned-update, or no-version)
Retrieve the history of a specific resource via GET [base]/[ResourceType]/[id]/_history, optionally passing _since, _at, and _count parameters to filter the history bundle
Parse the returned Bundle of type history — each entry has a request element (method: PUT or DELETE) and a resource element containing the full resource at that version, with meta.versionId incrementing per change
Diff consecutive versions by comparing key clinical fields to identify what changed between versions, using the meta.lastUpdated timestamps and author information from associated Provenance resources to attribute changes
Use conditional updates with If-Match: W/[versionId] headers when writing updates to prevent lost-update conflicts in concurrent editing scenarios
Known gotchas
FHIR version history does not guarantee immutability; some server implementations allow administrators to purge history entries, and the absence of a version does not prove tampering
The _history endpoint returns versions in reverse chronological order by default on most servers, but the specification does not mandate ordering; always sort by meta.versionId or meta.lastUpdated before processing
DELETE operations appear in history as an entry with request.method=DELETE and no resource body; code that assumes every history entry contains a full resource will throw null reference errors on deleted versions
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