Manage your Cloud VPS servers from scripts, CI pipelines or an AI assistant: read their status and metrics, power them on and off, reinstall them, and manage snapshots, backups and firewall rules. These are the same actions as the server page in the portal.
Needs an API token with vps:read to read, and vps:write to change anything. Write always includes Read. Servers are identified by their numeric id from GET /api/vps; a server that isn't yours returns 404.
Ordering servers, changing plans, cancelling and terminating are done in the portal, not through the API.
Machine-readable spec: OpenAPI 3.1 file for Cloud VPS and Valkey, for code generators and AI assistants.
Servers
| Method | Path | Ability | Description |
|---|---|---|---|
| GET | /api/vps | vps:read | Your servers: id, hostname, status (running, stopped, rebuilding, suspended…), busy, ipv4, ipv6, region, plan, vCPU, RAM, disk, OS. |
| GET | /api/vps/{id} | vps:read | One server, plus login_user, plan limits (snapshots, backups, firewall rules) and bandwidth (used, allowance, period end, throttled). |
| GET | /api/vps/{id}/metrics?timeframe=hour | vps:read | Time series of CPU %, memory, network and disk rates. timeframe: hour, day, week, month. |
| GET | /api/vps/{id}/images | vps:read | OS images this server can be rebuilt with (os_key, label). |
Power and rebuild
| Method | Path | Ability | Description |
|---|---|---|---|
| POST | /api/vps/{id}/power/start | vps:write | Start. Also /power/stop (hard stop) and /power/reboot. Returns 202. |
| POST | /api/vps/{id}/rebuild | vps:write | Erases the disk and reinstalls. Body: os_key, auth_method (password or key), password (optional; blank keeps the current one), ssh_pubkey (optional, OpenSSH format), and confirm set to REBUILD. Returns 202; poll GET /api/vps/{id} until status is running. Limited to 6 per hour. |
curl -X POST https://cdnshark.com/api/vps/42/rebuild \
-H "Authorization: Bearer $API_TOKEN" -H "Content-Type: application/json" \
-d '{"os_key":"debian-13","auth_method":"key","ssh_pubkey":"ssh-ed25519 AAAA... deploy@ci","confirm":"REBUILD"}'
To deploy without anyone logging in by hand, put your pipeline's SSH public key on the server (when ordering, or with a rebuild) and connect with it.
Snapshots
A snapshot saves the server's disk at a point in time, on the same storage. Use one before a risky change and roll back if it goes wrong. The number you can keep depends on your plan (limits.snapshots).
| Method | Path | Ability | Description |
|---|---|---|---|
| GET | /api/vps/{id}/snapshots | vps:read | items, limit, used, canAdd. |
| POST | /api/vps/{id}/snapshots | vps:write | Body: name (starts with a letter; letters, digits, -, _; up to 40), description (optional). Returns 202. |
| DELETE | /api/vps/{id}/snapshots/{name} | vps:write | Delete a snapshot. |
| POST | /api/vps/{id}/snapshots/{name}/rollback | vps:write | Return the server to the snapshot. Changes made since it are lost. Returns 202. |
Backups
A backup is a full copy of the server on separate backup storage. The number you can keep depends on your plan (limits.backups).
| Method | Path | Ability | Description |
|---|---|---|---|
| GET | /api/vps/{id}/backups | vps:read | items (each with a volid), limit, used, canAdd. |
| POST | /api/vps/{id}/backups | vps:write | Start a backup. Returns 202; it appears in the list when complete. |
| POST | /api/vps/{id}/backups/restore | vps:write | Body: volid. Replaces the server's disk with the backup. Returns 202. |
| DELETE | /api/vps/{id}/backups | vps:write | Body: volid. Delete a backup. |
Firewall
Every server has a fixed public IPv4 address (and IPv6 where the region has it). The firewall in front of it is managed here: a default for inbound traffic, plus rules.
| Method | Path | Ability | Description |
|---|---|---|---|
| GET | /api/vps/{id}/firewall | vps:read | rules (each with its pos), policy (inbound default), limit, used. |
| POST | /api/vps/{id}/firewall/rules | vps:write | Add a rule. Body: type (in or out), action (ACCEPT, DROP or REJECT), and optionally proto (tcp, udp, icmp), dport, sport, source, dest, comment, enable. Returns 201. |
| DELETE | /api/vps/{id}/firewall/rules/{pos} | vps:write | Remove the rule at that position. Positions shift after a delete, so list again before removing another. |
| PUT | /api/vps/{id}/firewall/policy | vps:write | Body: policy = ACCEPT (allow inbound unless a rule blocks it) or DROP (block inbound unless a rule allows it). Before switching to DROP, add a rule that keeps your own SSH access open. |
# Open HTTPS
curl -X POST https://cdnshark.com/api/vps/42/firewall/rules \
-H "Authorization: Bearer $API_TOKEN" -H "Content-Type: application/json" \
-d '{"type":"in","action":"ACCEPT","proto":"tcp","dport":"443","comment":"https"}'
Responses and errors
- Reads return
{"data": ...}. Actions return{"message": "..."}with202(started) or201(created). 422with amessage: the action can't run (the server is busy with another operation, a plan limit is reached, invalid input).503: the hypervisor couldn't be reached. Retry later.- A server that is
busy(rebuilding, restoring, rolling back) accepts no actions until it finishes.