Delete Resource
CRUD Operations
Delete Resource
Remove a FHIR resource
DELETE
Delete Resource
Marks a resource as deleted. Most servers use soft delete, preserving the resource in history.
Behavior:
Endpoint
The FHIR resource type (e.g.,
Patient, Observation, Encounter)The logical ID of the resource to delete
Headers
Response style:
return=representation- Return OperationOutcomereturn=minimal(default) - No response bodyreturn=OperationOutcome- Return OperationOutcome
Query Parameters
For conditional delete. Delete the resource matching these search parameters.Example:
?identifier=http://hospital.example/mrn|12345Response
204 No Content
Resource deleted successfully. No response body.200 OK
Resource deleted successfully with OperationOutcome (when usingPrefer: return=OperationOutcome).
404 Not Found
Resource doesn’t exist (some servers return 204 for idempotency).409 Conflict
Resource cannot be deleted due to referential integrity or business rules.412 Precondition Failed
Conditional delete matched multiple resources (ambiguous).Examples
Delete Behavior
Soft Delete (Typical)
Most FHIR servers use soft delete:- Resource marked as deleted in database
- History preserved and accessible
GET /Patient/123returns410 GoneGET /Patient/123/_history/5still works (returns version 5)
Hard Delete (Rare)
Complete removal from database:- Resource and all history permanently deleted
- Cannot be recovered
- Usually restricted by policy or disabled entirely
Check Server Behavior: Review the server’s CapabilityStatement or documentation to understand its delete behavior.
Idempotent Delete
DELETE is idempotent - deleting an already-deleted resource succeeds:Conditional Delete
Delete by search criteria instead of ID:- 0 matches: No-op, returns
204 No Content - 1 match: Deletes that resource →
204 No Content - 2+ matches: Rejects as ambiguous →
412 Precondition Failed
Accessing Deleted Resources
After soft delete, use history endpoints to access deleted resources:Referential Integrity
Some servers check if other resources reference the resource being deleted: Protected Resources (common scenarios):- Patient referenced by Observations, Encounters
- Practitioner referenced by many resources
- Organization referenced by locations, departments
- Allow deletion regardless (most permissive)
- Return
409 Conflictif references exist (most cautious) - Cascade delete (rare - delete referencing resources too)
Common Use Cases
Delete Test Data
Soft Delete with Verification
Conditional Delete by Identifier
Delete with Audit Trail
Best Practices
Empty Body: DELETE requests should have an empty body per FHIR specification. Don’t send a resource in the body.
See Also
Resource History
View deleted resource versions
Search
Find resources before deleting
Update Resource
Modify instead of deleting
Learn FHIR CRUD
Understand FHIR delete semantics
Authorizations
Bearer token authentication
Path Parameters
The FHIR resource type (e.g., Patient, Observation, Encounter)
The logical ID of the resource