Terminate a tenant
Permanently delete a tenant and all of its infrastructure. Final and irreversible — a missing workspace is treated as idempotent success.
https://api.swarmz.net/functions/v1/platform-terminateFinal and irreversible. Flips the tenant to terminated, deletes every project — cascading the preview pods, published workers, custom domains, and managed Supabase behind them — and then deletes the workspace row itself.
Address the tenant by tenant_id or external_ref — supply exactly one.
Parameters
Prop
Type
Request
curl -X POST https://api.swarmz.net/functions/v1/platform-terminate \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{ "external_ref": "whmcs:1234" }'const res = await fetch('https://api.swarmz.net/functions/v1/platform-terminate', {
method: 'POST',
headers: {
Authorization: 'Bearer sk_live_...',
'Content-Type': 'application/json',
},
body: JSON.stringify({ external_ref: 'whmcs:1234' }),
});
const data = await res.json();import requests
res = requests.post(
"https://api.swarmz.net/functions/v1/platform-terminate",
headers={"Authorization": "Bearer sk_live_..."},
json={"external_ref": "whmcs:1234"},
)
data = res.json()Response
A fresh termination returns the deletion report:
{
"ok": true,
"report": {
"deletedProjects": [],
"deletedPods": [],
"deletedDomains": [],
"deletedCloud": [],
"errors": []
}
}If the tenant is already terminated, or already gone, the call short-circuits:
{ "ok": true, "already": true }Errors
| Status | error | reason | When |
|---|---|---|---|
| 400 | missing_fields | tenant_id or external_ref required | Neither identifier supplied |
| 401 | unauthorized | — | See Authentication |
| 405 | method_not_allowed | — | Anything other than POST |
| 429 | rate_limited | per_key / per_ip | Rate limit hit — see Rate limits |
| 500 | terminate_failed | RPC message | Termination failed server-side; safe to retry |
Idempotency
Terminate is idempotent by state. An already-terminated or already-deleted tenant returns already: true. See Idempotency.
Notes
Terminate does not return 404
A missing workspace is treated as idempotent success (already: true), not an
error — so terminate never returns 404. After termination, other endpoints
return 404 tenant_not_found for that id, because the row is gone rather than
marked terminated. Treat 404 and 410 terminated identically: the service is
gone, do not retry. See Idempotency.
This endpoint is limited to 60 requests/min per key and 120/min per IP. See Rate limits.
Unsuspend a tenant
Reverse a suspend — flip the tenant back to active and replay its captured state, republishing projects, rebinding domains, and resuming managed cloud.
Single sign-on
Mint a short-lived redirect that lands a web-host user in their dashboard, already logged in. Send their browser to it — mint a fresh token on every click.