Change a tenant's plan
Patch a tenant's entitlements and mirror its daily credit allowance. Send the full entitlements object you want — it replaces within the keys provided.
https://api.swarmz.net/functions/v1/platform-planPatches a tenant's entitlements and mirrors credits_per_day into the daily allowance used for billing. Use it to move a customer between your plans, raise a cap, or change a budget.
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-plan \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"external_ref": "whmcs:1234",
"entitlements": {
"credits_per_day": 20,
"max_projects": 10,
"max_custom_domains": 3
}
}'const res = await fetch('https://api.swarmz.net/functions/v1/platform-plan', {
method: 'POST',
headers: {
Authorization: 'Bearer sk_live_...',
'Content-Type': 'application/json',
},
body: JSON.stringify({
external_ref: 'whmcs:1234',
entitlements: { credits_per_day: 20, max_projects: 10, max_custom_domains: 3 },
}),
});
const data = await res.json();import requests
res = requests.post(
"https://api.swarmz.net/functions/v1/platform-plan",
headers={"Authorization": "Bearer sk_live_..."},
json={
"external_ref": "whmcs:1234",
"entitlements": {"credits_per_day": 20, "max_projects": 10, "max_custom_domains": 3},
},
)
data = res.json()Response
{ "ok": true }Errors
| Status | error | reason | When |
|---|---|---|---|
| 400 | missing_fields | tenant_id or external_ref required | Neither identifier supplied |
| 400 | missing_fields | entitlements required | entitlements absent or empty after sanitization |
| 401 | unauthorized | — | See Authentication |
| 404 | tenant_not_found | — | No tenant matched the identifier under your account |
| 405 | method_not_allowed | — | Anything other than POST |
| 410 | terminated | — | The tenant has been terminated |
| 429 | rate_limited | per_key / per_ip | Rate limit hit — see Rate limits |
| 500 | update_failed | RPC message | Update failed server-side; safe to retry |
Idempotency
Plan has no idempotency key. It overwrites entitlements within the keys you send, so re-sending the same request is safe and produces the same result. See Idempotency.
Notes
Send the full entitlements object
platform-plan replaces entitlements within the keys present in your request.
Send the complete object you want the tenant to have, not a single changed
field — otherwise a previously-set cap on an omitted key stays in place. See
Entitlements.
This endpoint is limited to 60 requests/min per key and 120/min per IP. See Rate limits.
Create a tenant
Provision a fully-isolated Swarmz workspace for one of your customers. Maps to WHMCS CreateAccount and is idempotent on your external reference.
Refresh a tenant's billing cycle
Rollover unused credits and reset the monthly allowance at a billing-cycle boundary. Idempotent per (tenant, cycle anchor).