---
title: "Api Publish"
method: POST
path: "/api/apps/{app_id}/publish"
tags: ["apps"]
---

# Api Publish

`POST /api/apps/{app_id}/publish`

## Request

- Base URL: `https://app.getdot.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://app.getdot.ai/api/apps/{app_id}/publish`
- Auth: one of:
  - API key in header `X-API-KEY`
  - API key in cookie `Authorization`
  - OAuth 2 (password, token URL `/api/auth/token`)

Publish an app from a chat session.

Single flow: promote the chat's lint artifacts into the published
namespace and atomically commit the new `.app` file to git (Phase B).
The frontend always sends `chat_id` — the Edit-click flow seeds a
chat session from the published source (via /theme's
`init_from_app_id`) so even "I just clicked Edit and tweaked a color"
goes through this single path. The legacy editor-publish path that
read from a separate `.draft` file is retired (Phase C).

## Path parameters

- `app_id` string, required

## Request body

- PublishRequest: Payload for /apps/{app_id}/publish. Every publish flows through the chat-session pathway: the frontend seeds a session from the published source on Edit-click if needed, the user's edits land in the session, and publish promotes the chat draft's lint artifacts to the published namespace. `chat_id` is required. The legacy "editor publish" path (separate `.draft` file, build-from-disk fallback) was retired — see plan `~/.claude/plans/starry-wishing-umbrella.md` Phase C. `theme` is the Style-panel's current state at publish time. The backend applies it as a last-write-wins overlay so a debounced `/theme` write that lost a race can't silently revert the user's pick (Bug V). `source_sha`, when given, is the draft version the publisher saw: a draft that changed since is refused under the draft's lock instead of published.
  - `chat_id` string, nullable
  - `theme` object, nullable
  - `source_sha` string, nullable

## Response `200`

Successful Response

- object

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/getdot/apis/dot-api-2.md) · [All operations](https://skmtc.dev/getdot/apis/dot-api-2/llms.txt) · [OpenAPI document](https://skmtc.dev/getdot/apis/dot-api-2/revisions/d26fe7163a7f?raw)
