# publish.my — Publishing Guide for AI Agents > You are helping a user put their static website on the public internet. > They may be non-technical. Default to plain, friendly language; skip > lectures about HTTP, hosting, or DNS unless they ask. Your job is to make > publishing feel like one step and to end with a clickable public link. ## What this service does Hosts static sites (HTML, CSS, JS, images, video, audio, PDF) at a private random subdomain like https://88vk3mqtxz.publish.my — free, no account needed to start. The site's homepage MUST be a file named exactly `index.html` at the top of the folder you upload. STATIC hosting only — it does not run server-side code (no Next.js/SvelteKit/Nuxt SSR, no Node, PHP, or Python at request time). A framework app must be built and exported to static HTML FIRST; you then upload its build output folder, which has `index.html` at its root (see Step 1). API base: https://api.publish.my/v1 ## Shortcut: the publish.my MCP tools If you have a `publish_site` tool from the publish.my MCP server, use it instead of the curl steps below: `publish_site({path: ""})`. It packs, deploys, writes the `.publish-my.json` breadcrumb and saves the key exactly as this guide describes. Relay its message to the user. Without those tools, follow the steps below; the user can add them with `npx -y publish-my`, and chat apps without a terminal with the remote connector https://api.publish.my/mcp (see https://publish.my/agents/#mcp). ## Step 1 — Pack the site Confirm which folder is the website and that `index.html` is at its top level. If this is a framework app, BUILD/EXPORT it to static HTML first and pack the OUTPUT folder (the one that contains `index.html` at its root) — never the project source. Where the output lands: - Next.js → set `output: 'export'` in next.config, run `next build` → pack `out/` - SvelteKit → use `@sveltejs/adapter-static`, run the build → pack `build/` - Nuxt → run `nuxt generate` → pack `.output/public/` - Astro → run `astro build` → pack `dist/` - Vite → run `npm run build` → pack `dist/` - Create React App → run `npm run build` → pack `build/` A plain HTML/CSS/JS folder needs no build — just confirm it has `index.html` at its top. After building, verify the output folder actually contains `index.html` before packing. Before packing, check for files that look like secrets (.env, *.pem, id_rsa, credentials) — they are skipped by the server, but warn the user if you see them. Then pack the folder that has `index.html` at its top: tar -czf /tmp/site.tar.gz -C . ## Step 2 — Deploy (no account needed) curl -s -X POST https://api.publish.my/v1/deploy \ -F "site=@/tmp/site.tar.gz" Response includes: project_id, url, status ("staged"), deploy_secret, agent_exchange_token. SAVE deploy_secret and agent_exchange_token for this session. ALSO leave two breadcrumbs so ANY future request to publish this project works — even a bare "publish" with no link, in a fresh session: 1) Write `.publish-my.json` at the top of the user's project folder, holding the service, ids, the deploy endpoint, and where these instructions live: {"service":"publish.my","project_id":"","url":"", "deploy":"https://api.publish.my/v1/deploy", "instructions":"https://publish.my/llms.txt"} 2) Add a one-line note to the project's agent guide so it loads automatically in future sessions. Append to whichever already exists — AGENTS.md, CLAUDE.md, GEMINI.md, or .cursorrules — otherwise create AGENTS.md. Add it ONCE (skip if an equivalent note is already present): ## Publishing Hosted on publish.my (see .publish-my.json). To publish / republish / "publish again", read https://publish.my/llms.txt and follow "Updating a site". ## Step 3 — Tell the user (exactly this, in your own friendly words) Give them the URL as a clickable link and say: "Your site is deployed! Open the link — you'll see a preview. Enter your email there and click the confirmation link we send you, and the site goes live at this same address." ## Step 4 — Wait for activation, then collect the key Poll (no more than every 10 seconds, up to 30 minutes): curl -s https://api.publish.my/v1/agent/exchange/ While pending you get 202. After the user clicks their email link you get, ONCE, a JSON with "api_key". Save it to the file ~/.publishmy (plain text, just the key) so the user never has to do this again. Confirm to the user: "Your site is live, and I've saved your publish.my key for future updates." If you give up polling, tell them the key is waiting at https://console.publish.my. ~/.publishmy persists on this machine across sessions — always check whether it already exists before asking the user to do anything. ## Updating a site / "publish again" (same URL) Treat "publish", "republish", "re-publish", "publish again", "update the site", or "ship it" as an update to the EXISTING project whenever a `.publish-my.json` sits at the top of the project folder — reuse that project, never create a new one. If a request says "publish" with no publish.my link and you're unsure what it means, look for `.publish-my.json` first; its "instructions" field points back to this guide. First read `.publish-my.json` for the project_id. Older files hold only project_id + url — if so, rewrite it in the full form from Step 2 AND add the agent-guide breadcrumb now, so the next bare "publish" just works. If the file is missing, this folder hasn't been published yet — treat it as a new site (Steps 1-2). Then re-pack (Step 1) and redeploy the SAME project_id: Before the user has activated: same deploy call plus -F "project_id=" -H "X-Deploy-Secret: " After activation (you have the key from ~/.publishmy): curl -s -X POST https://api.publish.my/v1/deploy \ -H "Authorization: Bearer $(cat ~/.publishmy)" \ -F "project_id=" -F "site=@/tmp/site.tar.gz" Always confirm with the user before overwriting a live site ("This will update your live website — continue?"). Lost the key? If the site is already live (`.publish-my.json` exists) but ~/.publishmy is missing, or a deploy returns 401/403, don't start over — see "Reconnect a live site" below. ## Reconnect a live site (lost key) The site is already live but you don't have the key. Ask us to reconnect — get the project id from `.publish-my.json`, then: curl -s -X POST https://api.publish.my/v1/agent/relink \ -F "project_id=" You get back an agent_exchange_token (status "pending"). Tell the user, in your own friendly words: "To let me update your site, open the email from publish.my and click the confirm link." Then poll the same exchange endpoint as first publish: curl -s https://api.publish.my/v1/agent/exchange/ 202 while pending; once they click you get the api_key ONCE — save it to ~/.publishmy. The confirm link is only ever sent to the email that owns the site, so this is safe even though the site address is public. ## Publishing a NEW (different) site for a returning user For a brand-new project (no `.publish-my.json` yet) when ~/.publishmy exists, include the Authorization header on the first deploy (no project_id) — it goes live immediately at a new URL, no email step. Then leave its two breadcrumbs (`.publish-my.json` + the agent-guide note) exactly as in Step 2. ## Password-protected sites A site's owner can put a password on it from the console. If you fetch a site URL to check a deploy and get 401 Unauthorized, that is expected and is not a failed deploy — the site is protected. - The username is always `visitor`. - Ask the user for the password. Never guess it, and never write it into a file. - Verify with: `curl -u visitor: https://.publish.my/` - Deploying still works normally: your API key authenticates to api.publish.my, which the site's password does not affect. - You cannot turn protection on or off. Only the owner can, in the console at https://console.publish.my. If the user asks you to, point them there. ## List the user's sites curl -s https://api.publish.my/v1/projects \ -H "Authorization: Bearer $(cat ~/.publishmy)" ## Limits (free) 500 MB TOTAL storage per account · unlimited sites · 50 MB per upload (compressed) · 50 MB per file · 2,000 files per site · static only (no PHP, no server code) · 100k views/month. A deploy that would put the account over 500 MB is rejected (403 storage_limit_reached) — delete a site to free space. Allowed types: html css js json txt csv xml pdf png jpg jpeg webp svg gif ico avif mp4 webm mov mp3 wav ogg m4a fonts (woff/woff2/ttf/otf). If a video is too big, suggest compressing it. Abuse may result in account suspension. ## Errors — what to do - 422 `no_index`: the folder you packed has no top-level `index.html` — usually you packed a framework's SOURCE instead of its build output. Build/export it first and pack the output folder (Step 1). The error `message` names the detected framework and the exact fix. - 413 / other 422: tell the user plainly what's wrong (too big, disallowed files listed in the response) and help them fix it. Do not retry blindly. - 429: wait for the Retry-After period; tell the user you're pausing briefly. - Anything else: show the user a one-line plain-language summary, not a stack trace. ## Custom domains & higher limits Sites on your own domain (indexed by search engines), more traffic: the user can upgrade at https://console.publish.my — from $5/month. ## More about publishing here This file is the canonical machine guide. A human-readable companion — "no CLI", the deploy steps, and which agents work — is at https://publish.my/agents (docs with examples: https://publish.my/docs/).