Upload a built site as one archive and serve it
Takes a built site live at `https://<slug>.hanzo.app` in one call.
POST /v1/projects/{slug}/deploy
| Address | https://api.hanzo.ai/v1/projects/{slug}/deploy |
| Method | POST |
| Operation | post_projects_by_slug_deploy |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Takes a built site live at https://<slug>.hanzo.app in one call. The body is the site itself — a zip or tar.gz holding index.html at its root (or a single wrapper directory that does), sent raw or as a multipart file part. It is unpacked to the site's own storage prefix and served immediately, answering the finished deployment.
It is bounded by the edge body limit (16 MiB by default), and that bound is the whole reason the other path exists: an oversized POST is refused by the server BEFORE any handler runs and surfaces as an opaque 400 Error when parsing request that reads like a malformed payload rather than a size cap. A site too large for one archive opens a deployment with POST /v1/projects/{slug}/deployments instead and writes its files straight to storage against the scoped grant that answers with — no body limit, and no bytes through this API at all.
Billing is fail-closed and fails FIRST: the hosting gate runs before anything is parsed or uploaded, so an unfunded org is 402 and an unreachable commerce is 503 with nothing written. The debit lands only on success — a failed upload is never billed and never flips the live site — and a redeploy answers the SAME URL, because slug and apex are stable.
Scope: a validated principal is required (403 without one) and the site is resolved within that principal's org, so another tenant's slug is a 404. Object storage must be configured (503); an archive that does not walk is a 400 and one over the size cap is a 413.
Request
2 fields, body application/octet-stream.
| Field | In | Type | Required | Description |
|---|---|---|---|---|
slug | path | string | yes | |
(body) | body | string (binary) | yes |
Response
| Status | Body | Meaning |
|---|---|---|
2XX | projectsDeployment | Success |
2XX body — 21 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
bucket | body | string | — | Bucket is the object-store bucket its files were written to. |
bytes | body | integer | — | Bytes is their total size in bytes. |
commit | body | string | — | Commit is the revision that was built, for a deployment that came from a repository. |
createdAt | body | integer | — | CreatedAt is when the deployment was queued, as Unix seconds. |
files | body | integer | — | Files is how many objects the deployment published. |
id | body | string | — | ID identifies this one deployment attempt, and is what CI quotes back to complete it. |
liveUrl | body | string | — | LiveURL is where this deployment serves, once it is live. |
message | body | string | — | Message is what happened, in words — the build's own note, or on a failure why it failed. |
prefix | body | string | — | Prefix is the key prefix within that bucket holding EXACTLY this deployment's objects — the unit an upload grant is scoped to, so a grant for one deployment… |
projectId | body | string | — | ProjectID is the project this deployment belongs to. |
source | body | string | — | Source is what caused the deployment — a git push, an uploaded artifact, a generated site. |
status | body | string | — | Status is where the attempt got to — queued, live, or failed. |
updatedAt | body | integer | — | UpdatedAt is when it last changed state, as Unix seconds — so the gap between the two is how long the build took. |
upload | body | projectsUploadGrant | — | |
upload.expiresAt | body | integer | — | ExpiresAt is when the grant stops being accepted, as Unix seconds. |
upload.fields | body | object | — | Fields are form values every POST must carry VERBATIM, alongside key and file. |
upload.fields.* | body | string | — | |
upload.maxBytes | body | integer | — | MaxBytes bounds ONE object, not the upload as a whole. |
upload.prefix | body | string | — | Prefix is the only place this grant can write: the deployment's own key prefix. |
upload.url | body | string | — | URL is the address to POST each object to. |
version | body | integer | — | Version counts deployments of this project from 1, so the history reads as an ordered sequence rather than by timestamp. |
Failure carries the platform error shape — see Errors.
Examples
hanzo projects deploy <slug>import { Configuration, ProjectsApi } from 'hanzoai';
const api = new ProjectsApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postProjectsBySlugDeploy({ slug: 'slug' });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import ProjectsApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = ProjectsApi(client).post_projects_by_slug_deploy(slug='slug')cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.ProjectsAPI.PostProjectsBySlugDeploy(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::apis::{configuration::Configuration, projects_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = projects_api::post_projects_by_slug_deploy(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.ProjectsApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new ProjectsApi(client).postProjectsBySlugDeploy();curl -X POST https://api.hanzo.ai/v1/projects/<slug>/deploy \
-H "Authorization: Bearer $HANZO_API_KEY"The door reaches projects through the projects tool, which names its 48 operations with its own verbs — this one among them, under a name only the door declares. describe explains any of them:
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "describe",
"arguments": {
"op": "list_projects"
}
}
}'How is this guide?