Swarmz

Suspend a tenant

Reversibly pause a tenant — flip it to suspended, take its public site offline, and tear down running infrastructure. The prior state is captured for unsuspend to replay.

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

Reversibly suspends a tenant. Maps to WHMCS SuspendAccount. The order is deliberate: client_status is flipped to suspended first, so any in-flight generation or publish sees the flag and refuses immediately. Then suspendWorkspace runs the teardown — projects are unpublished (the public site goes offline), custom domains are disconnected, preview pods are paused, and managed cloud is paused. The prior state is captured on the workspace so unsuspend can replay it.

Address the tenant by tenant_id — the id returned by create — or fall back to your external_ref. Supply exactly one identifier.

Parameters

Prop

Type

Request

curl -X POST https://api.swarmz.net/functions/v1/platform-suspend \
  -H "Authorization: Bearer sk_live_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6" \
  -H "Content-Type: application/json" \
  -d '{ "tenant_id": "aa7d7fae-0386-4d8a-b977-72f856eac242" }'
const res = await fetch('https://api.swarmz.net/functions/v1/platform-suspend', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer sk_live_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ tenant_id: 'aa7d7fae-0386-4d8a-b977-72f856eac242' }),
});

const data = await res.json();
import requests

res = requests.post(
    "https://api.swarmz.net/functions/v1/platform-suspend",
    headers={"Authorization": "Bearer sk_live_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6"},
    json={"tenant_id": "aa7d7fae-0386-4d8a-b977-72f856eac242"},
)
data = res.json()

Response

A fresh suspend returns the teardown report:

{
  "ok": true,
  "status": "suspended",
  "report": {
    "pausedPods": [],
    "unpublishedProjects": [],
    "disconnectedDomains": [],
    "pausedCloud": [],
    "errors": []
  }
}

If the tenant is already suspended, the call short-circuits before any teardown:

{ "ok": true, "status": "suspended", "already": true }
FieldTypeDescription
okbooleanAlways true on success.
statusstringAlways "suspended".
alreadybooleanPresent and true only when the tenant was already suspended (no teardown ran). Absent on a fresh suspend.
reportobjectThe teardown summary. Absent when already: true.
report.pausedPodsstring[]Identifiers of preview pods that were paused.
report.unpublishedProjectsstring[]Projects whose public site was taken offline.
report.disconnectedDomainsstring[]Custom domains that were disconnected.
report.pausedCloudstring[]Managed-cloud resources that were paused.
report.errorsstring[]Per-step failures, if any (see callout below).

The status flip is authoritative even on partial teardown

Teardown collects errors and never throws. If a step fails, the tenant is still suspended (the status was flipped first) and the call still returns 200 with the failures listed in report.errors[]. Inspect that array and retry the failed steps out of band; do not treat a non-empty errors[] as a failed suspend.

Errors

StatuserrorreasonWhen
400missing_fieldstenant_id or external_ref requiredNeither identifier supplied (bearer path)
400missing_fieldsaccount_id required for internal suspendInternal-path call with no account_id
401unauthorizedmissing_bearer / invalid_key / account_disabledSee Authentication
404tenant_not_foundNo tenant matched the identifier under your account
405method_not_allowedAnything other than POST
410terminatedThe tenant has been terminated and cannot be suspended
429rate_limitedper_key / per_ipRate limit hit — see Rate limits
500suspend_failedRPC messageThe status-flip RPC (platform_set_client_status) failed; safe to retry
500internal_errorUnhandled server error; safe to retry

Idempotency

Suspend is idempotent by state. An already-suspended tenant returns already: true and is not torn down twice. There is no idempotency key — the client_status is the source of truth. See Idempotency.

Notes

Suspend is reversible

Suspend captures the tenant's prior state so unsuspend can republish projects, rebind domains, and resume cloud. For a permanent, irreversible removal, use terminate instead.

  • Address the tenant by tenant_id from create; external_ref is the fallback.
  • A suspended tenant rejects sso (409 suspended), plan (409 suspended), and topup (409 suspended) — suspend is the lever for forcing a customer out immediately.
  • The account_id parameter and X-Internal-Mint-Secret path exist for the reseller dashboard's server-to-server calls only; host integrations use the bearer key and never send account_id.

On this page