# Share a prototype from an AI chat

Quick publish puts a few static files (usually one `index.html`) live at a shareable URL in one call, with no build. It's made for prototypes built in a chat with an AI assistant: the assistant sends the files over MCP and gives you back a link.

Quick publish is being rolled out and isn't on every account yet. Until it's on for yours, calls return `501 feature_unavailable`.

## From Claude or another AI assistant

1. Connect Flatstack to the assistant as an MCP server: `https://api.flatstack.dev/mcp` ([Connecting AI tools over MCP](mcp.md)). In Claude, add it as a custom connector.
2. Build your prototype in the chat, then ask the assistant to publish it with Flatstack.
3. The assistant calls `publish_site` with your files and gives you the URL, such as `https://my-idea.flatstack.app`.

To change it, ask the assistant to publish again to the same project. Each publish is a new deploy, so you can [roll back](deploying.md#rolling-back) to any of the last 20.

## From the CLI

```bash
flatstack publish ./my-prototype --name "My idea"
```

This sends the folder as it is, with no build. Files and folders whose names start with a dot are left out. Add `--project <id|slug>` to publish a new version of an existing project. Without it, `publish` always creates a new project, even in a linked directory, so a prototype never replaces the app next to it.

## What gets published

- `index.html` is required at the top level.
- Paths are relative, such as `css/app.css` or `img/logo.png`: no leading `/`, no `..`, no file or folder name starting with a dot, and at most 200 characters.
- Allowed extensions: `html`, `css`, `js`, `mjs`, `json`, `map`, `txt`, `xml`, `webmanifest`, `svg`, `png`, `jpg`, `jpeg`, `gif`, `webp`, `avif`, `ico`, `woff`, `woff2`.
- At most 200 files and 10 MB per publish.

The site has no functions or database, so every file is served without running code and never counts towards your request limits ([how your app is served](serving.md)). When the prototype grows into an app, `flatstack deploy` to the same project replaces it like any other deploy; the project keeps its ID and URL.

## Projects and slots

Without a project ID, quick publish creates a new project, which needs a free project slot on your plan. If none is free, it returns `403 plan_limit_reached` and creates nothing.

## Search engines

Projects created by quick publish send `X-Robots-Tag: noindex` on every file, because prototypes are usually shared with a few people. The URL still works for anyone who has it. Owners and admins can turn indexing on:

```bash
flatstack projects indexing on
```

or with `PATCH /v1/projects/{id}` and `{ "searchIndexing": true }`. The change takes effect with the next deploy or publish.

## Safety

Every publish runs the [security scan](security-scan.md), so a secret-looking string in your files blocks it with `422 deploy_blocked_by_scanner`. Default security headers apply as for any site.

## API

| Request | Who | What it does |
| --- | --- | --- |
| `POST /v1/publish` | Owners, admins, personal access tokens with `projects:write` | `{ "files", "name"?, "projectId"?, "idempotencyKey"? }`. `files` maps each path to its content: a string for text, or `{ "content", "encoding": "base64" }` for images and fonts. Returns `201` with `url`, `projectId`, `created`, the `deploy` and `warnings`. |

Pass an `idempotencyKey` (8 to 100 letters, digits, `.`, `_`, `:` or `-`) when a call might be retried. A retry with the same key within 24 hours returns the first result instead of creating a second project. A publish that failed frees its key, so you can retry with it. A retry while the first call is still running returns `409 conflict`.

| Error | When |
| --- | --- |
| `400 validation_failed` | A bad path, a disallowed extension or no `index.html`; `details` names each path. |
| `413 publish_too_large` | Over 200 files or 10 MB. |
| `403 plan_limit_reached` | No free project slot for a new project. |
| `422 deploy_blocked_by_scanner` | A critical scan finding, such as a secret in a file. |
| `501 feature_unavailable` | Quick publish isn't on for your account yet. |

Deploy tokens can't publish.