Skip to main content

Expunge a resource

$expunge permanently removes a resource and its version history. It is an administrative operation and should only be used when permanent deletion is intended. Project-wide expunges run asynchronously.

MethodPath
POST/fhir/R4/:type/:id/$expunge

Request​

Use an authorized project administrator token. This example uses a placeholder ID; confirm the target before making a real request.

curl --request POST \
--url "https://api.sandbox.ovok.com/fhir/R4/Patient/${PATIENT_ID}/\$expunge" \
--header "Authorization: Bearer ${OVOK_TOKEN}"
Path or query valueDescription
:typeType of resource to expunge.
:idID of the resource to expunge.
everything=trueFor a Project, requests asynchronous removal of its contained resources.

For a project-wide cleanup, use the Project resource and explicitly request everything=true:

curl --request POST \
--url "https://api.sandbox.ovok.com/fhir/R4/Project/${PROJECT_ID}/\$expunge?everything=true" \
--header "Authorization: Bearer ${OVOK_TOKEN}"

Response​

CaseResponse
A single resource200 OK when the resource and its history have been expunged.
Project or everything=true202 Accepted; the response includes a Content-Location for the asynchronous job.
Missing administrative permissionThe server rejects the request, commonly with 403 Forbidden.

The operation is irreversible. Use the returned job location to follow a project-wide expunge to completion.