HeavenDocs

Getting started

Reads are GETs, changes are POSTs, and every response has the same shape.

One shape for every endpoint

Each resource has one endpoint, with four ways to use it:

RequestDoes
GET /v1/computer/Reads every Computer you can see, or one of them with ?computer=NAME
POST /v1/computer/createCreates one
POST /v1/computer/modifyChanges one. The body's action says how, such as "restart", "rename" or "domain add"
POST /v1/computer/deleteDeletes it

Pools, organizations and integrations work the same way. A /modify request carries exactly one action and that action's fields. A field that belongs to another action is refused (invalid).

Some Computer actions, and /v1/computer/delete, take computers to act on several Computers at once. See changing Computers.

Request
curl https://heaven.dev/v1/computer/modify \
  -H "Authorization: Bearer $HEAVEN_API_KEY" \
  --json '{"computer":"my-site","action":"rename","name":"my-shop"}'

Sending fields

Naming things

You can name anything by its name or its ID: "computer":"my-site" and "computer":"7cd4a3ec-…" are the same request. IDs never change, so use them in automation. Otherwise a rename could point a later request at something else.

Which account

You have a personal account and can belong to up to 10 organizations. A request about a Computer or pool acts in the account that owns it, so naming the Computer or pool is enough.

A request about an account itself, such as making a pool, billing, static addresses, integrations or members, takes "organization": "NAME". Without it, the request acts in your personal account. Buying capacity, charges, billing details and account deletion act in your personal account only, and take no organization.

Reads without organization return everything you can reach, in every account, and each item names its account.

Views

A GET of one Computer, of your pools or of your account returns everything about it that you can read. For a Computer, that's its access, domains, ports, mail and snapshots. Parts your key can't read are listed in withheld, and parts that couldn't be read at that moment in unavailable. The rest is still returned. To read one part instead, add view:

Request
curl 'https://heaven.dev/v1/computer/?computer=my-site&view=snapshots' \
  -H "Authorization: Bearer $HEAVEN_API_KEY"

Each endpoint's reference lists its views. Each view is its own command, so a key can be allowed some views and not others.

Responses

Success is HTTP 200 with the result in data:

200
{"version": 1, "data": {…}}

A refusal or failure has an error instead, and an HTTP status that matches the error's kind:

404
{
  "version": 1,
  "error": {
    "kind": "not_found",
    "message": "No Computer \"nope\" that you can access. Run `view` to list your Computers."
  }
}

Changes return an operation

Heaven saves a change to a Computer, such as create, start, stop, rename or a snapshot, before it responds. The change finishes on the Computer's server shortly after. The response is an operation:

200
{
  "version": 1,
  "data": {
    "request_id": "f4515dc8-125c-45d4-9000-fcb344896108",
    "operation": {
      "id": "8540e6f2-9f39-4d39-89b5-eeac80d0ac97",
      "kind": "create",
      "computer_id": "0098166a-9908-43ab-967b-4111c45c3b33",
      "revision": 1,
      "state": "accepted"
    }
  }
}

accepted means saved, not finished. Operations and retries shows how to follow it. Other changes, such as adding a domain or an SSH key, take effect at once. They return what they made, or {"updated": true}.