Swarmz

Terminate a tenant

Permanently delete a tenant and all of its infrastructure. Final and irreversible — a missing workspace is treated as idempotent success.

POSThttps://api.swarmz.net/functions/v1/platform-terminate

Final 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

StatuserrorreasonWhen
400missing_fieldstenant_id or external_ref requiredNeither identifier supplied
401unauthorizedSee Authentication
405method_not_allowedAnything other than POST
429rate_limitedper_key / per_ipRate limit hit — see Rate limits
500terminate_failedRPC messageTermination 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.

On this page