vsmsconnect — API — whmcs

← all endpoints

POST/api/v1/businesses/:businessId/accounting/whmcs/connect auth: jwt (administrator) + business access + connector licence gate; 10/min rate limit (`open` bucket)

Connect a WHMCS install. The body carries the install's API credentials, so no response from this router is ever cached (`Cache-Control: no-store`). One install per business: connecting the SAME address again updates its credentials in place, a different address is refused until the existing install is disconnected. The credentials are probed against WHMCS first.

handlers: WhmcsConnectionController.connect

Inputs

namerequireddefaultdescription
businessId path
string (uuid)
yes—The caller's own business.
baseUrl body
string
yes—WHMCS install URL (1-400 chars).
apiIdentifier body
string
yes—WHMCS API credential identifier (1-200 chars).
apiSecret body
string
yes—WHMCS API credential secret (1-200 chars). Never returned.
displayName body
string
no—Optional label for the install (up to 255 chars).

Outputs

201
APIResponseDataObject<WhmcsConnectionSummary>
The new connection (no secret): `connectionId`, `baseUrl`, `displayName`, `isActive`, `locationId`, `proposalStatus`, `lastSyncedAt`, `createdAt`, `credentialsInvalid`, `connectionIssueReason`.
409
APIError
WHMCS_ALREADY_CONNECTED - the business already has a different install connected; disconnect it first.
422
APIError
Validation failed, or WHMCS_BASE_URL_INVALID.
429
APIError
Rate limit exceeded.
502
APIError
WHMCS_API_ERROR - the credential probe against the install failed.
GET/api/v1/businesses/:businessId/accounting/whmcs/status auth: jwt (administrator) + business access

Connection summary: every WHMCS install of the business (no secrets) and the business `syncFromDate`.

handlers: WhmcsConnectionController.status

Inputs

namerequireddefaultdescription
businessId path
string (uuid)
yes—The caller's own business.

Outputs

200
APIResponseDataObject<WhmcsStatusResponse>
`connected`, `provider` (`whmcs`), `connections[]` and `syncFromDate`.
POST/api/v1/businesses/:businessId/accounting/whmcs/connections/:connectionId/sync auth: jwt (administrator) + business access; 10/min rate limit (`open` bucket)

Sync now for one install: reads its invoices and persists them. A foreign or disconnected connection answers the same 404 as an unknown one. Runs in the background: replies `202 { runId }` at once and stores the outcome on the run. The finished run's `result` is the old synchronous body: `APIResponseDataObject<SyncWhmcsInvoicesResult>`.

handlers: WhmcsConnectionController.sync

Inputs

namerequireddefaultdescription
businessId path
string (uuid)
yes—The caller's own business.
connectionId path
string (uuid)
yes—WHMCS connection id (one per install).
modifiedSince query
string (YYYY-MM-DD)
no—Only read invoices changed on or after this date.
dateTo query
string (YYYY-MM-DD)
no—Only read invoices up to this date.

Outputs

202
APIResponseDataObject<BackgroundRunAcceptedDTO>
Started in the background: `{ runId }`. Poll `GET /api/v1/businesses/:businessId/background-runs/:runId`; once `status` is `done`, `result` holds the response body this endpoint used to return.
409
APIError
BACKGROUND_RUN_IN_PROGRESS — a Sync Now for this install is already running. `data` is `BackgroundRunInProgressDTO` (`runId`, `kind`, `params`, `startedAt`) of the running run.
404
APIError
WHMCS_CONNECTION_NOT_FOUND.
422
APIError
A date is not `YYYY-MM-DD`.
429
APIError
Rate limit exceeded.
POST/api/v1/businesses/:businessId/accounting/whmcs/tax-rates/sync auth: jwt (administrator) + business access; 10/min rate limit (`open` bucket)

Reads the newest invoices of every active install for the tax codes they use and offers the codes that have no mapping yet for mapping. Fans out to WHMCS, so it is rate limited like Sync now.

handlers: WhmcsConnectionController.syncTaxRates

Inputs

namerequireddefaultdescription
businessId path
string (uuid)
yes—The caller's own business.

Outputs

200
APIResponseDataObject<object>
`{ connections, invoicesRead, codesFound, proposed, unreadableConnections }`.
429
APIError
Rate limit exceeded.
GET/api/v1/businesses/:businessId/accounting/whmcs/connections/:connectionId/hook auth: jwt (administrator) + business access

The WHMCS add-on's hook URL and signing secret for one install. The secret is a credential: admin-only, scoped to the caller's business and never cached.

handlers: WhmcsConnectionController.getHook

Inputs

namerequireddefaultdescription
businessId path
string (uuid)
yes—The caller's own business.
connectionId path
string (uuid)
yes—WHMCS connection id (one per install).

Outputs

200
APIResponseDataObject<WhmcsHookConfigSummary>
`{ hookUrl, secret }`.
404
APIError
WHMCS_CONNECTION_NOT_FOUND.
PATCH/api/v1/businesses/:businessId/accounting/whmcs/connections/:connectionId/location auth: jwt (administrator) + business access

Set which VSMS Location's certificate signs this install's invoices. `null` clears it, which BLOCKS the install's invoices - it never falls back to a default.

handlers: WhmcsConnectionController.setLocation

Inputs

