Erase a closed organisation, for good
const url = 'https://api.sloose.com/staff/orgs/org_9f3c';const options = { method: 'DELETE', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"reason":"example","force":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request DELETE \ --url https://api.sloose.com/staff/orgs/org_9f3c \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "reason": "example", "force": true }'Backoffice route: a staff session, or ADMIN_TOKEN. This cannot be undone. Deletes every row the organisation owns — runs, templates, the registry, AI transcripts, billing history, tokens, invitations, memberships — then the organisation, then anybody whose last membership it was; its ledger is emptied too. The organisation must be closed first and its purge_after clock must have run out, unless force is set, which is the answer to an erasure request that will not wait. The backoffice’s own audit survives: staff_actions rows keep what they said and carry the organisation’s id and name into their detail. Written down as org.purge.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The organisation
Example
org_9f3cThe organisation
Request Bodyrequired
Section titled “Request Bodyrequired”object
Why. Required.
Purge before the clock runs out. For an erasure request that will not wait; still audited.
Examplegenerated
{ "reason": "example", "force": true}Responses
Section titled “Responses”Erased.
object
Rows deleted, by table.
object
Examplegenerated
{ "counts": { "additionalProperty": 1 }, "usersDeleted": 1, "ledgerErased": true}The request — its body or its query — did not match the schema. issues carries the Zod issue list.
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}A bearer that is neither the token nor a live session (code: AUTH_REQUIRED).
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}A customer’s session, an API token, or no bearer at all — not staff, and not the ADMIN_TOKEN (code: ADMIN_REQUIRED).
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}No such organisation, or it is not visible to this session.
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}The organisation is not closed (code: NOT_CLOSED); its clock has not run out and force was not set (code: TOO_SOON); or it has stored files for imports and this deployment has no bucket bound to delete them from (code: STORAGE_NOT_BOUND).
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}The restore switch is on (code: MAINTENANCE): every route but /health and /robots.txt is refused before anything is read, except the operator’s own POST /staff/people/{id}/delete with the ADMIN_TOKEN. Sloose is down for maintenance. Please try again in a few minutes.
object
Example
{ "code": "MAINTENANCE"}Headers
Section titled “Headers”Seconds until asking again is worth it (300 while the switch is on).