const site = await api.hosts.create({ runtime: "static", framework: "vite", label: "Portfolio" });
// { id, runtime: "static", framework: "vite", slug: "portfolio", url: "https://portfolio.…", status: "empty" }site = api.hosts.create(runtime="static", framework="vite", label="Portfolio")
# site.id, site.runtime == "static", site.framework == "vite", site.slug == "portfolio",
# site.url == "https://portfolio.…", site.status == "empty"runtimestringrequiredstatic or edge.
frameworkstringFor static: html, vite, react, vue, angular, astro or next-static. For edge: worker or hono.
labelstringThe name a person reads.
slugstringThe first part of the address. Derived from the label otherwise.
The slug is the address
Changing it would break links already shared, the custom domain attached to it and the certificate issued for that hostname. For another address, create another host — and update() changes the label only.
An invalid slug is refused, not fixed
A slug corrected on your behalf gives an address nobody asked for, discovered later in a link that does not work. invalid_slug says so while you are still choosing.
Reserved names
The names a platform answers for — the ones used for mail, for signing in, for billing, for administration — are not available. That is what keeps a customer from taking one; the one-level-per-kind addressing is the real protection, and this is the belt.
Errors
| Code | Status | When |
|---|---|---|
| unsupported_runtime | 400 | A runtime other than static or edge. |
| unsupported_framework | 400 | The framework is incompatible with the selected runtime. |
| invalid_slug | 400 | Not a usable slug, or a reserved name. |
| slug_taken | 409 | Someone has it. |
| hosting_limit | 403 | The plan's count is used. |
| hosting_not_in_plan | 403 | The plan has no hosting at all. |
| hosting_kind_unavailable | 501 | That kind cannot serve yet. |
It starts empty
status: "empty" and nothing online. deploy() is what puts something there.