Create FHIR resources using conditional create to avoid duplicate submissions

domain: fhir · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Construct the resource JSON payload with all required FHIR R4 fields for the resource type (e.g., Patient, Observation, Condition).
  2. Determine a stable business identifier that uniquely identifies the resource (e.g., an external system ID stored in resource.identifier[]).
  3. Add an If-None-Exist header to the POST request: If-None-Exist: identifier=[system]|[value]; the server will create the resource only if no existing resource matches the search criteria.
  4. POST to [base]/[ResourceType] with the If-None-Exist header; a 201 Created response means the resource was newly created; a 200 OK means a match was found and no duplicate was created.
  5. Extract the Location header from a 201 response to obtain the logical ID assigned by the server; store it for subsequent updates.
  6. For updates, use PUT [base]/[ResourceType]/[id] with the full resource body; include If-Match: W/"[versionId]" to prevent lost-update conflicts.

Known gotchas

Related routes

create FHIR resources and use conditional create (If-None-Exist) to avoid duplicates
fhir · 6 steps · unrated
Perform conditional create and conditional update to avoid duplicate FHIR resources
hl7.org/fhir/R4 · 5 steps · unrated
Use conditional update (PUT with If-None-Match or search parameters) to create-or-update a FHIR resource without prior knowledge of its server id
hl7.org · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans