Publish project
Promotes a build output into a new release AND goes live with it — create+activate in one call, which is the 99% path.
POST /v1/project/{slug}/publish
| Address | https://api.hanzo.ai/v1/project/{slug}/publish |
| Method | POST |
| Operation | post_project_by_slug_publish |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Promotes a build output into a new release AND goes live with it — create+activate in one call, which is the 99% path.
It is exactly the two halves in sequence with no extra semantics, so the
staged flow and the one-shot flow can never drift apart: source is promoted
under the same org-relative rule and the same guards CreateRelease applies,
then the site's pointer is flipped to it, the public host is claimed and the
edge is purged. Idempotent on unchanged bytes — same manifest, same release id,
no copy — and billed once, after the release exists.
Scope: a validated principal is required (401 without one) and the site is resolved within that principal's org, so another tenant's slug is a 404.
Request
3 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
slug | path | string | yes | Slug is the site to publish, from the path. |
slug | body | string | — | Slug is the site to publish, from the path. |
source | body | string | — | Source is the build output to promote, as a path RELATIVE to your org's own storage space — never a URL and never a bucket. |
Response
| Status | Body | Meaning |
|---|---|---|
200 | project.projectsRelease | ok |
default | problem-details | refused |
200 body — 8 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
active | body | boolean | — | Active is whether this is the release the site is SERVING right now. |
bytes | body | integer (int64) | — | Bytes is their total size in bytes. |
createdAt | body | integer (int64) | — | CreatedAt is when the release was cut, as Unix seconds — not when it was last activated. |
objects | body | integer (int64) | — | Objects is how many files the release holds. |
releaseId | body | string | — | ReleaseID is derived from a DIGEST of the release's own manifest, so identical content is the same release and a release can never be confused with another… |
slug | body | string | — | Slug is the site this release belongs to. |
source | body | string | — | Source is what the release was cut from — the build output or upload it was promoted out of. |
url | body | string | — | URL is where the site serves. |
Failure carries the platform error shape — see Errors.
Examples
hanzo project publish <slug>import { Configuration, ProjectApi } from 'hanzoai';
const api = new ProjectApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postProjectBySlugPublish({ slug: 'slug', slug: "<slug>", source: "<source>" });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import ProjectApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = ProjectApi(client).post_project_by_slug_publish(slug='slug', slug="<slug>", source="<source>")cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)
resp, _, err := client.ProjectAPI.PostProjectBySlugPublish(context.Background()).Execute()
if err != nil {
return err
}use hanzo_client::apis::{configuration::Configuration, project_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = project_api::post_project_by_slug_publish(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.ProjectApi;
ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));
var result = new ProjectApi(client).postProjectBySlugPublish();The method above is the one at the current release of the document. [email protected] (npm) was generated from an earlier release, where this operation carried a different id, so it spells the method differently — regenerating the clients is what makes the two agree. SDKs →
curl -X POST https://api.hanzo.ai/v1/project/<slug>/publish \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"slug": "<slug>",
"source": "<source>"
}'MCP reaches project through the projects tool, which names its 48 operations with its own verbs — this one among them, under a name only MCP 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?