DocsProvisioning API

Provisioning API

Drive Zopanel for Windows from your billing system: API keys, idempotent account and plan calls, suspension, login links and the full reference.

The provisioning API lets a billing system or your own code create plans, resellers and customer accounts, suspend and terminate them, and sign customers in. The full reference, generated from the OpenAPI contract, is at /api-docs. Every panel also serves the contract at https://<panel>/api/v1/openapi.yaml without sign-in.

Status: limited. The whole account lifecycle passes automated tests with API keys only, and the WHMCS module code has driven a real panel on Windows; it has not yet run inside a live WHMCS or HostBill.

API keys

Create a key on the API keys page. Send it on every call:

Authorization: Bearer wp_xxxxxxxxxxxxxxxx
  • A key belongs to one tenant. Paths include that tenant: /api/v1/tenants/{tid}/provisioning/.... Another tenant's ID returns 404 TENANT_NOT_FOUND.
  • A key can do what you chose when you made it and what its creator's role still allows.
  • When the provider requires two-factor authentication, a key works only if it was created in a session that passed 2FA; otherwise calls return 403 API_KEY_MFA_REQUIRED.
  • HTTPS only.

The permissions a billing key needs for the whole lifecycle:

tenant.read tenant.create plan.manage member.invite
site.read site.write database.read database.write mail.read mail.write

Conventions

  • Your references. Accounts, packages and resellers are addressed by your own ref (service ID, order ID), 1–64 characters. You never store Zopanel IDs.
  • PUT is idempotent by ref: 201 the first time, 200 after, nothing duplicated.
  • Idempotency-Key on POST, PATCH, DELETE: the same key and request within 24 hours returns the first answer with Idempotent-Replayed: true.
  • Errors are JSON with a stable code, a message, a correlation_id and retryable. Retry retryable: true errors with backoff.
  • Long work returns 202 with an operation to follow (for example terminating an account with mail).
  • Rate limit: 120 requests in a burst per key, refilled at 10 per second; 429 RATE_LIMITED with Retry-After.
  • Pagination: ?limit= (1–200) and ?cursor=.

Examples

PANEL=https://panel.example.com:8443
API=$PANEL/api/v1/tenants/$TID/provisioning
H=(-H "Authorization: Bearer $KEY" -H "Content-Type: application/json")

# A package (plan)
curl "${H[@]}" -X PUT $API/packages/basic -d '{
  "name": "Basic",
  "limits": {"max_sites": 2, "max_databases": 2, "max_mailboxes": 10, "runtimes": ["php","wordpress"]}
}'

# An account on a server
curl "${H[@]}" -X PUT $API/accounts/svc-1001 -d '{
  "name": "Acme Ltd", "package": "basic", "server_id": "<server id>",
  "email": "owner@acme.example", "password": "a-long-password-12"
}'

# Suspend with a reason, unsuspend
curl "${H[@]}" -X POST $API/accounts/svc-1001/suspend -H "Idempotency-Key: sus-1001-7" -d '{"reason":"Invoice #7 unpaid"}'
curl "${H[@]}" -X POST $API/accounts/svc-1001/unsuspend -H "Idempotency-Key: uns-1001-7"

# Change plan
curl "${H[@]}" -X PUT $API/accounts/svc-1001/plan -d '{"package":"pro"}'

# Terminate (repeat the ref to confirm)
curl "${H[@]}" -X DELETE "$API/accounts/svc-1001?confirm=svc-1001" -H "Idempotency-Key: term-1001"

Downgrading to a plan the account already exceeds returns 409 PROVISIONING_PLAN_EXCEEDED and changes nothing, unless you send "allow_exceeding": true.

curl "${H[@]}" -X POST $API/accounts/svc-1001/login-link
# {"url":"https://panel…/api/v1/auth/login-link/<token>","expires_at":"…"}

The link works once, for 60 seconds. Opening it shows a "Continue" page and signing in needs a click, so link previews in mail or chat do not use it up. Redirect the customer to it at once. Owners with 2FA still enter their code.

Servers

GET $API/servers lists servers with online, maintenance, accepts_new, accounts, CPU, memory and disk. Pick one with accepts_new: true.

Resellers

PUT $API/resellers/{ref} creates a reseller with an allocation and a list of servers; suspend, unsuspend, password and login-link calls work as for accounts.

Webhooks

The Integrations page sends signed events (HMAC-SHA256 in X-Zopanel-Signature: sha256=…) for account and other changes, for example account.terminated, account.expired, quota.*, update.*. Status: limited: most event types are tested in automated tests only.

From the command line

panel-cli covers the public API from a terminal and follows long operations to their end. See Command-line tools.


← Resellers, customers and plans Migrate from Plesk →