<!-- Built by scripts/build-agent-docs.mjs from site/agents-src/publish.md: edit that file. -->
# Page Lemon publishing: guide for AI assistants

> For people: https://pagelemon.com/docs/publish explains this feature in plain words. This page is for AI assistants.

Putting a website online and keeping it: publish static files to a live address like `brave-otter-4821.pagelemon.dev` in seconds, with or without an account, then help the person keep it with a free account so it doesn't expire. This page is the checklist for the feature; every command (shell, MCP, errors, serving, templates) is in the long publishing guide at https://pagelemon.com/agents.

Use this when the person says "Deploy on PageLemon.com", "Make me a one-page site for my bakery and launch it on PageLemon.com", "put this online", "publish this", or when a site you built for them is ready. To build from a template ("Build with PageLemon.com: ...", "Use template pagelemon.com/tp/<Name>") follow "Build a site from a template" in https://pagelemon.com/agents, then publish.

## Plans and limits

Publishing is free. Page Lemon hosts static files only (HTML, CSS, JavaScript, images, fonts, media, documents); server code and databases don't run. Live sites, files in one site, new files a day, one whole site, storage, deploys an hour and the shortest chosen address depend on the plan (https://pagelemon.com/pricing); without an account, a small number per network. Sites on Free and without an account show the Page Lemon badge; paid plans don't. The person's own numbers: `account_read` `what=account` (`sites_used`, `sites_limit`; with `include: ["storage"]` also storage).

- **Without an account** a site stays online for 72 hours. The reply has the private `claim_url` ("Keep it free") and `site_token`; opening the link and signing in keeps the site for good. A site that isn't kept goes offline after 72 hours.
- Publishing without an account can be paused by Page Lemon (`pages_anonymous_paused` in the error): the person signs in to Page Lemon in this app first, then publish again.
- A new Free site tells search engines not to list it for its first 7 days; a paid plan or a live custom domain is listed at once. Every unkept site is not listed either. Locked pages are never listed.
- Over a limit the reply is `413 too_large` (a size) or `429 limit` (a count or a rate, with `Retry-After`; new files a day add `limit: "new_files"`, `used`, `max`): show `agent_message`, which names the number, give the pricing link when a bigger plan helps, and don't retry before the time it gives. Nothing is half-published.
- Say plan names, never ids.

## Ask the person

"Deploy on PageLemon.com" is the request: publish without asking more than this, in one message at most:

