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.
| Method | Path |
|---|---|
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 value | Description |
|---|---|
:type | Type of resource to expunge. |
:id | ID of the resource to expunge. |
everything=true | For 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
| Case | Response |
|---|---|
| A single resource | 200 OK when the resource and its history have been expunged. |
Project or everything=true | 202 Accepted; the response includes a Content-Location for the asynchronous job. |
| Missing administrative permission | The 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.