Write a page (HTML → anew.page URL)
anew_writePublish a web page: encode one self-contained HTML document (or fragment, or plain text) into an anew.page URL and return that URL. Use it when the user asks for a page, a site or a link they can open and share. The page is carried in the URL itself — no account, and no copy of the page is kept — so anyone who has the URL can open it; each call also starts a screenshot of the page, cached publicly for link previews. Put markup and inline CSS in html and any JavaScript in javascript as plain source; the server inserts it before . Inline the page's CSS, scripts and images so it renders on its own; a webfont may load from a CDN. Each encoding path is deterministic: the same input through the same path always produces the same URL. Different paths use different Brotli encoders, though, so the same HTML may mint different — equally valid — URLs; compare pages by their decoded HTML, never by slug. Limits: a page whose URL would pass 4000 bytes, or whose HTML passes 1048576 bytes decoded, is refused with an error that states the size and the overage; apps cut longer links short when they are shared. To revise an existing anew page, its URL is its source: read it, edit that HTML, write it again. The new URL is a separate page and the original keeps working. Read it with anew_read first, then call this with the edited HTML.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| html | Yes | The page: HTML markup with inline CSS — a full document, a fragment, or plain text. Its JavaScript goes in javascript. Encoded into the returned URL. | |
| javascript | No | Optional client-side JavaScript for the page, as plain source without script tags. The server inserts it immediately before </body> (or at the end when there is no body). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The anew.page URL of the page. | |
| bytes | Yes | Encoded URL length in bytes. | |
| warning | No | Not returned: a page past a size limit is refused with an error instead. | |
| decoded_bytes | Yes | The submitted HTML in UTF-8 bytes. |