Close an org
const url = 'https://api.sloose.com/staff/orgs/org_9f3c/close';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"reason":"example","purgeAfterDays":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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 org 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 org 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 org back; the credentials do not come back, because revoking them was not ours to undo. What Zoho or Stripe refused comes back in warnings; the close itself always happens. Written down as org.close.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The org
Example
org_9f3cThe org
Request Bodyrequired
Section titled “Request Bodyrequired”object
Why the org is closing. Required — it goes on the record.
Days before the purge may run. Defaults to 30.
Examplegenerated
{ "reason": "example", "purgeAfterDays": 1}Responses
Section titled “Responses”Closed.
object
The earliest the purge will run.
What could not be done at Zoho or Stripe. The org is closed regardless.
Examplegenerated
{ "closedAt": "example", "purgeAfter": "example", "connectorsRevoked": 1, "subscriptionCancelled": true, "warnings": [ "example" ]}The request body 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 org, 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 org is closed already (code: ALREADY_CLOSED).
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"}