REST API for hosting companies

The endpoints you need to sell servers from your own website or billing system, nothing else. Every call uses Authorization: Bearer <token> (Settings, API tokens) and returns {success, data, error}. The full reference has every other endpoint.

1. Once: read your setup

List your connections (GET /hosts), then per connection the products (GET /hosts/{id}/plans), OS templates and IP zones. Keep their ids: a create call only needs a product, an OS template and the customer.

2. A customer signs up

POST /users creates the customer account and returns a generated password once. With POST /users/{id}/login-link you send the customer straight into the customer portal from your site, without a second password. Using the panel's balance: read and book it with GET and POST /users/{id}/balance.

3. An order: create the server

POST /hosts/{id}/guests with the product (plan_id), the OS template, the root password or SSH keys and owner_id creates the server; with node=auto the panel picks the best node of that connection (GET /placement/suggest shows its choice first). The call returns a job at once: poll GET /hosts/{id}/jobs/{jobId} until it is done, then read the server with its IP from GET /hosts/{id}/guests/{type}/{vmid}.

4. While it runs

Power actions, reinstall and root password reset for your customer's buttons; usage and traffic for your client area. POST …/lock with locked=true (and an optional reason) locks a server, for example while it is unpaid: the customer still sees it but can no longer start, stop, reinstall or change it (stop it with a power action if it should not run); paying is still possible. locked=false unlocks it again. POST /users/{id}/guests moves a server to another customer.

5. Cancellation

DELETE /hosts/{id}/guests/{type}/{vmid} removes the server and frees its IP; DELETE /users/{id} removes the customer account.

Related reading