Skip to main content

Delete organization

MethodPath
DELETE/v1/slim/organization/:id

Authentication · Access policies

Deletes an organization (zone) and moves its residents, rooms and devices out of it.

Auth: Bearer token. The caller must be a practitioner, an admin, a super admin, or hold the "System Owner" access policy. The access policy must grant Organization:delete and Device:update (admins and super admins skip this check). Scope: The organization must belong to the caller's project (from the token).

Behaviour​

  • The Organization resource is deleted.
  • Every patient, location and device that references the zone is re-pointed:
    • If the zone has a parent zone in your project, they move to the parent zone.
    • Otherwise their zone reference is removed.
  • Device use history is updated for any device whose assignment changes.
  • The writes run in one bundle. Because a large zone can exceed the size limit of an atomic write, this route does not take the atomic write lock. A very large zone is written as a checked batch, so a partial failure is reported as an error rather than rolled back.
  • A zone-deleted entry is added to the change history. A failure to write that entry does not fail the request.
  • The response has no body.

Example​

curl -X DELETE 'https://api.sandbox.ovok.com/v1/slim/organization/3f1c2b7e-8d4a-4c1e-9b2f-6a7d5e4c3b21' \
-H "Authorization: Bearer ${OVOK_TOKEN}"

Successful response​

200 — Organization deleted. The response has no body.

Errors​

StatusMeaning
400Medplum refuses the write.
401Bearer token is missing, invalid or expired.
403You are not a practitioner, admin or System Owner, you lack Organization:delete or Device:update, or the organization does not exist or is outside your project.
409A resource in the zone changed while the request ran. Retry.
422id is not a UUID.