Swarmz

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.

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

Patches 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

StatuserrorreasonWhen
400missing_fieldstenant_id or external_ref requiredNeither identifier supplied
400missing_fieldsentitlements requiredentitlements absent or empty after sanitization
401unauthorizedSee Authentication
404tenant_not_foundNo tenant matched the identifier under your account
405method_not_allowedAnything other than POST
410terminatedThe tenant has been terminated
429rate_limitedper_key / per_ipRate limit hit — see Rate limits
500update_failedRPC messageUpdate 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.

On this page