namerequireddefaultdescription
businessId path
string (uuid)
yes—The caller's own business.
connectionId path
string (uuid)
yes—WHMCS connection id (one per install).
locationId body
string (uuid) | null
yes—The Location to sign under, or `null` to clear.

Outputs

204
empty
Location set.
404
APIError
WHMCS_CONNECTION_NOT_FOUND, or LOCATION_NOT_FOUND.
422
APIError
Validation failed.
POST/api/v1/businesses/:businessId/accounting/whmcs/connections/:connectionId/reject auth: jwt (administrator) + business access

Reject an install that has no location: it will not be fiscalised and stops asking for attention. Refused while a location is assigned - clear it first. Idempotent when already rejected.

handlers: WhmcsConnectionController.reject

Inputs

namerequireddefaultdescription
businessId path
string (uuid)
yes—The caller's own business.
connectionId path
string (uuid)
yes—WHMCS connection id (one per install).

Outputs

204
empty
Rejected.
404
APIError
WHMCS_CONNECTION_NOT_FOUND.
409
APIError
VALIDATION_ERROR - the install still has a location; clear it first.
POST/api/v1/businesses/:businessId/accounting/whmcs/connections/:connectionId/accept auth: jwt (administrator) + business access

Take a rejected install back: clears the rejection so it asks for a location again.

handlers: WhmcsConnectionController.accept

Inputs

namerequireddefaultdescription
businessId path
string (uuid)
yes—The caller's own business.
connectionId path
string (uuid)
yes—WHMCS connection id (one per install).

Outputs

204
empty
Accepted.
404
APIError
WHMCS_CONNECTION_NOT_FOUND.
DELETE/api/v1/businesses/:businessId/accounting/whmcs/connections/:connectionId auth: jwt (administrator) + business access

Disconnect one WHMCS install, addressed by its connection id (never business-wide).

handlers: WhmcsConnectionController.disconnect

Inputs

namerequireddefaultdescription
businessId path
string (uuid)
yes—The caller's own business.
connectionId path
string (uuid)
yes—WHMCS connection id (one per install).

Outputs

200
APIResponseDataObject<{ disconnected: boolean }>
Whether the connection was disconnected.
POST/webhooks/whmcs/:connectionId auth: none - signed delivery from the WHMCS add-on (the HMAC signature is the credential); 'default' rate-limit bucket

Receives one delivery from the WHMCS PHP add-on. The signature is checked before anything is read or written, and every refusal looks the same (a bare 401). An invoice event is queued as a wake-signal; tax-rule, deleted-transaction and deleted-invoice events are handled here. A delivery that cannot be queued answers 503, so it is never silently lost. Mounted under `/webhooks`, not the API base, so the JWT check never sees it.

handlers: WhmcsHookController.handle

Inputs

namerequireddefaultdescription
connectionId path
string (uuid)
yes—WHMCS connection id the add-on was configured with.

Outputs

200
empty
Accepted.
400
empty
The body is not a delivery this install can act on (after a valid signature).
401
empty
Bare 401, no body: a malformed id, missing header, stale timestamp and wrong signature all look the same.
429
APIError
Rate limit exceeded.
503
empty
The delivery could not be queued; the add-on logs it.
GET/api/v1/accounting/whmcs/tax-mappings auth: jwt (administrator)

List all per-business WHMCS tax-code to V-SDC label mappings (`Provider='whmcs'`), active and deactivated.

handlers: WhmcsTaxMappingsController.list

Inputs

No parameters.

Outputs

200
APIResponseDataList<TaxRateMappingDTO>
Mappings.
409
APIError
BUSINESS_CONTEXT_REQUIRED.
PUT/api/v1/accounting/whmcs/tax-mappings auth: jwt (administrator)

Create or update one WHMCS tax mapping.

handlers: WhmcsTaxMappingsController.upsert

Inputs

namerequireddefaultdescription
providerTaxType body
string
yes—WHMCS tax code (1-100 chars).
providerTaxName body
string | null
no—Human-readable WHMCS tax name.
providerRate body
number | null
no—WHMCS tax rate.
vsdcTaxLabel body
string
yes—V-SDC label (1-100 chars).
vsdcRate body
number | null
no—V-SDC rate percent.

Outputs

200
APIResponseDataObject<TaxRateMappingDTO>
Upserted mapping.
409
APIError
BUSINESS_CONTEXT_REQUIRED.
422
APIError
Validation failed.
DELETE/api/v1/accounting/whmcs/tax-mappings/:providerTaxType auth: jwt (administrator)

Soft-delete (`IsActive = 0`, row retained).

handlers: WhmcsTaxMappingsController.remove

Inputs

namerequireddefaultdescription
providerTaxType path
string
yes—WHMCS tax code (the immutable key).

Outputs

204
empty
Deactivated.
409
APIError
BUSINESS_CONTEXT_REQUIRED.
PATCH/api/v1/accounting/whmcs/tax-mappings/:providerTaxType/restore auth: jwt (administrator)

Re-activate a deactivated mapping (`IsActive = 1`).

handlers: WhmcsTaxMappingsController.restore

Inputs

namerequireddefaultdescription
providerTaxType path
string
yes—WHMCS tax code (the immutable key).

Outputs

204
empty
Re-activated.
409
APIError
BUSINESS_CONTEXT_REQUIRED.