Skip to content

Erase a closed organisation, for good

DELETE
/staff/orgs/{orgId}
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.

orgId
required

The organisation

string
Example
org_9f3c

The organisation

Media typeapplication/json
object
reason
required

Why. Required.

string
>= 1 characters <= 500 characters
force

Purge before the clock runs out. For an erasure request that will not wait; still audited.

boolean
Examplegenerated
{
"reason": "example",
"force": true
}

Erased.

Media typeapplication/json
object
counts
required

Rows deleted, by table.

object
key
additional properties
number
usersDeleted
required
integer
ledgerErased
required
boolean
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.

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
Examplegenerated
{
"error": "example",
"code": "example"
}

A bearer that is neither the token nor a live session (code: AUTH_REQUIRED).

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
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).

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
Examplegenerated
{
"error": "example",
"code": "example"
}

No such organisation, or it is not visible to this session.

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
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).

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
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.

Media typeapplication/json
object
error
required
string
code
required
string
Allowed value: MAINTENANCE
Example
{
"code": "MAINTENANCE"
}
Retry-After
integer

Seconds until asking again is worth it (300 while the switch is on).

Report a problem with this page

sloose.com