CDNShark Documentation

Customer API

← Back to Documentation

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

MethodPathAbilityDescription
GET/api/vpsvps:readYour servers: id, hostname, status (running, stopped, rebuilding, suspended…), busy, ipv4, ipv6, region, plan, vCPU, RAM, disk, OS.
GET/api/vps/{id}vps:readOne server, plus login_user, plan limits (snapshots, backups, firewall rules) and bandwidth (used, allowance, period end, throttled).
GET/api/vps/{id}/metrics?timeframe=hourvps:readTime series of CPU %, memory, network and disk rates. timeframe: hour, day, week, month.
GET/api/vps/{id}/imagesvps:readOS images this server can be rebuilt with (os_key, label).

Power and rebuild

MethodPathAbilityDescription
POST/api/vps/{id}/power/startvps:writeStart. Also /power/stop (hard stop) and /power/reboot. Returns 202.
POST/api/vps/{id}/rebuildvps:writeErases 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).

MethodPathAbilityDescription
GET/api/vps/{id}/snapshotsvps:readitems, limit, used, canAdd.
POST/api/vps/{id}/snapshotsvps:writeBody: name (starts with a letter; letters, digits, -, _; up to 40), description (optional). Returns 202.
DELETE/api/vps/{id}/snapshots/{name}vps:writeDelete a snapshot.
POST/api/vps/{id}/snapshots/{name}/rollbackvps:writeReturn 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).

MethodPathAbilityDescription
GET/api/vps/{id}/backupsvps:readitems (each with a volid), limit, used, canAdd.
POST/api/vps/{id}/backupsvps:writeStart a backup. Returns 202; it appears in the list when complete.
POST/api/vps/{id}/backups/restorevps:writeBody: volid. Replaces the server's disk with the backup. Returns 202.
DELETE/api/vps/{id}/backupsvps:writeBody: 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.

MethodPathAbilityDescription
GET/api/vps/{id}/firewallvps:readrules (each with its pos), policy (inbound default), limit, used.
POST/api/vps/{id}/firewall/rulesvps:writeAdd 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:writeRemove the rule at that position. Positions shift after a delete, so list again before removing another.
PUT/api/vps/{id}/firewall/policyvps:writeBody: 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": "..."} with 202 (started) or 201 (created).
  • 422 with a message: 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.