Billing API
Connect your customer billing platform to VPN service changes. Use this reference with the matching dashboard and module version.
Authentication
Create the matching connection under Settings → Billing integrations. Each provider has separate credentials. Restrict the source IP and keep the token on the billing server.
Authorization: Bearer <billing-api-token> Accept: application/json Content-Type: application/json
Provider keys are whmcs, blesta, paymenter, clientexec, wisecp, fossbilling and woocommerce. A token cannot act for another provider.
Your dashboard shows its own API address. Replace vpn.yourdomain.com in the examples with that hostname.
Create or update a service
Use the same customer and service identifiers for every update. If you try the request again, reuse the same idempotency key.
curl -X POST "https://vpn.yourdomain.com/api/v1/billing/services" \
-H "Authorization: Bearer <billing-api-token>" \
-H "Idempotency-Key: order-8801-create" \
-H "Content-Type: application/json" \
--data '{
"external_client_id": "1042",
"external_service_id": "whmcs-8801",
"email": "customer@example.com",
"name": "Example Customer",
"product_id": "12",
"profile_limit": 5,
"server_access_type": "shared"
}'
Integration API
VPN Dashboard Billing API
Billing endpoints for VPN service changes from WHMCS, Blesta, Paymenter, Clientexec, WISECP, FOSSBilling and WooCommerce. Match this reference to the installed dashboard version. The earlier customer application API is retired.
Base URL
https://vpn.yourdomain.com/api/v1/billingRate limit
90 requests per minute.
Provider
Omit provider to use the token’s connection, or send its matching provider key.
Request size
Maximum 64 KiB.
Service request fields
external_client_id- Stable customer identifier; maximum 120 characters.
external_service_id- Stable service identifier within the provider connection.
email- Required when creating a new customer.
product_id- Billing product ID. A configured dashboard product mapping overrides submitted plan values.
profile_limit- Profile allowance from 1 to 10,000. Aliases and optional fields are in the JSON contract.
server_access_typesharedorprivate. Private plans can request dedicated capacity.
A successful request records the service change. Check profile task completion and dedicated capacity before treating VPN access as ready.
Endpoints
get /ping Check the billing connection
Checks the token and whether request signing or an IP allow-list is configured for mutations.
Authentication: Bearer token required
Responses
- 200
- Connection and mutation protection are ready.
- 409
- Token accepted, but mutation protection is not configured.
- 401
- Missing or invalid bearer token or request signature.
- 403
- Provider, source IP or mutation protection is not permitted.
- 429
- Rate limit exceeded. Wait before retrying.
- 422
- Validation failed, a required event key is missing or the selected product/servers are not eligible.
post /ping Check the billing connection with POST
Readiness check used by the FOSSBilling module. It does not change service state. POST requests must satisfy the same signing or source-IP protection and idempotency-key middleware as other billing POST requests. The readiness result is evaluated on every call; no service-event response is stored or replayed.
Authentication: Bearer token required
Parameters
Idempotency-Key- header · optional
Accepted as a header or body idempotency_key. Required by POST middleware unless a valid signature provides a derived fallback key. This readiness check does not store an idempotent service event. X-VPN-Dashboard-Timestamp- header · optional
Required when the connection has a webhook signing secret. Unix time within the configured tolerance, normally 300 seconds. X-VPN-Dashboard-Signature- header · optional
Required when signing is configured. sha256=<hex HMAC-SHA256 of timestamp.method.path.raw_body>. Use the uppercase HTTP method and exact request path.
Request body
{
"required": false,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/LifecycleRequest"
}
}
}
}
Responses
- 200
- Connection and mutation protection are ready.
- 401
- Missing or invalid bearer token or request signature.
- 403
- Provider, source IP or mutation protection is not permitted.
- 429
- Rate limit exceeded. Wait before retrying.
- 413
- Request body exceeds 65,536 bytes.
- 422
- Validation failed, a required event key is missing or the selected product/servers are not eligible.
post /services Create or update a VPN service
Upserts the service by provider and external_service_id. Use stable customer and service identifiers. A configured product plan for this provider is authoritative. Dedicated assignment can be pending independently of active billing status.
Authentication: Bearer token required
Parameters
Idempotency-Key- header · optional
Send a stable key for every mutation. A body idempotency_key is also accepted. Valid signed requests can derive a fallback key, but an explicit event key preserves identity across newly signed retries. X-VPN-Dashboard-Timestamp- header · optional
Required when the connection has a webhook signing secret. Unix time within the configured tolerance, normally 300 seconds. X-VPN-Dashboard-Signature- header · optional
Required when signing is configured. sha256=<hex HMAC-SHA256 of timestamp.method.path.raw_body>. Use the uppercase HTTP method and exact request path.
Request body
{
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ServiceRequest"
}
}
}
}
Responses
- 200
- Service updated.
- 401
- Missing or invalid bearer token or request signature.
- 403
- Provider, source IP or mutation protection is not permitted.
- 409
- Conflicting event identity, event still processing, service state conflict or an event requiring operator review.
- 413
- Request body exceeds 65,536 bytes.
- 422
- Validation failed, a required event key is missing or the selected product/servers are not eligible.
- 429
- Rate limit exceeded. Wait before retrying.
- 500
- Service update failed. Inspect the error and recorded event before retrying.
- 201
- Service created.
post /services/{serviceId}/suspend Suspend dashboard access and profiles
Applies the suspended service state and synchronises dashboard-generated profiles. Repeated requests use the same event key. This does not change accounts managed by a separate provisioning system.
Authentication: Bearer token required
Parameters
serviceId- path · required
The external_service_id stored for this provider’s service, such as whmcs-8801. Idempotency-Key- header · optional
Send a stable key for every mutation. A body idempotency_key is also accepted. Valid signed requests can derive a fallback key, but an explicit event key preserves identity across newly signed retries. X-VPN-Dashboard-Timestamp- header · optional
Required when the connection has a webhook signing secret. Unix time within the configured tolerance, normally 300 seconds. X-VPN-Dashboard-Signature- header · optional
Required when signing is configured. sha256=<hex HMAC-SHA256 of timestamp.method.path.raw_body>. Use the uppercase HTTP method and exact request path.
Request body
{
"required": false,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/LifecycleRequest"
}
}
}
}
Responses
- 200
- Service updated.
- 401
- Missing or invalid bearer token or request signature.
- 403
- Provider, source IP or mutation protection is not permitted.
- 409
- Conflicting event identity, event still processing, service state conflict or an event requiring operator review.
- 413
- Request body exceeds 65,536 bytes.
- 422
- Validation failed, a required event key is missing or the selected product/servers are not eligible.
- 429
- Rate limit exceeded. Wait before retrying.
- 500
- Service update failed. Inspect the error and recorded event before retrying.
- 404
- Service not found for the authenticated provider connection.
post /services/{serviceId}/unsuspend Restore dashboard access and eligible profiles
Applies the active service state and synchronises dashboard-generated profiles. Repeated requests use the same event key. This does not change accounts managed by a separate provisioning system.
Authentication: Bearer token required
Parameters
serviceId- path · required
The external_service_id stored for this provider’s service, such as whmcs-8801. Idempotency-Key- header · optional
Send a stable key for every mutation. A body idempotency_key is also accepted. Valid signed requests can derive a fallback key, but an explicit event key preserves identity across newly signed retries. X-VPN-Dashboard-Timestamp- header · optional
Required when the connection has a webhook signing secret. Unix time within the configured tolerance, normally 300 seconds. X-VPN-Dashboard-Signature- header · optional
Required when signing is configured. sha256=<hex HMAC-SHA256 of timestamp.method.path.raw_body>. Use the uppercase HTTP method and exact request path.
Request body
{
"required": false,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/LifecycleRequest"
}
}
}
}
Responses
- 200
- Service updated.
- 401
- Missing or invalid bearer token or request signature.
- 403
- Provider, source IP or mutation protection is not permitted.
- 409
- Conflicting event identity, event still processing, service state conflict or an event requiring operator review.
- 413
- Request body exceeds 65,536 bytes.
- 422
- Validation failed, a required event key is missing or the selected product/servers are not eligible.
- 429
- Rate limit exceeded. Wait before retrying.
- 500
- Service update failed. Inspect the error and recorded event before retrying.
- 404
- Service not found for the authenticated provider connection.
post /services/{serviceId}/cancel Cancel dashboard access and remove profiles
Applies the cancelled service state and synchronises dashboard-generated profiles. Repeated requests use the same event key. This does not change accounts managed by a separate provisioning system.
Authentication: Bearer token required
Parameters
serviceId- path · required
The external_service_id stored for this provider’s service, such as whmcs-8801. Idempotency-Key- header · optional
Send a stable key for every mutation. A body idempotency_key is also accepted. Valid signed requests can derive a fallback key, but an explicit event key preserves identity across newly signed retries. X-VPN-Dashboard-Timestamp- header · optional
Required when the connection has a webhook signing secret. Unix time within the configured tolerance, normally 300 seconds. X-VPN-Dashboard-Signature- header · optional
Required when signing is configured. sha256=<hex HMAC-SHA256 of timestamp.method.path.raw_body>. Use the uppercase HTTP method and exact request path.
Request body
{
"required": false,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/LifecycleRequest"
}
}
}
}
Responses
- 200
- Service updated.
- 401
- Missing or invalid bearer token or request signature.
- 403
- Provider, source IP or mutation protection is not permitted.
- 409
- Conflicting event identity, event still processing, service state conflict or an event requiring operator review.
- 413
- Request body exceeds 65,536 bytes.
- 422
- Validation failed, a required event key is missing or the selected product/servers are not eligible.
- 429
- Rate limit exceeded. Wait before retrying.
- 500
- Service update failed. Inspect the error and recorded event before retrying.
- 404
- Service not found for the authenticated provider connection.
post /services/{serviceId}/dedicated-servers Assign dedicated servers
Updates eligible dedicated server assignments for an active service. Supply server IDs or a requested count. Capacity and existing profile placement are checked before changes are accepted.
Authentication: Bearer token required
Parameters
serviceId- path · required
The external_service_id stored for this provider’s service, such as whmcs-8801. Idempotency-Key- header · optional
Send a stable key for every mutation. A body idempotency_key is also accepted. Valid signed requests can derive a fallback key, but an explicit event key preserves identity across newly signed retries. X-VPN-Dashboard-Timestamp- header · optional
Required when the connection has a webhook signing secret. Unix time within the configured tolerance, normally 300 seconds. X-VPN-Dashboard-Signature- header · optional
Required when signing is configured. sha256=<hex HMAC-SHA256 of timestamp.method.path.raw_body>. Use the uppercase HTTP method and exact request path.
Request body
{
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DedicatedServerRequest"
}
}
}
}
Responses
- 200
- Service updated.
- 401
- Missing or invalid bearer token or request signature.
- 403
- Provider, source IP or mutation protection is not permitted.
- 409
- Conflicting event identity, event still processing, service state conflict or an event requiring operator review.
- 413
- Request body exceeds 65,536 bytes.
- 422
- Validation failed, a required event key is missing or the selected product/servers are not eligible.
- 429
- Rate limit exceeded. Wait before retrying.
- 500
- Service update failed. Inspect the error and recorded event before retrying.
- 404
- Service not found for the authenticated provider connection.
Data models
ServiceRequestexternal_client_id, external_service_id
{
"type": "object",
"required": [
"external_client_id",
"external_service_id"
],
"anyOf": [
{
"required": [
"profile_limit"
]
},
{
"required": [
"profile_count"
]
},
{
"required": [
"connections"
]
},
{
"required": [
"additional_connections"
]
}
],
"properties": {
"external_client_id": {
"type": "string",
"description": "Stable customer identifier within this provider connection.",
"maxLength": 120
},
"external_service_id": {
"type": "string",
"description": "Stable service identifier within this provider connection.",
"maxLength": 120
},
"provider": {
"type": "string",
"enum": [
"whmcs",
"blesta",
"paymenter",
"clientexec",
"wisecp",
"fossbilling",
"woocommerce"
],
"description": "Provider key scoped to the authenticated billing connection. Requests may omit it; an explicit value must match the token\u2019s provider."
},
"idempotency_key": {
"type": "string",
"description": "Stable event identifier. Reuse it for a retry of the same request.",
"maxLength": 160,
"pattern": "^[A-Za-z0-9._:-]+$"
},
"email": {
"type": [
"string",
"null"
],
"format": "email",
"maxLength": 255,
"description": "Required when creating a service for a new customer."
},
"name": {
"type": [
"string",
"null"
],
"maxLength": 255
},
"product_id": {
"type": [
"string",
"null"
],
"maxLength": 120,
"description": "Billing product ID. A configured product mapping for the provider overrides the submitted plan fields."
},
"product_name": {
"type": [
"string",
"null"
],
"maxLength": 255
},
"profile_limit": {
"type": "integer",
"description": "Profile allowance. Supply this or one of its aliases.",
"minimum": 1,
"maximum": 10000
},
"profile_count": {
"type": "integer",
"description": "Alias for profile_limit.",
"minimum": 1,
"maximum": 10000
},
"connections": {
"type": "integer",
"description": "Alias for profile_limit.",
"minimum": 1,
"maximum": 10000
},
"additional_connections": {
"type": "integer",
"description": "Legacy alias: allowance is one plus this value.",
"minimum": 0,
"maximum": 9999
},
"status": {
"type": "string",
"enum": [
"active",
"suspended",
"cancelled"
]
},
"allowed_protocols": {
"type": "array",
"maxItems": 2,
"items": {
"type": "string",
"enum": [
"wireguard",
"openvpn"
]
}
},
"protocols": {
"type": "array",
"maxItems": 2,
"items": {
"type": "string",
"enum": [
"wireguard",
"openvpn"
]
},
"description": "Alias for allowed_protocols."
},
"monthly_traffic_gb": {
"type": "integer",
"description": "Optional monthly traffic allowance in GB. Omitting it preserves an existing allowance; a new service has no monthly cap unless a configured product mapping supplies one. Product mappings take precedence.",
"minimum": 1,
"maximum": 1000000
},
"traffic_gb": {
"type": "integer",
"description": "Alias for monthly_traffic_gb.",
"minimum": 1,
"maximum": 1000000
},
"profile_rotation_days": {
"type": "integer",
"description": "Optional WireGuard key rotation interval. OpenVPN credentials are not rotated by this setting; customers must import updated WireGuard configurations.",
"minimum": 1,
"maximum": 3650
},
"support_tier": {
"type": "string",
"description": "Optional support tier key.",
"maxLength": 60,
"pattern": "^[a-z0-9_-]+$"
},
"server_access_type": {
"type": "string",
"enum": [
"shared",
"private",
"dedicated",
"dedicated_server"
],
"description": "Shared or private service access; dedicated values are accepted aliases for private."
},
"plan_type": {
"type": "string",
"enum": [
"shared",
"private",
"dedicated",
"dedicated_server"
],
"description": "Alias for server_access_type."
},
"access_type": {
"type": "string",
"enum": [
"shared",
"private",
"dedicated",
"dedicated_server"
],
"description": "Alias for server_access_type."
},
"dedicated_server_id": {
"type": "integer",
"description": "One existing eligible server ID."
},
"dedicated_server_ids": {
"type": "array",
"items": {
"type": "integer"
},
"uniqueItems": true,
"maxItems": 100,
"description": "Existing server IDs eligible for this dedicated service."
},
"private_server_ids": {
"type": "array",
"items": {
"type": "integer"
},
"uniqueItems": true,
"maxItems": 100,
"description": "Alias for dedicated_server_ids."
},
"dedicated_server_count": {
"type": "integer",
"description": "Requested dedicated server count.",
"minimum": 1,
"maximum": 100
},
"allow_pending_dedicated_assignment": {
"type": "boolean",
"description": "Permit the dedicated allocation to remain pending if ready capacity is unavailable."
},
"preserve_dedicated_assignments": {
"type": "boolean",
"description": "Retain existing dedicated assignments when updating by server count."
}
},
"description": "Use a stable customer and service identity. A new customer needs an email. Product mappings can override the plan fields."
}LifecycleRequestNo required fields
{
"type": "object",
"properties": {
"provider": {
"type": "string",
"enum": [
"whmcs",
"blesta",
"paymenter",
"clientexec",
"wisecp",
"fossbilling",
"woocommerce"
],
"description": "Provider key scoped to the authenticated billing connection. Requests may omit it; an explicit value must match the token\u2019s provider."
},
"idempotency_key": {
"type": "string",
"description": "Stable event identifier. Reuse it for a retry of the same request.",
"maxLength": 160,
"pattern": "^[A-Za-z0-9._:-]+$"
}
}
}DedicatedServerRequestNo required fields
{
"type": "object",
"anyOf": [
{
"required": [
"dedicated_server_id"
]
},
{
"required": [
"dedicated_server_ids"
]
},
{
"required": [
"private_server_ids"
]
},
{
"required": [
"dedicated_server_count"
]
}
],
"properties": {
"provider": {
"type": "string",
"enum": [
"whmcs",
"blesta",
"paymenter",
"clientexec",
"wisecp",
"fossbilling",
"woocommerce"
],
"description": "Provider key scoped to the authenticated billing connection. Requests may omit it; an explicit value must match the token\u2019s provider."
},
"idempotency_key": {
"type": "string",
"description": "Stable event identifier. Reuse it for a retry of the same request.",
"maxLength": 160,
"pattern": "^[A-Za-z0-9._:-]+$"
},
"dedicated_server_id": {
"type": "integer",
"description": "One existing eligible server ID."
},
"dedicated_server_ids": {
"type": "array",
"items": {
"type": "integer"
},
"uniqueItems": true,
"maxItems": 100,
"description": "Existing server IDs eligible for this dedicated service."
},
"private_server_ids": {
"type": "array",
"items": {
"type": "integer"
},
"uniqueItems": true,
"maxItems": 100,
"description": "Alias for dedicated_server_ids."
},
"dedicated_server_count": {
"type": "integer",
"description": "Requested dedicated server count.",
"minimum": 1,
"maximum": 100
}
}
}ConnectionStatusstatus, provider, mutations_ready
{
"type": "object",
"required": [
"status",
"provider",
"mutations_ready"
],
"properties": {
"status": {
"type": "string",
"enum": [
"ok",
"configuration_error"
]
},
"provider": {
"type": "string",
"enum": [
"whmcs",
"blesta",
"paymenter",
"clientexec",
"wisecp",
"fossbilling",
"woocommerce"
],
"description": "Provider key scoped to the authenticated billing connection. Requests may omit it; an explicit value must match the token\u2019s provider."
},
"mutations_ready": {
"type": "boolean"
},
"message": {
"type": "string"
},
"customer_branding": {
"type": "object",
"additionalProperties": true
}
}
}ServiceStatusstatus
{
"type": "object",
"required": [
"status"
],
"properties": {
"status": {
"type": "string",
"enum": [
"active",
"suspended",
"cancelled"
]
}
}
}ServiceNo required fields
{
"type": "object",
"additionalProperties": true,
"description": "The stored service and its current dedicated assignment/capacity information. An accepted lifecycle request can leave asynchronous profile work outstanding.",
"properties": {
"id": {
"type": "integer"
},
"external_service_id": {
"type": "string"
},
"provider": {
"type": "string",
"enum": [
"whmcs",
"blesta",
"paymenter",
"clientexec",
"wisecp",
"fossbilling",
"woocommerce"
],
"description": "Provider key scoped to the authenticated billing connection. Requests may omit it; an explicit value must match the token\u2019s provider."
},
"status": {
"type": "string",
"enum": [
"active",
"suspended",
"cancelled"
]
},
"profile_limit": {
"type": "integer"
},
"profile_count": {
"type": "integer"
},
"server_access_type": {
"type": "string"
},
"plan_type": {
"type": "string"
},
"dedicated_server_ids": {
"type": "array",
"items": {
"type": "integer"
}
},
"dedicated_server_count": {
"type": "integer"
},
"dedicated_capacity": {
"type": "integer"
},
"dedicated_capacity_gap": {
"type": "integer"
}
}
}ErrorNo required fields
{
"type": "object",
"additionalProperties": true,
"properties": {
"message": {
"type": "string"
},
"errors": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}Signing and retries
Billing POST requests, including readiness checks, require signing or an IP allow-list. A configured webhook secret makes signing mandatory. Send a stable Idempotency-Key for every mutation.
X-VPN-Dashboard-Timestamp: <unix-timestamp> X-VPN-Dashboard-Signature: sha256=<hex-hmac> signed value = timestamp + "." + uppercase_method + "." + request_path + "." + raw_body
Use the exact body and path with the separate webhook secret. Signed requests must not contain query parameters. The default timestamp tolerance is five minutes. The example request above needs these headers when signing is configured.
Retry the same event with the same key and body. A completed event replays its response; a conflicting body returns 409. Check the recorded error before retrying a failed event.
Customer sign-in
Provisioning modules issue five-minute, single-use links to /sso/billing/{provider}. The signed customer reference resolves an existing billing account with an active service. Customer SSO cannot grant administrator access.
The separate WHMCS addon retains /sso/whmcs with service identity, product and rollout checks. Neither flow issues a local customer password or customer application token. The earlier /api/v1/vpn API remains retired.
Errors and retries
- 400
- The request could not be understood.
- 401
- The token or request signature is missing or invalid.
- 403
- The token does not have permission for the action.
- 404
- The service or assigned server was not found.
- 409
- Service-state conflict, changed idempotent request, event already processing or event requiring operator action.
- 422
- One or more request fields failed validation.
- 429
- The rate limit was reached. Retry after the response indicates.
- 5xx
- Inspect the failed event before retrying with the same identity.