API: keys, permissions and errors
Manage Vozora servers, firewalls, networks, volumes, DNS and object storage over HTTP with a scoped API key.
Most of what the console does to your account, the API can do as well: create and
delete servers, change firewalls, private networks and volumes, edit DNS, and manage
object storage buckets. It is at https://www.vozora.io/api/v1.
Two things stay in the console because they need a card payment in a browser: adding credit and monthly servers. The API creates hourly servers, paid from the credit you already have. So does the terminal in your browser (the server console): it is not available over the API.
Creating a key
Open Settings in the console and find API keys. Name the key, tick what it may do, choose how long it lasts, and confirm your password. We email you whenever a key is created.
The key is shown once. We keep only a fingerprint of it, so we cannot show it again: if you lose it, revoke it and make another.
A key can spend your credit and delete your servers and data, within the permissions you tick. Keep it in a secrets manager or an environment variable. Do not commit it to a repository or a Terraform file. If one leaks, revoke it in Settings; it stops working at once.
Making a request
export VOZORA_API_KEY="voz_..."
curl https://www.vozora.io/api/v1/account \
-H "Authorization: Bearer $VOZORA_API_KEY"GET /api/v1/account works with any valid key and says which account the key belongs
to, when it expires and what it may do. Use it as the first step of a script.
Send JSON bodies with Content-Type: application/json. A field the endpoint does not
know is refused, not ignored, so a misspelt field cannot be silently dropped.
Your browser session is not accepted by the API; only a key is.
Permissions
A key can do only what was ticked when it was made, and that cannot be changed afterwards: make a new key and revoke the old one.
| Permission | Allows |
|---|---|
servers:read | See servers, their backups, sizes and images |
servers:write | Create, change, stop, start and delete servers and their backups. Spends credit. |
ssh_keys:read | See saved SSH public keys |
ssh_keys:write | Save and delete SSH public keys |
firewalls:read | See firewalls and their rules |
firewalls:write | Create, change and delete firewalls and rules |
networks:read | See private networks |
networks:write | Create and delete private networks, and move servers on and off them. Spends credit. |
volumes:read | See volumes and snapshots |
volumes:write | Create, attach, snapshot and delete volumes. Spends credit. |
dns:read | See domains and their records |
dns:write | Add and delete domains and change their records |
storage:read | See object storage buckets |
storage:write | Create, change and delete buckets, including making one public |
storage_keys:read | Read the S3 access key and its secret |
storage_keys:write | Replace the S3 access key |
billing:read | See the balance, this month's usage and credit history |
Answers
Success is 200 with JSON, 201 with the new resource, or 204 with no body. Lists
come back as { "items": [...] } and are not paged: an account's resources are few
enough to return whole.
Creating a server, volume or backup returns as soon as it is under way. Read the
resource again until its state is the one you are waiting for (running for a
server).
Money is in pounds, as numbers: "hourly_price": 0.0111 is 1.11p an hour.
Errors
Every refusal has the same shape:
{ "error": { "code": "refused", "message": "Add credit before creating this server: ..." } }| Status | code | Meaning |
|---|---|---|
400 | invalid_request | The body is not valid JSON, or a field is missing, unknown or the wrong type. |
401 | unauthorized | No key, or one that is unknown, revoked or expired. |
403 | missing_scope | The key is valid but was not given the permission this needs. |
404 | not_found | Nothing with that id in your account. Other accounts' resources look the same as ones that do not exist. |
405 | method_not_allowed | The address exists but not with that method. |
422 | refused | The request is understood but cannot be done as things stand: not enough credit, a name already in use, a server that must be stopped first, object storage not available yet. The message says which. |
429 | rate_limited | More than 300 requests in a minute with one key. Wait a minute. |
502 | upstream_error | The platform did not accept the change. Read the resource before retrying: it may have taken effect. |
Messages are written for people and may be reworded. Decide on code and the status.
Sending something twice
PUT and DELETE requests say what should be true afterwards, so repeating one is
harmless. POST /servers, /volumes, /networks, /firewalls, /ssh-keys,
/buckets and /dns/zones refuse a name you already have with 422, so a retry
after a lost answer cannot create a second copy: list, and adopt the one that is there.
Machine-readable description
The OpenAPI 3.1 document is at /openapi.json, for generating a
client. Every endpoint is also listed under Endpoints.