Skip to content

Close an organisation

POST
/staff/orgs/{orgId}/close
curl --request POST \
--url https://api.sloose.com/staff/orgs/org_9f3c/close \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "reason": "example", "purgeAfterDays": 1 }'

Backoffice route: a staff session, or ADMIN_TOKEN. Takes the organisation out of service without deleting anything: every connector’s credential is revoked at its provider, the Stripe subscription is cancelled so nothing is charged again, and every session and API token bound to the organisation answers 403 ORG_CLOSED from this moment. A purge_after clock starts — 30 days by default — and until it runs out POST …/reopen puts the organisation back; the credentials do not come back, because revoking them was not ours to undo. Whatever could not be finished comes back in warnings — a credential Zoho would not revoke, a subscription Stripe would not cancel, a write or a cache of ours that failed — as plain descriptions, never exception text; the close itself always happens. Written down as org.close.

orgId
required

The organisation

string
Example
org_9f3c

The organisation

Media typeapplication/json
object
reason
required

Why the organisation is closing. Required — it goes on the record.

string
>= 1 characters <= 500 characters
purgeAfterDays

Days before the purge may run. Defaults to 30.

integer
<= 3650
Examplegenerated
{
"reason": "example",
"purgeAfterDays": 1
}

Closed.

Media typeapplication/json
object
closedAt
required
string
purgeAfter
required

The earliest the purge will run.

string
connectorsRevoked
required
integer
subscriptionCancelled
required
boolean
warnings
required

What could not be done on the way out — a credential Zoho would not revoke, a subscription Stripe would not cancel, a cached entitlement that would not clear. Plain descriptions, never exception text. The organisation is closed regardless, so this is the only place a partial offboarding is reported.

Array<string>
Examplegenerated
{
"closedAt": "example",
"purgeAfter": "example",
"connectorsRevoked": 1,
"subscriptionCancelled": true,
"warnings": [
"example"
]
}

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 closed already (code: ALREADY_CLOSED).

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