Batch or Transaction
Batch & Transaction
Transaction
Execute multiple operations atomically
POST
Batch or Transaction
Transaction
Execute multiple FHIR operations as a single atomic transaction. All operations succeed or all fail together.Endpoint
Request Body
The request body is aBundle with type set to transaction:
Request Methods
Each entry in the transaction can use different HTTP methods:POST- Create a new resourcePUT- Update a resource (must include full resource)PATCH- Patch a resourceDELETE- Delete a resourceGET- Read a resource
Request URL
Theurl in each request can be:
- Absolute:
Patient/123- References a specific resource - Relative:
Patient- Creates a new resource of that type - Conditional:
Patient?identifier=http://example.org/mrn|12345- Conditional operation
Response
Success (200 OK)
Returns aBundle with type set to transaction-response:
Error (400 Bad Request)
If any operation fails, the entire transaction is rolled back:Response Status Codes
Each entry’s response includes a status code:200 OK- Successful read or update201 Created- Resource created204 No Content- Successful delete400 Bad Request- Invalid request (transaction fails)404 Not Found- Resource not found (transaction fails)409 Conflict- Version conflict (transaction fails)
Conditional Operations
You can use conditional URLs in transactions:Ordering
Operations in a transaction are processed in order. Later operations can reference resources created earlier:Notes
- All operations are atomic - either all succeed or all fail
- Operations are processed sequentially
- Resources created in the transaction can be referenced by later operations
- The transaction response includes the results of all operations
- Use transactions to ensure data consistency across multiple operations
Authorizations
Bearer token authentication
Body
A container for a collection of resources
Resource type
Available options:
Bundle Indicates the purpose of this bundle
Available options:
document, message, transaction, transaction-response, batch, batch-response, history, searchset, collection If search, the total number of matches
Links related to this Bundle
Entry in the bundle
Response
Batch or transaction response
A container for a collection of resources
Resource type
Available options:
Bundle Indicates the purpose of this bundle
Available options:
document, message, transaction, transaction-response, batch, batch-response, history, searchset, collection If search, the total number of matches
Links related to this Bundle
Entry in the bundle