Batch Upsert

Description of how to insert or update a collection of resources using our FHIR API.

PUT {base}/

The batch upsert operation allows you to update or create multiple resources in a single request. This is useful for efficiently managing large sets of data with minimal API calls. The upsert logic works as following:

  • Create: If a resource with the specified id does not exist, it will be created based on the resourceType described in the body.

  • Update: If a resource with the specified id already exists, it will be updated with the new data provided in the request.

Below is an example of how to use a PUT request to insert or update a resource. A complete list of resources can be found by visiting the resource specifications here.

Request PUT {base}/

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

Body

[
  {
    "name": [{ "given": ["Bob"] }],
    "active": true,
    "resourceType": "Patient",
    "id": "30405060"
  },
  {
    "name": [{ "given": ["Charles"] }],
    "active": false,
    "resourceType": "Patient",
    "id": "40506070"
  },
  {
    "name": [{ "given": ["Christy"] }],
    "active": false,
    "resourceType": "Patient",
    "id": "50607080"
  }
]

Response

Last updated