Skip to content

Close an org

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 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.

orgId
required

The org

string
Example
org_9f3c

The org

Media typeapplication/json
object
reason
required

Why the org 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 at Zoho or Stripe. The org is closed regardless.

Array<string>
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.

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 org, 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 org 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"
}