API documentation

Do from a script what you do in the dashboard. Everything here is JSON over HTTPS.

Sign in with a token

Create a token in the dashboard under Account, Security. Copy it when it is shown: it is only shown once. Send it in the Authorization header of every request. A token can do what the person who made it can do. Billing, payments and account settings are not available to tokens.

export ZARHOST_TOKEN=zh_your_token_here
curl https://www.zarhost.online/api/servers -H "Authorization: Bearer $ZARHOST_TOKEN"

Every error is JSON like { "error": "Server not found." } with a status of 400 (the request was not valid), 401 (no or wrong token), 403 (your role cannot do that) or 404 (not found).

Servers

List your servers

GET /api/servers

curl -X GET https://www.zarhost.online/api/servers \
  -H "Authorization: Bearer $ZARHOST_TOKEN"

Create a server

POST /api/servers

Plans: nano, small, medium, large, xlarge. Systems: ubuntu-24-04, ubuntu-22-04, debian-12, almalinux-9, rocky-9. Optional: app (an app id to install), scriptId (a saved startup script), keyIds (saved SSH keys), cloneOf (the id of a server of yours to copy) and snapshotId (one of its ready snapshots). Returns { id }.

curl -X POST https://www.zarhost.online/api/servers \
  -H "Authorization: Bearer $ZARHOST_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"web-01","plan":"small","region":"london","os":"ubuntu-24-04"}'

Start, stop or restart

POST /api/servers/SERVER_ID

The action is "start", "stop" or "reboot".

curl -X POST https://www.zarhost.online/api/servers/SERVER_ID \
  -H "Authorization: Bearer $ZARHOST_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"action":"stop"}'

Delete a server

DELETE /api/servers/SERVER_ID

Deletes the server and its disk. Static IPs and extra disks you attached stay with you, detached.

curl -X DELETE https://www.zarhost.online/api/servers/SERVER_ID \
  -H "Authorization: Bearer $ZARHOST_TOKEN"

Rename a server

POST /api/servers/SERVER_ID

curl -X POST https://www.zarhost.online/api/servers/SERVER_ID \
  -H "Authorization: Bearer $ZARHOST_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"action":"rename","name":"web-02"}'

Change the size

POST /api/servers/SERVER_ID

The server has to be stopped first.

curl -X POST https://www.zarhost.online/api/servers/SERVER_ID \
  -H "Authorization: Bearer $ZARHOST_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"action":"resize","plan":"medium"}'

Set tags and a note

POST /api/servers/SERVER_ID

curl -X POST https://www.zarhost.online/api/servers/SERVER_ID \
  -H "Authorization: Bearer $ZARHOST_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"action":"details","tags":"web,client-a","note":"Moves in March"}'

Static IPs

List

GET /api/ips

curl -X GET https://www.zarhost.online/api/ips \
  -H "Authorization: Bearer $ZARHOST_TOKEN"

Create

POST /api/ips

curl -X POST https://www.zarhost.online/api/ips \
  -H "Authorization: Bearer $ZARHOST_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"action":"allocate","region":"london"}'

Attach to a server

POST /api/ips

curl -X POST https://www.zarhost.online/api/ips \
  -H "Authorization: Bearer $ZARHOST_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"action":"attach","id":"IP_ID","serverId":"SERVER_ID"}'

Detach, or release

POST /api/ips

Use "release" to give an unattached address back.

curl -X POST https://www.zarhost.online/api/ips \
  -H "Authorization: Bearer $ZARHOST_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"action":"detach","id":"IP_ID"}'

Disks

List

GET /api/volumes

curl -X GET https://www.zarhost.online/api/volumes \
  -H "Authorization: Bearer $ZARHOST_TOKEN"

Create

POST /api/volumes

8 to 1000 GB.

curl -X POST https://www.zarhost.online/api/volumes \
  -H "Authorization: Bearer $ZARHOST_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"action":"create","name":"data-01","region":"london","sizeGb":50}'

Attach, detach, grow or delete

POST /api/volumes

Other actions: "detach", "grow" (with sizeGb, larger than now) and "delete" (only when detached).

curl -X POST https://www.zarhost.online/api/volumes \
  -H "Authorization: Bearer $ZARHOST_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"action":"attach","id":"DISK_ID","serverId":"SERVER_ID"}'

Snapshots

List a server's snapshots

GET /api/servers/SERVER_ID/snapshots

curl -X GET https://www.zarhost.online/api/servers/SERVER_ID/snapshots \
  -H "Authorization: Bearer $ZARHOST_TOKEN"

Take a snapshot

POST /api/servers/SERVER_ID/snapshots

curl -X POST https://www.zarhost.online/api/servers/SERVER_ID/snapshots \
  -H "Authorization: Bearer $ZARHOST_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"action":"take","name":"before-update"}'

Restore, or delete

POST /api/servers/SERVER_ID/snapshots

Restoring needs "action":"restore", the snapshot id and "confirm" set to the server's name.

curl -X POST https://www.zarhost.online/api/servers/SERVER_ID/snapshots \
  -H "Authorization: Bearer $ZARHOST_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"action":"delete","snapshot":"SNAPSHOT_ID"}'

Firewall

List open ports

GET /api/servers/SERVER_ID/firewall

curl -X GET https://www.zarhost.online/api/servers/SERVER_ID/firewall \
  -H "Authorization: Bearer $ZARHOST_TOKEN"

Open a port

POST /api/servers/SERVER_ID/firewall

"source" is "any" or an address or range like 203.0.113.0/24.

curl -X POST https://www.zarhost.online/api/servers/SERVER_ID/firewall \
  -H "Authorization: Bearer $ZARHOST_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"action":"add","proto":"tcp","from":8080,"to":8080,"source":"any"}'

Close a port

POST /api/servers/SERVER_ID/firewall

curl -X POST https://www.zarhost.online/api/servers/SERVER_ID/firewall \
  -H "Authorization: Bearer $ZARHOST_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"action":"remove","ruleId":"RULE_ID"}'

Alerts

Read and set a server's alert limits

POST /api/servers/SERVER_ID/alerts

Metrics are "cpu", "mem", "disk" (limit 50 to 99) and "down". A GET on the same path returns the rules and recent alerts.

curl -X POST https://www.zarhost.online/api/servers/SERVER_ID/alerts \
  -H "Authorization: Bearer $ZARHOST_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"action":"rule","metric":"cpu","threshold":85,"enabled":true}'

Make your first server.

Signing up takes a minute, and so does starting a server.