- The API itself: plain HTTPS and JSON. The API reference lists every endpoint.
- The
iccommand line, for your terminal and shell scripts. - The Terraform provider, to describe servers and volumes as code.
The API, the command line and the Terraform provider are in beta, and the API is turned on per project. If you can’t use it in your project, contact support.
Address
All requests go to your console address followed by/api/public/v1:
Authentication
Every request carries an API key in theAuthorization header:
GET /me tells you which project, person and key a key belongs to. It’s the quickest way to check a key works.
Requests and responses
- JSON in and out, field names in
snake_case, times in RFC 3339 (UTC). - Unknown fields in a request body are refused, so a typo can’t be silently ignored.
- Every response carries an
X-Request-Idheader. Quote it when you contact support. You can send your ownX-Request-Id(8 to 128 letters, digits,.,_,:or-) to match our logs to yours.
Errors
Every error has the same shape:code; message is for people and may change.
Long-running work
Creating, deleting and acting on a server (start, stop, reboot, park, resume) answer at once with202 Accepted and the resource in its current state. Poll GET /servers/{id} until it reaches the state you want.
A server’s status is one of:
Volumes use
creating, available, in_use, busy, deleting and error; backups use creating, available, restoring, busy, deleting and error. Treat any value you don’t recognise as “something else”, since new values may be added.
Safe retries
POST requests that create something (servers, volumes, backup restores) accept an Idempotency-Key header. Send a unique value, such as a UUID, with each new request, and the same value when you retry it:
- A retry with the same key and the same request gets the first response back, with the header
Idempotent-Replayed: true. Nothing is created twice. - The same key with a different request is refused with
invalid_argument. - A retry while the first request is still running gets
conflict; wait and retry. - Keys are kept for 24 hours.
Pages of results
Lists answer{"data": [...], "next_cursor": "..."}. Ask for up to 200 items with ?limit= (default 50). When next_cursor isn’t null, pass it as ?cursor= to get the next page.
Limits
- 10 requests a second per API key, with bursts of up to 30.
- 5 server launches a minute per project.
429 rate_limited and a Retry-After header.
Sites
Each server type runs at one site, shown assite on the type. Volumes are created at a site and attach only to servers at the same site; a backup restores at its own site. GET /server-types lists the types, and so the sites, your project can use. The server types available to you depend on your agreement.
Related
API keys
Create, scope and revoke keys.
Command line
The
ic command for your terminal.Terraform
Servers and volumes as code.
API reference
Every endpoint, request and response.