---
title: "Deploy exactly the version the customer last saw (the session's last commit) to production, like any other project deployment; needs a paid plan, and is refused while the files contain a secret. Returns the deployment and the address where the site will be live"
method: POST
path: "/builder/sessions/{sessionId}/publish"
tags: ["Builder"]
---

# Deploy exactly the version the customer last saw (the session's last commit) to production, like any other project deployment; needs a paid plan, and is refused while the files contain a secret. Returns the deployment and the address where the site will be live

`POST /builder/sessions/{sessionId}/publish`

## Request

- Base URL: `https://hostingsurge.com/api/v1`
- URL: `https://hostingsurge.com/api/v1/builder/sessions/{sessionId}/publish`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `__Host-hs_session`

## Path parameters

- `sessionId` string, uuid, required

## Response `201`

Deployment started

- object
  - `deployment` unknown
  - `url` string, nullable, required: Where the site will be live (the project's production address)
  - `checks` object[]: Warnings of the pre-publish checks (a blocking one refuses the publish with 409)
    - `lane` string, required
    - `id` string, required
    - `severity` 'block' | 'warn' | 'info', required
    - `message` string, required
    - `details` object

## Other responses

- `400`: Invalid request (code invalid_request)
- `401`: Missing or invalid session/token (code unauthorized)
- `402`: Publishing an AI-built site needs a paid plan (code upgrade_required, details.feature builder.publish)
- `403`: Authenticated but not permitted, or (details.reason "private_beta") the AI builder is in private beta and not open to this team yet (code forbidden)
- `404`: Not found or not visible to the caller (code not_found)
- `409`: A turn is running, or the files contain a secret such as an API key (code conflict, details.reason "secret_detected", details.findings: path, line and type, never the value), or (publish) the latest files could not be saved yet (details.reason "not_saved"); nothing was deployed or committed
- `429`: Too many requests (code rate_limited): the team started its hourly number of turns (details.reason "turn_rate") or the builder reached its capacity for the day (details.reason "daily_budget"); see Retry-After
- `501`: The AI builder is not available on this server right now (code not_configured)

---

[API](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api.md) · [All operations](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api/revisions/4d08337cdff1?raw)
