Scenario: Delete, Purge Deleted, and Hard Delete
How to use logical delete, collection-level purge of deleted resources, and instance-level hard delete operations.
Before you begin
DDFS does not support SMART on FHIR authorization or launch workflows. Use an OAuth 2.0 access token issued by OCI Identity Domains with the DDFS resource scopes required for the request. Configure the client and token by following Create an Integrated Application and DDFS Authentication Reference.
- For a standard delete, use an access token with matching delete authority for the target FHIR resource.
- For
$hardDeleteor$purgeDeleted, use an access token with both matching delete authority and the custom hard-delete scope. See Configure Custom Hard-Delete Authorization.
Overview
This API supports three different operations to delete FHIR resources:
- Standard Delete (instance): Logically deletes a specific resource instance.
- Purge Deleted (collection): Permanently removes previously deleted resources in a collection.
- Hard Delete (instance): Permanently removes a specific deleted resource instance and returns an
OperationOutcomedescribing the result.
Standard Delete (Instance)
Use standard delete when you need to logically delete a specific resource instance.
DELETE /api/fhir/{r4|r6-ballot4}/<Resource>/{rid}
R4 Endpoints
- DELETE /api/fhir/r4/Condition/{rid} – See Delete Condition by ID.
- DELETE /api/fhir/r4/Device/{rid} – See Delete Device by ID.
- DELETE /api/fhir/r4/DiagnosticReport/{rid} – See Delete DiagnosticReport by ID.
- DELETE /api/fhir/r4/Encounter/{rid} – See Delete Encounter by ID.
- DELETE /api/fhir/r4/Endpoint/{rid} – See Delete Endpoint by ID.
- DELETE /api/fhir/r4/Group/{rid} – See Delete Group by ID.
- DELETE /api/fhir/r4/Location/{rid} – See Delete Location by ID.
- DELETE /api/fhir/r4/Observation/{rid} – See Delete Observation by ID.
- DELETE /api/fhir/r4/Organization/{rid} – See Delete Organization by ID.
- DELETE /api/fhir/r4/Patient/{rid} – See Delete Patient by ID.
- DELETE /api/fhir/r4/Practitioner/{rid} – See Delete Practitioner by ID.
- DELETE /api/fhir/r4/PractitionerRole/{rid} – See Delete PractitionerRole by ID.
- DELETE /api/fhir/r4/Provenance/{rid} – See Delete Provenance by ID.
- DELETE /api/fhir/r4/RelatedPerson/{rid} – See Delete Related Person by ID.
- DELETE /api/fhir/r4/ServiceRequest/{rid} – See Delete ServiceRequest by ID.
- DELETE /api/fhir/r4/Specimen/{rid} – See Delete Specimen by ID.
R6 Endpoints
- DELETE /api/fhir/r6-ballot4/DeviceAssociation/{rid} – See Delete DeviceAssociation by ID.
- DELETE /api/fhir/r6-ballot4/Device/{rid} – See Delete Device by ID.
- DELETE /api/fhir/r6-ballot4/Encounter/{rid} – See Delete Encounter by ID.
- DELETE /api/fhir/r6-ballot4/Location/{rid} – See Delete Location by ID.
- DELETE /api/fhir/r6-ballot4/Observation/{rid} – See Delete Observation by ID.
- DELETE /api/fhir/r6-ballot4/Patient/{rid} – See Delete Patient by ID.
- DELETE /api/fhir/r6-ballot4/Practitioner/{rid} – See Delete Practitioner by ID.
- DELETE /api/fhir/r6-ballot4/PractitionerRole/{rid} – See Delete PractitionerRole by ID.
- DELETE /api/fhir/r6-ballot4/Provenance/{rid} – See Delete Provenance by ID.
- DELETE /api/fhir/r6-ballot4/Subscription/{rid} – See Delete Subscription.
- DELETE /api/fhir/r6-ballot4/SubscriptionTopic/{rid} – See Delete SubscriptionTopic.
Purge Deleted (Collection)
Use collection purge only if defined for the resource. This operation permanently removes resources already in a standard deleted state within the specific collection.
POST /api/fhir/{r4|r6-ballot4}/<Resource>/$purgeDeleted
Server-side behavior
Send before and optional limit in a FHIR Parameters request body:
POST /api/fhir/{r4|r6-ballot4}/<Resource>/$purgeDeleted
Content-Type: application/fhir+json
{
"resourceType": "Parameters",
"parameter": [
{ "name": "before", "valueDateTime": "2026-01-01T00:00:00Z" },
{ "name": "limit", "valueInteger": 25 }
]
}
- Requires elevated authorization.
- Restricts purging to resources already in a deleted state.
- Requires
beforeas a FHIRdateTimecutoff; resources deleted before that instant are eligible for the purge. - Accepts an optional
limitinteger from 1 through 50. - Returns an
OperationOutcomedescribing the result.
R4 Endpoints
- POST /api/fhir/r4/Condition/$purgeDeleted – See Purge Deleted Condition.
- POST /api/fhir/r4/Device/$purgeDeleted – See Purge Deleted Device.
- POST /api/fhir/r4/DiagnosticReport/$purgeDeleted – See Purge Deleted DiagnosticReport.
- POST /api/fhir/r4/Encounter/$purgeDeleted – See Purge Deleted Encounter.
- POST /api/fhir/r4/Endpoint/$purgeDeleted – See Purge Deleted Endpoint.
- POST /api/fhir/r4/Group/$purgeDeleted – See Purge Deleted Group.
- POST /api/fhir/r4/Location/$purgeDeleted – See Purge Deleted Location.
- POST /api/fhir/r4/Observation/$purgeDeleted – See Purge Deleted Observation.
- POST /api/fhir/r4/Organization/$purgeDeleted – See Purge Deleted Organization.
- POST /api/fhir/r4/Patient/$purgeDeleted – See Purge Deleted Patient.
- POST /api/fhir/r4/Practitioner/$purgeDeleted – See Purge Deleted Practitioner.
- POST /api/fhir/r4/PractitionerRole/$purgeDeleted – See Purge Deleted PractitionerRole.
- POST /api/fhir/r4/Provenance/$purgeDeleted – See Purge Deleted Provenance.
- POST /api/fhir/r4/RelatedPerson/$purgeDeleted – See Purge Deleted RelatedPerson.
- POST /api/fhir/r4/ServiceRequest/$purgeDeleted – See Purge Deleted ServiceRequest.
- POST /api/fhir/r4/Specimen/$purgeDeleted – See Purge Deleted Specimen.
R6 Endpoints
- POST /api/fhir/r6-ballot4/DeviceAssociation/$purgeDeleted – See Purge Deleted DeviceAssociation.
- POST /api/fhir/r6-ballot4/Device/$purgeDeleted – See Purge Deleted Device.
- POST /api/fhir/r6-ballot4/Encounter/$purgeDeleted – See Purge Deleted Encounter.
- POST /api/fhir/r6-ballot4/Location/$purgeDeleted – See Purge Deleted Location.
- POST /api/fhir/r6-ballot4/Observation/$purgeDeleted – See Purge Deleted Observation.
- POST /api/fhir/r6-ballot4/Patient/$purgeDeleted – See Purge Deleted Patient.
- POST /api/fhir/r6-ballot4/Practitioner/$purgeDeleted – See Purge Deleted Practitioner.
- POST /api/fhir/r6-ballot4/PractitionerRole/$purgeDeleted – See Purge Deleted PractitionerRole.
- POST /api/fhir/r6-ballot4/Provenance/$purgeDeleted – See Purge Deleted Provenance.
- POST /api/fhir/r6-ballot4/Subscription/$purgeDeleted – See Purge Deleted Subscription.
- POST /api/fhir/r6-ballot4/SubscriptionTopic/$purgeDeleted – See Purge Deleted SubscriptionTopic.
Hard Delete (Instance)
Use hard delete to permanently remove a specific deleted resource instance and return an OperationOutcome describing the result. This operation is modeled as POST /{rid}/$hardDelete for supported resources.
POST /api/fhir/{r4|r6-ballot4}/<Resource>/{rid}/$hardDelete
R4 Endpoints
- POST /api/fhir/r4/Condition/{rid}/$hardDelete – See Hard Delete Condition.
- POST /api/fhir/r4/Device/{rid}/$hardDelete – See Hard Delete Device.
- POST /api/fhir/r4/DiagnosticReport/{rid}/$hardDelete – See Hard Delete DiagnosticReport.
- POST /api/fhir/r4/Encounter/{rid}/$hardDelete – See Hard Delete Encounter.
- POST /api/fhir/r4/Endpoint/{rid}/$hardDelete – See Hard Delete Endpoint.
- POST /api/fhir/r4/Group/{rid}/$hardDelete – See Hard Delete Group.
- POST /api/fhir/r4/Location/{rid}/$hardDelete – See Hard Delete Location.
- POST /api/fhir/r4/Observation/{rid}/$hardDelete – See Hard Delete Observation.
- POST /api/fhir/r4/Organization/{rid}/$hardDelete – See Hard Delete Organization.
- POST /api/fhir/r4/Patient/{rid}/$hardDelete – See Hard Delete Patient.
- POST /api/fhir/r4/Practitioner/{rid}/$hardDelete – See Hard Delete Practitioner.
- POST /api/fhir/r4/PractitionerRole/{rid}/$hardDelete – See Hard Delete PractitionerRole.
- POST /api/fhir/r4/Provenance/{rid}/$hardDelete – See Hard Delete Provenance.
- POST /api/fhir/r4/RelatedPerson/{rid}/$hardDelete – See Hard Delete RelatedPerson.
- POST /api/fhir/r4/ServiceRequest/{rid}/$hardDelete – See Hard Delete ServiceRequest.
- POST /api/fhir/r4/Specimen/{rid}/$hardDelete – See Hard Delete Specimen.
R6 Endpoints
- POST /api/fhir/r6-ballot4/DeviceAssociation/{rid}/$hardDelete – See Hard Delete DeviceAssociation.
- POST /api/fhir/r6-ballot4/Device/{rid}/$hardDelete – See Hard Delete Device.
- POST /api/fhir/r6-ballot4/Encounter/{rid}/$hardDelete – See Hard Delete Encounter.
- POST /api/fhir/r6-ballot4/Location/{rid}/$hardDelete – See Hard Delete Location.
- POST /api/fhir/r6-ballot4/Observation/{rid}/$hardDelete – See Hard Delete Observation.
- POST /api/fhir/r6-ballot4/Patient/{rid}/$hardDelete – See Hard Delete Patient.
- POST /api/fhir/r6-ballot4/Practitioner/{rid}/$hardDelete – See Hard Delete Practitioner.
- POST /api/fhir/r6-ballot4/PractitionerRole/{rid}/$hardDelete – See Hard Delete PractitionerRole.
- POST /api/fhir/r6-ballot4/Provenance/{rid}/$hardDelete – See Hard Delete Provenance.
- POST /api/fhir/r6-ballot4/Subscription/{rid}/$hardDelete – See Hard Delete Subscription.
- POST /api/fhir/r6-ballot4/SubscriptionTopic/{rid}/$hardDelete – See Hard Delete SubscriptionTopic.
Request and response
- Authentication and authorization are required. Ensure the user has privileges to perform an administrative delete.
- Requests target either the resource collection endpoint (
$purgeDeleted) or a specific resource instance{rid}with$hardDelete. - Responses return an
OperationOutcomebody describing the result.
For the complete list of endpoints, see FHIR Endpoints.
Status Codes
| Code | Meaning |
|---|---|
| 200 | The purge-deleted or hard-delete operation completed and returned an OperationOutcome. |
| 204 | The standard delete request completed successfully and the response has no body. |