---
name: flatpage
description: Publish HTML pages, zipped static sites and PDFs to a permanent public link on Flatpage (flatpage.page), and update them in place. Use when the user asks to publish, host, deploy, share or put online a page, website, artifact or PDF, or to update, rename or take down something they published on Flatpage.
---

# Publish with Flatpage

Flatpage turns an HTML page, a .zip of a static site or a PDF into a link like `https://spring-menu.flatpage.page`. The link stays the same when the content is updated, so anything already shared (a QR code, an email) keeps working.

## Pick the route

1. **Flatpage MCP tools available** (`publish_html`, `publish_file`, `update_site`, `list_sites`, `get_site_stats`, `rename_site`, `delete_site`): use them. Nothing else to set up.
2. **Otherwise, the REST API** at `https://flatpage.app/v1` with an API key in the `FLATPAGE_API_KEY` environment variable. If it isn't set, ask the user to create a key at https://flatpage.app/app/settings and run `export FLATPAGE_API_KEY=fpk_...` (or add it to their shell profile). Never print, log or commit the key.
3. **No shell or network** (for example plain claude.ai chat without the connector): give the user the finished HTML and point them to https://flatpage.app/app, where they can paste it, or to https://flatpage.app/use/claude-connector to add the connector.

## Before publishing

- Make the page self-contained: inline CSS and JS, images as `data:` URLs or absolute `https://` URLs. Relative links to files that aren't uploaded will be missing.
- A site with several files goes up as a .zip with `index.html` at the top level of the zip (not inside a folder).
- Make it work on a phone: `<meta name="viewport" content="width=device-width, initial-scale=1">`.
- Give it a real `<title>`; it becomes the site's name in the dashboard and in link previews.
- No phishing, credential forms imitating other brands, malware or anything the acceptable use policy (https://flatpage.app/aup) forbids. Every upload is scanned and some are held for review.

## Updating, not duplicating

When the user wants to change something already published, **update the existing site** so the link doesn't change. Find it with `list_sites` (or `GET /v1/sites`) by its link name, title or URL. Only publish a new site when the user asks for a new one.

## Link names

The part before `.flatpage.page`: 3 to 63 lowercase letters, digits and hyphens, starting and ending with a letter or digit. Suggest one from the page's purpose (`acme-proposal`, `spring-menu`). If it's taken, try a variation. Leave it out for a random name. Renaming keeps the old link redirecting for 30 days; on the Free plan a site can be renamed once every 30 days.

## REST API quick reference

All calls send `Authorization: Bearer $FLATPAGE_API_KEY`. A site can be named by its id or its link name.

```bash
API=https://flatpage.app/v1
AUTH="Authorization: Bearer $FLATPAGE_API_KEY"

# Publish an HTML file as a new site (optional link name)
curl -sS -X POST "$API/sites?linkName=spring-menu" -H "$AUTH" -H "Content-Type: text/html" --data-binary @index.html

# Publish a zipped site or a PDF (up to 25 MB this way)
curl -sS -X POST "$API/sites" -H "$AUTH" -H "Content-Type: application/zip" --data-binary @site.zip
curl -sS -X POST "$API/sites" -H "$AUTH" -H "Content-Type: application/pdf" --data-binary @menu.pdf

# Update a site in place (same link)
curl -sS -X PUT "$API/sites/spring-menu" -H "$AUTH" -H "Content-Type: text/html" --data-binary @index.html

# List sites, views for one site, rename, delete
curl -sS "$API/sites" -H "$AUTH"
curl -sS "$API/sites/spring-menu/stats" -H "$AUTH"
curl -sS -X PUT "$API/sites/spring-menu/link-name" -H "$AUTH" -H "Content-Type: application/json" -d '{"linkName":"summer-menu"}'
curl -sS -X DELETE "$API/sites/summer-menu" -H "$AUTH"
```

Publishing answers `201` with `site.url` when it's live, or `202` with `uploadId` while it's still processing: then poll `GET $API/uploads/{uploadId}` every 2 seconds for up to a minute. Errors answer with `{"error": "..."}`; show the message to the user. Files over 25 MB (PDFs on Plus) use the two-step upload in https://flatpage.app/docs/api.

## Deleting

Only delete when the user clearly asked for it, and say which link will stop working. The MCP `delete_site` tool needs `confirm` set to the site's link name.

## Limits

Each API key or connected app gets 200 calls a day. The user's plan limits apply too (number of sites, file size, uploads per day); the error message says which one was hit and the user can upgrade at https://flatpage.app/pricing.

## After publishing

Tell the user the link, suggest opening it on a phone, and mention they can see views with `get_site_stats` or in the dashboard at https://flatpage.app/app.
