上校VPN
ColonelVPN reseller API
创造, renew and manage VPN services for your customers from your own system.

For approved resellers. The API does what the reseller panel does, paid from your reseller balance. You make your keys in the panel under 设置, API keys. Not a reseller yet? 从 reseller programme.
Basics
| Address | https://colonelvpn.com/wp-json/cvpn-reseller/v1/ |
|---|---|
| Format | JSON in, JSON out. Times are Unix seconds; expires_iso gives the same end date as text. |
| Money | Euro, without VAT. Every paid call is taken from your reseller balance at your own price level. Nothing is refunded. |
| Limit | 120 requests a minute for each key. Above that the answer is 429. |
| User-Agent | Send a User-Agent that names your own software. It must not contain the word “colonel”. |
Keys
Send your key in the header X-API-Key, or as Authorization: Bearer. A key is shown once, when you create it.
Three permissions
read only looks. sell also creates customers, adds time and makes codes. manage also stops access and changes devices and names.
Test keys
A test key checks your input and answers like the real call, with "test": true. It creates nothing and charges nothing.
Limits you set
A key can be limited to your own IP addresses or IPv4 ranges. Revoking a key in the panel stops it at once.
Never pay twice
Send external_id, your own order number, with every call that costs money, or the header Idempotency-Key. If you repeat the call with the same value, you get the first result back with "repeated": true and nothing is charged again.
Calls
| Method and path | Needs | What it does |
|---|---|---|
GET /me | 读 | Balance, currency, price level, active customers, permission and kind of the key |
GET /prices | 读 | Every period and device count on sale, with your price |
GET /locations | 读 | Locations for WireGuard files |
GET /balance/history | 读 | Balance rows, newest first. Takes limit 和 offset |
GET /services | 读 | Your customers. Takes state (active, expiring, expired, suspended), search, limit, offset |
POST /services | sell | New customer. Body: label, days, devices, optional device_name, external_id |
GET /services/{id} | 读 | One customer with devices and links. usage=1 adds the data used per device |
POST /services/{id} | manage | Change label 或者 auto_renew |
POST /services/{id}/renew | sell | Add time. Body: days, external_id |
POST /services/{id}/suspend | manage | Stop access. The end date keeps running |
POST /services/{id}/resume | manage | Restore access |
POST /services/{id}/devices | manage | 添加设备. Body: name. The answer holds its link |
DELETE /services/{id}/devices/{device} | manage | Remove a device. Its link stops working |
POST /services/{id}/devices/{device}/relink | manage | New link for a device. The old one stops working |
GET /services/{id}/devices/{device}/wireguard | 读 | One WireGuard configuration as text. Takes location |
POST /codes | sell | A batch of codes. Body: count (1 to 500), days, devices, optional note, external_id |
GET /codes | 读 | Your batches. With batch, the codes of one batch and whether each was used |
A customer in the answers
{
"id": 41,
"label": "Anna",
"status": "active",
"expires": 1798761600,
"expires_iso": "2027-01-01T00:00:00+00:00",
"device_limit": 3,
"device_count": 1,
"auto_renew": false,
"held_by_you": true,
"created": 1796169600,
"devices": [
{ "id": "aB3dE5fG7hJ9", "name": "phone", "link": "https://...", "created": 1796169600 }
]
}status is active, expired 或者 suspended. held_by_you is false for a service that sits in a customer’s own account because it was made from one of your codes; that customer manages its devices, not the API.
POST /services answers 201 with the service, the price and your new balance. If the first device could not be set up at that moment the answer also carries warning: the customer is paid for, and adding the device later costs nothing.
Errors
Every error has the same shape: { "code": "...", "message": "...", "data": { "status": 422 } }.
| HTTP | Code | Meaning |
|---|---|---|
| 401 | no_key, bad_key | No key, or a wrong or revoked key |
| 402 | funds | The balance does not cover the price. Nothing was charged |
| 403 | ip_not_allowed, not_permitted, account_closed, closed | Wrong IP address, a key without this permission, or a reseller account that cannot be used now |
| 404 | no_service, no_device | Not found, or it belongs to somebody else |
| 409 | limit, inactive, not_managed, busy | Device limit reached, service not active, service in the customer’s own account, or the balance is busy |
| 422 | input, not_on_sale | A missing or wrong field, or this period and device count has no price |
| 429 | too_many_requests | More than 120 requests in a minute |
| 503 | vpn_unreachable | The VPN service could not be reached. Nothing was lost; try again |
Example
curl -s https://colonelvpn.com/wp-json/cvpn-reseller/v1/services \
-H "X-API-Key: cvr_test_..." -H "Content-Type: application/json" -A "my-shop/1.0" \
-d '{"label":"Anna","days":30,"devices":3,"external_id":"order-1001"}'Keep keys on your server. Never put a key in a web page or in a mobile app.
Ready-made connections
You do not have to write the integration yourself. Ready-made connections for WordPress, WooCommerce, WHMCS, Blesta, HostBill (beta) and Shopify use this API with your key. See what each one does on the 经销商页面.
Good to know
- Money. Every amount is in the currency of your reseller account (EUR or USD), without VAT.
GET /me和GET /pricesname it in the fieldcurrency; read it from there. - Services that are about to end. Your software asks for them with
GET /services?state=expiring; nothing is sent to your address by itself. - Free test codes are made in the panel only.
API问题
Who can use the ColonelVPN API?
Approved resellers. The API does what the reseller panel does and is paid from the reseller balance.
How do I get an API key?
Sign in as a reseller, open Settings in the reseller panel and create a key under API keys. The key is shown once.
Can I test without spending money?
是的. A test key checks your input and answers like the real call, but creates nothing and charges nothing.
What happens if my request is sent twice?
Send your own order number as external_id, or an Idempotency-Key header. A repeated call returns the first result and is not charged again.
Is there a WooCommerce or WHMCS plugin?
是的. There are ready-made connections for WordPress, WooCommerce, WHMCS, Blesta, HostBill (beta) and Shopify. They use this same API.