api.hosts

get()

api.hosts.get(id) → Promise<Host>

One host, with its current deploy, its domains and its certificate state — re-read from the platform.

GETfreere-reads the certificate
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

const host = await api.hosts.get(id);

host.current;      // the deploy currently online
host.certificate;  // "none" | "pending" | "active"
host.domains_;     // the customer domains attached
host = api.hosts.get(host_id)

host.current       # the deploy currently online
host.certificate   # "none" | "pending" | "active"
host.domains_      # the customer domains attached

This is how a pending certificate is followed

let host = await api.hosts.get(id);

while (host.certificate === "pending") {
  await new Promise((r) => setTimeout(r, 10_000));
  host = await api.hosts.get(id);
}
import time

host = api.hosts.get(host_id)

while host.certificate == "pending":
    time.sleep(10)
    host = api.hosts.get(host_id)

Nothing notifies you. The state is re-read when a host is read, which is what makes a short poll the right shape after a deploy on a fresh address level.

current is what is online

The deploy that answers now — which is not always the most recent, after a rollback. deploys() is the history.

The attached domains come with it

domains.list() reads the same thing with a request of its own, which is useful after attaching one.

Errors

An unknown identifier answers 404 — including one belonging to another account, which is the same answer on purpose.