WHMCS module
Resell Swarmz from WHMCS with no code. Install the module, set your API key once, create a server, and every WHMCS service lifecycle event provisions, signs in, suspends, and tears down a tenant for you.
If you already run WHMCS, this is the fastest way to resell Swarmz. WHMCS keeps the billing and the customer relationship; the module turns each service lifecycle event — create, suspend, terminate — into a single call to the Platform API. You write no code.
Open source, MIT licensed
The module lives at github.com/swarmzlabs/whmcs-module. Download the latest release to install. Read the source, open issues, or fork it.
What you get
The download installs two modules in one step.
Provisioning module
A WHMCS server module. Attach it to a product and WHMCS drives the full tenant lifecycle — create, plan change, suspend, unsuspend, terminate — through the Platform API.
Reseller Console
An admin addon where you set your API key once and see every customer's plan and live credit + cloud usage (your wholesale cost) in one place.
Before you start
You will need:
- WHMCS 8.x or newer, on PHP 8.1+ with the
curl,json, andmbstringextensions enabled. - An active Swarmz platform account. If yours is still
draft, calls return409 account_inactive— see Onboarding. - Your API key (
sk_live_…), issued once during onboarding. See Authentication.
The key is server-to-server only
An sk_live_ key has full control of your platform account. WHMCS stores it
encrypted. Keep it on the server; never put it in client-side code or commit
it anywhere.
Install and connect
The whole setup is: drop in the files, set your key once, create one server, then point a product at it.
Upload the module
Download the ZIP from the latest release and unzip it over your WHMCS root. It writes two folders, each where WHMCS expects:
<whmcs-root>/modules/servers/swarmz/ ← provisioning module
<whmcs-root>/modules/addons/swarmz/ ← Reseller ConsoleNothing outside those two folders is touched.
Activate the Reseller Console and set your key
In WHMCS admin, go to Setup → Addon Modules, find Swarmz Reseller Console, and click Activate. Open its settings and paste your sk_live_… key into API Key. Leave API Base URL as https://api.swarmz.net.
Set the key here once
The server module automatically reuses this key whenever a server's Password field is left blank — so this is the only place you need to enter it. The console also uses it to show per-customer usage.
Add a server
Go to Setup → Products/Services → Servers → Add New Server.
| Field | Value |
|---|---|
| Name | Swarmz (anything you like) |
| Hostname | api.swarmz.net |
| Module | Swarmz |
| Username | leave blank |
| Password | leave blank — reuses the key from the console above |
| Secure (SSL) | on |
Save, then click Test Connection. A green result confirms your key is valid and the API is reachable.
Prefer a per-server key?
You can instead paste the sk_live_… key into this server's Password
field. If set, the server's own key wins over the console key. Either way
works; pick one.
Put the server in a group
Still under Servers, click Create New Group, name it (e.g. Swarmz), add the server you just made to the group, and save. Products attach to a group, not a server directly.
Create a product
Go to Setup → Products/Services → Products/Services and create a product (any type that supports a module, e.g. Other). On the Module Settings tab:
- Module Name: Swarmz
- Server Group: the group you just created
The plan's entitlement options appear below. Set them, then save. See the full option list further down.
Place a test order
Create an order for the product against a test client and accept it. WHMCS calls platform-create and the module stores the new tenant's id and dashboard URL on two service custom fields it creates automatically: Swarmz Tenant ID and Swarmz Dashboard URL. The client area now shows an Open AI Editor button.
What each WHMCS action does
Once the product is live, WHMCS lifecycle events map straight onto Platform API calls. You never invoke these yourself — WHMCS does, on what your customers trigger through billing.
| WHMCS event | Calls | Effect |
|---|---|---|
| Accept order / Create | platform-create | Provisions the tenant; stores its id + dashboard URL |
| Initial top-up (at create) | platform-topup | Grants the one-time credits you configured |
| Upgrade / Downgrade | platform-plan | Pushes the new plan's entitlements |
| Suspend | platform-suspend | Pauses compute + cloud, unpublishes sites, blocks SSO |
| Unsuspend | platform-unsuspend | Resumes compute + cloud, republishes sites |
| Terminate | platform-terminate | Permanent teardown |
| Client clicks Open AI Editor | platform-sso | Mints a fresh redirect and logs the customer in |
| Client area / Console usage | platform-usage | Reads current-period credit + cloud usage |
The module addresses each tenant by external_ref, set to whmcs:<serviceid> automatically, so you never track tenant UUIDs by hand.
Plan options
Each product carries the plan's entitlements. Set them on the product's Module Settings tab.
| Option | What it does |
|---|---|
| Credits per day | Daily AI credit budget per workspace. Empty = unlimited. |
| Monthly credit cap | Optional hard monthly ceiling. Empty = none. |
| Max projects | Project cap. 0 or empty = unlimited. |
| Max custom domains | Custom-domain cap. 0 = unlimited; a number is a hard cap. |
| Max compute size | Editor compute ceiling (nano … 4xl). |
| Cloud budget cap (USD) | Optional per-workspace cloud spend ceiling. Empty = none. |
| Initial credit top-up | One-time credits granted at provisioning. |
| Monthly credits (paid grant) | Paid credits added each billing cycle. 0 = none. |
| Credit rollover | How long unused monthly credits carry over (None / 1 / 2 months). |
| Max published projects | How many projects can be live at once. 0 = unlimited. |
| Custom domains enabled | Allow this plan to connect custom domains at all (yes/no). |
These map to the entitlements sent on every platform-create and platform-plan call.
Customer sign-in and usage
In the client area, the module adds an Open AI Editor button (rename it in the console). It calls platform-sso, mints a short-lived redirect, and drops the customer into their dashboard already logged in — a fresh token on every click, nothing cached.
The Reseller Console reads platform-usage and shows each customer's plan and live consumption in one table, so you can reconcile against your wholesale invoice. Its settings also control client-area presentation: the editor button label, what you call "credits", and whether to show AI and cloud spend to the customer. See Usage and Billing summary.
Troubleshooting
Calls return 409 account_inactive
Your platform account isn't active yet. A card on file is the gate — see
Onboarding. Until then, create and sso are blocked by
design.
- Test Connection fails with 401 — the key is wrong, rotated, or not set. Paste the current
sk_live_…key into the console's API Key (or the server's Password). See Authentication. - Nothing provisions when an order is accepted — open the product's Module Settings and confirm Module Name is Swarmz and a Server Group is selected.
- Customer can't open the editor — the tenant is likely suspended; SSO returns
409 suspendeduntil you unsuspend. - Want to see what was sent — every call is recorded under Utilities → Logs → Module Log (the API key is redacted).
Prefer to build it yourself?
Not on WHMCS, or wiring provisioning into your own panel? Every action above is a plain REST call. Start at Authentication and Create a tenant.
External references
Address every tenant by your own stable handle instead of caching a workspace UUID. The (account, external_ref) pair is also the idempotency lock on create.
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.