1. **Where the site is.** In this chat, a folder on their computer, a zip, or a single `index.html`. If you can't publish (a chat app without the connector), say once that they can connect at https://pagelemon.com/docs/connect. If they can't or would rather not (ChatGPT's free plan, for example), don't ask them to save or upload files: put the whole site in ONE complete page (CSS and JavaScript inline, images as https links or small data URIs), show it as one code block and tell them: "Tap Copy on the code, open pagelemon.com/publish, tap Paste and publish." Only if you can really offer a downloadable .zip: "Download this zip, open pagelemon.com/publish, tap Drop or choose a file."
2. **Keep it?** After publishing, offer to keep the site (a free account, under a minute). Don't make it a question before.
3. **The address.** A new site gets a random name. If they said "with my name", rename it to their first name (or full name) in lowercase with hyphens (`maria-lopez`) once the site is in their account: the Workspace Owner approves from `approval.url`. Too short or taken: offer a close variant (`mariabakes`) and ask before using it.
4. **Which workspace,** when they have more than one: every site belongs to a workspace. Ask which one, and say where the site went from the reply to the publish.
5. **Anything they don't want public.** Everything published is public unless a passcode or invite-only is added (https://pagelemon.com/agents/protect). Bookings need a paid plan: say so before building them in.

## What the person needs ready

- **Nothing, for a first publish.** The site is whatever you built or the files they have. From a coding tool (Claude Code, Codex...) you publish with no account. From a chat app, a one-time connection takes about two minutes: https://pagelemon.com/docs/connect has the steps for Claude, ChatGPT and other apps.
- **To keep the site:** a Google account or an email address they can open. They find the link in your reply: the "Keep it free" link (`claim_url`), private to them. Anyone who has the link can take the site, so don't post it anywhere.
- **For an address with their name:** the name they want (letters, digits and single hyphens; the shortest allowed is in the table above).
- **If the site is in a project folder with a build step:** tell them nothing, but publish the build folder (`dist/`, `build/`, `out/`), never the project root, and never source files, `.env` files or keys.

## Set it up

MCP: `site_publish` with every file (`index.html` at the root). REST and shell: `POST https://api.pagelemon.com/v2/anonymous-sites` with `{files: [{path, content_base64}]}` (the full command is in https://pagelemon.com/agents).

```json
{"files": [{"path": "index.html", "content_base64": "PCFkb2N0eXBlIGh0bWw+PHRpdGxlPk1haXNvbiBDYWbDqTwvdGl0bGU+PGgxPk1haXNvbiBDYWbDqTwvaDE+"}],
 "idempotency_key": "<a new random UUID for this publish>"}
```

- A first publish returns `site` (`name`, `url`), version `number`, and without an account `site_token` (a secret for later calls until the site is kept) and `claim_url`. **Pass on `agent_message` in full** in the person's language, with every link, date and number exact and the Terms line kept.
- Every later call names the site by its id (`site_…`; `account_read` `what=account` lists the person's sites with their ids), never by its name or address: a name answers `not_found` saying so.
- Typed results: a tool declares an `outputSchema` in `tools/list` when it has fields worth typing (every field optional, other keys allowed); one with nothing to type declares none: with the main fields on `site_publish`, `site_read` `what=site`, `site_replace` `action=version`, `account_read` `what=account`, `site_update` `action=settings`, the list tools (`list_read` `what=lists`, `list_save`, `list_items_add` `action=add`, `list_items_change` `action=update`), `booking_save` `action=create` and `booking_save` `action=update`;
  minimal on the others (`confirm_token` on two-step tools, or an id or the main list). A result is its JSON as text and again in `structuredContent` while both stay under about 60 KB; a longer one is the text once (`structuredContent` `answer_in_text`), cut past 60 KB with `truncated` and a hint to ask for less; a CSV is its text once (`format: "csv"`).
- **An app that routes in the browser** (Vite, React Router, Vue Router): when `index.html` is the only page (a Vite build: `index.html` and `assets/`), it answers every address that has no file by itself. With other pages, also publish a copy of `index.html` as `200.html`: it answers every address that has no file, with status 200; without it a refresh or a link to an inner page answers 404. A `_redirects` rule such as `/* /index.html 302` is refused (it loops) and `200` rewrites are not supported; use `200.html`. When `assets/`, other pages and no `200.html` are sent, the reply's `agent_message` says so (`spa`).
- Save `.pagelemon.json` (`site`, `url`, `number`, `site_token` if any) in the project folder and add it to `.gitignore`; never write an account token into it.
- `idempotency_key` (a new random value for each publish: 32 to 128 characters, such as a freshly generated UUID; never reuse or copy an example) lets a retry after a lost reply find the site again. The retry answers with the site address and `replayed: true` but no `site_token` or `claim_url`, since those are shown once: if the first answer was lost, publish again with a new key.
- **Keeping it:** when the person has opened the claim link and signed in, `site_read` `what=site` with `site` and `site_token` says `claimed`. From then on update with their own connection (no `site_token`). Shell users poll `GET /v2/anonymous-sites/<site>` every 5 seconds for up to 10 minutes; once it says `claimed`, ask the person to make an API key in the Dashboard (Settings, API keys), which goes to `~/.config/pagelemon/credentials` (mode 600), and is never shown or committed.
- **Invites (until launch):** keeping a site needs an account, and a new account needs an invite; publishing doesn't. Mention invites only when the person asks or when signing in or an account-only action is refused; then pass on the message with its waitlist link (https://pagelemon.com/waitlist) or tell them to enter the invite a friend sent. Never in a first publish reply, never as promotion. The person's guide: https://pagelemon.com/docs/invites.
- Updating, photos, undo, rename: https://pagelemon.com/agents/edit.

## Confirm with the person

Their request is the yes to publish, so don't ask again before a normal publish. Do check these first, and ask if unsure:

1. **Nothing private goes up.** Never upload `.env`, keys, source code or personal documents. Page Lemon skips some files and blocks well-known key formats, but it cannot catch everything.
2. **It is public at once,** at the address in the reply (search engines are told not to list it for its first 7 days). For a big change to a live site, save a private draft first on a paid plan (`site_make` `action=preview`), or publish a private review copy on Free (https://pagelemon.com/agents/edit).
3. **A rename** (their name as the address) is approved by the person on a Page Lemon page; the old address stops working at once. Tell them to update any shared links.

## Test

Before saying it's live:

1. Open the returned `site.url`. A new site is served at once; after an update some visitors may see the previous version for up to 2 minutes while the cache refreshes (add `?v=2` to check at once).
2. Check it answers `200`, shows the page you sent (title or a heading), and that the links between pages work. The deploy reply helps: `skipped` lists files that weren't published, and `warnings` lists local links and images that point at no file.
3. Tell the person the address, and for an unkept site the time it goes offline (`expires_at`, UTC, in their local time) and the keep link. Then offer to keep it.

## Example: a one-card site

Use this when the person says "Design a simple, beautiful 'thanks for being my friend' card site and deploy on PageLemon.com", or the same for a card that asks one hard question, a "thinking of you" card or a "would you rather" card (the invite flow's first-site prompts). Publish in one go and do not ask questions first: write the words yourself, short and warm, with no names in them (it is for whoever the person sends it to). It is one static page, no sign-in, list or paid plan.

1. **Write the words.** Thanks: one heading and two or three warm lines. Hard question: one question that has no quick answer, and one line telling the reader to take a minute. Thinking of you: a short kind note, three or four lines. Would you rather: two options that are both tempting, the first shown, the other behind a tap (`<details>`).
2. **Start from the page below.** Change only the `<title>`, the description and what is inside `<article>`. Keep the rest: one column, large type, calm colours with dark mode, no sideways scroll at 375 px, no script, no images, no web fonts.
3. **Publish** one file with `site_publish` (`index.html`), open the address and check it shows your words. Tell the person the address and that they can send it to a friend.

```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Thanks for being my friend</title>
<meta name="description" content="A small card, just for you.">
<style>
:root{--bg:#faf8f4;--fg:#26231f;--mute:#625c53;--line:#ddd6ca;--card:#fff;color-scheme:light dark}
@media (prefers-color-scheme:dark){:root{--bg:#171513;--fg:#f1ede6;--mute:#b3aca1;--line:#3a3631;--card:#1f1c19}}
*{box-sizing:border-box}
body{margin:0;min-height:100vh;display:grid;place-items:center;padding:16px;background:var(--bg);color:var(--fg);font:1.125rem/1.6 Georgia,"Times New Roman",serif}
main{width:100%;max-width:30rem}
article{padding:40px 24px;background:var(--card);border:1px solid var(--line);border-radius:16px;text-align:center;overflow-wrap:anywhere}
h1{font-size:1.75rem;line-height:1.25;font-weight:600;margin:0 0 .75em}
p{margin:.75em 0}.mute{color:var(--mute)}
details{margin-top:1.5em;border-top:1px solid var(--line);padding-top:1em}
summary{cursor:pointer;min-height:48px;display:flex;align-items:center;justify-content:center;font-weight:600}
:focus-visible{outline:3px solid var(--fg);outline-offset:3px}
</style>
</head>
<body>
<main>
<article>
<h1>Thanks for being my friend</h1>
<p>You show up, you listen, and you make ordinary days better.</p>
<p class="mute">I don't say it often enough. Thank you.</p>
</article>
</main>
</body>
</html>
```

For a would-you-rather, put `<h1>Would you rather&hellip;</h1><p>Always know what everyone is thinking</p><p class="mute">or</p>` and then `<details><summary>See the other side</summary><p>Never be sure, and enjoy the surprise</p></details>` inside `<article>`.

## Day to day

- Change the site: https://pagelemon.com/agents/edit. Their own domain: https://pagelemon.com/agents/domains. A passcode or invite-only: https://pagelemon.com/agents/protect. Visits: https://pagelemon.com/agents/analytics.
- Forms (every plan) and bookings (paid plans): https://pagelemon.com/agents/forms and https://pagelemon.com/agents/booking.
- Show up in search: a unique `<title>` and description per page, a share image, and the business details on every page. Page Lemon makes `sitemap.xml`, `robots.txt` and `llms.txt` itself and points search engines at the main address, so don't write your own unless you need more (see https://pagelemon.com/agents/seo).

## What Page Lemon refuses, and the fix

| Refused | Fix to offer |
|---|---|
| `400`: no `index.html` at the top | Put the home page at the root of the upload (one top-level folder like `dist/` is stripped) |
| `413 too_large` | Smaller or fewer files: resize, crop and compress photos (about 2000 px long side, WebP or JPEG at about 80%), keep videos and big documents on a drive or video service and link them |
| `422 blocked_secret` (names the file, line and kind) | Remove the key from the site files. Don't encode or hide it. If it was ever shared, tell the person to replace it with their provider |
| `422 blocked_content` (Free and no account) | A page that asks for a password or card and sends it elsewhere, or is titled as another brand: link to the real sign-in or payment page instead |
| `400` on a program, installer or archive | Those can't be hosted on any plan; link to where they are kept |
| `429 rate_limited` without an account | Keep a site or sign up free for more; show `agent_message` |
| `429` rate limit with `Retry-After` | Wait that long, then send the same deploy again |
| `503 unavailable` (busy unpacking) | Wait `retry_after_seconds` and send the same deploy again |
| `401` after the site was kept | The site token stops working once kept: use the person's own connection or token |
| `410 site_archived` | Unarchive it first (https://pagelemon.com/agents/edit) |
| `precondition_required` | An update without `base_version`: nothing was published; read the site and send its live version number (`0` for a site with no version yet) |
| `409 version_conflict` | Someone changed the site since your `base_version`: nothing was published; the reply names what changed; merge as in https://pagelemon.com/agents/edit, don't retry with a newer version number |
| Account-only action refused: accounts are invite-only | Pass on the message with its waitlist link, or the person enters a friend's invite when signing up; the preview stays up until it ends. Don't retry |
| `410` the site expired | Publish again without `site`; it gets a new address |
| Name too short, taken, or not allowed | Ask for another; don't try variants without asking |
| A form, booking or domain on a plan without it | Say the plan needed and link https://pagelemon.com/pricing; don't retry |

## Links

- For the person: https://pagelemon.com/docs/publish
- The full publishing guide: https://pagelemon.com/agents · connect an AI app: https://pagelemon.com/docs/connect
- API: https://pagelemon.com/docs/api · MCP tools: https://pagelemon.com/docs/mcp
- Fixes by symptom: https://pagelemon.com/docs/fix-a-problem
