Publish HTML, Markdown, code or JSON page
publish_htmlPublish HTML, Markdown, code, or JSON to BrewPage and get a shareable link; make it public for gallery and search discovery or keep it private, with password, TTL, custom domain, and saved state options.
Instructions
Publish HTML, Markdown, code or JSON to BrewPage (max 5 MiB). Send namespace=public to be found: gallery + Google, Bing & AI search. Omitted: private. Format order: format, then a known filename extension, else the server detects it. Returns its primary share link and owner token. Optional password, TTL, filename, top toolbar (showTopBar). A public page without deliveryMode may get its own subdomain if it needs browser features a BrewPage link lacks; the result then has deliveryModeReason and a delivery notice. Markdown raw HTML is allowlisted: scripts, styles, event handlers, forms, embeds removed. Optional domain connects a custom domain the user owns to an HTML-format page. Returns manageUrl, a private management link (grants control; not for public sharing). Secrets allowed; likely ones are flagged in notices. Private namespace + password suit secrets. BrewPage tokens and manage links must never be in public content. Page code must not hide or alter the BrewPage badge; a profile can turn the badge off for a page. If the page should save what visitors enter (form answers, game progress, guestbook, votes), load https://brewpage.app/js/state.js in it and pass state. Without state a page cannot save data; {} is enough. Page script calls: bp.state() -> s|null (guard it); c=s.col("name"); c.set(key,value) c.get(key) c.remove(key) c.add(value) c.list({order,limit}) c.stats({countBy})
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"content": "<content>"
},
"name": "publish_html"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| state | No | Page data config (the `state` API): `{collections: {<name>: {mode: 'private'|'shared', write?: 'author'}}}`; full reference: guide topic `page-data`. HTML pages and sites, not Markdown; the page gets its own address. | |
| domain | No | Optional custom domain for the new publication: a bare hostname the user owns (www.example.com or example.com, no scheme or path). Needs a profile token or an owner token added to a free BrewPage profile, and no password. The publication is always created; the result lists the DNS records for the domain owner to create, or says why the custom domain was not set. | |
| format | No | Omit: a known filename extension decides, else the server detects html, markdown, code or JSON. `html` keeps code/JSON as HTML; also markdown/md or a code language. A whole HTML document sent as markdown becomes an HTML page. | |
| content | Yes | HTML, Markdown, code or JSON to publish | |
| ttlDays | No | TTL in days: up to 30 days without an account, up to 90 with a free profile (pass an ownerToken held in the profile); a default applies when omitted. Accepts whole days: 15, '15d', '15 days'. The returned expiresAt is the actual expiry. | |
| filename | No | Optional original filename (≤200 chars). Without `format`, a known extension sets the format (.md stays Markdown, even a whole HTML document). Used as title fallback when no <title>/<h1>; immutable on update. | |
| password | No | Optional password to protect the page | |
| namespace | No | Send namespace=public for anything meant to be found or shared (docs, guides, demos, portfolios, reports, landing pages): listed in the public gallery and sitemap, so Google, Bing and AI search index it and people discover it. Public pages are served on the brewpage.app domain itself, for the strongest search reach; code that needs its own origin (cookies, storage) gets its own subdomain automatically. Anyone can find and read a public page, so it is unsuitable for secrets, tokens or personal data. Omit (default): private, a generated priv-* namespace; unlisted, not indexed; the link still opens it. Lowercase only: 1-32 of a-z, 0-9, hyphen. | |
| ownerToken | No | Optional; the ownerToken from your first create keeps publications under one owner. Default: env BREWPAGE_OWNER_TOKEN (local server only), else a new token per create. | |
| showTopBar | No | Add a thin top toolbar (filename + Download button + theme toggle) on the served page. Default: hidden. | |
| deliveryMode | No | Optional delivery choice for a fresh publication, independent of password/namespace. Fresh sites and HTML-format pages outside public (including the default unlisted namespace) always use subdomain; an explicit path there still publishes, on subdomain, with a delivery notice. Everything else in any namespace (Markdown, code/text, files, JSON, KV, public HTML) defaults to path (Promotion); public HTML may automatically choose subdomain for browser features. When creation returns an existing publication, it keeps its actual mode and URL. |