🧠WorkGeniusAI
Download Markdown
---
name: workgenius-html-publisher
description: Create a standalone HTML page from Markdown or other user-provided content and publish it to WorkGeniusAI when the user requests a public link.
---

# Publish HTML with WorkGeniusAI

Publish endpoint: https://workgeniusai.com/api/publish
Browser tool: https://workgeniusai.com/html-publisher

Use these instructions when the user asks to publish a page. No account, API key,
or setup is required. All published pages and their source HTML are public to
anyone with the link. A request to create a local file alone is not a request to
publish it publicly.

## Create the HTML

If the user supplies Markdown, convert it into a complete HTML page while
preserving its meaning. Include a descriptive title, UTF-8 charset, mobile
viewport, responsive CSS, and accessible structure. Save it as `page.html`.
Do not include private information or credentials.

The API accepts HTML, not Markdown. HTML must be at most 1 MiB of UTF-8 bytes,
and the full JSON request must be at most 2 MiB. Inline CSS and JavaScript work;
use data images or absolute HTTPS URLs for external assets. Relative files are
not uploaded. Pages render fullscreen without WorkGeniusAI branding. Scripts run
in isolation: browser storage, fetch/API calls, forms, popups, and embedded frames
are blocked. HTTPS scripts, styles, fonts, and images may load.

## Publish and return the link

Send `POST /api/publish` with `Content-Type: application/json` and a JSON body:

- `content`: required HTML string.
- `title`: optional page title, up to 200 characters; defaults to `Untitled page`.
- `format`: optional; the only supported value is `html`.

Use a JSON serializer to preserve quotes, newlines, and Unicode. This example
requires curl and jq:

```sh
set -eu
jq -n --rawfile content page.html --arg title "My page" \
  '{content: $content, title: $title, format: "html"}' > publish-request.json
curl --fail-with-body --silent --show-error \
  https://workgeniusai.com/api/publish \
  -H 'Content-Type: application/json' \
  --data-binary @publish-request.json \
  | jq -er '.url // error("Publishing failed: " + (.error // "unknown error"))'
```

Success returns HTTP 201 with a JSON response containing `url`. Return that URL
to the user. Share only the public URL; do not copy other response fields into
published HTML or shared output. Opening the URL requires no sign-in.

The response also includes `id` and `raw_url`. `GET /api/publish/ID` returns public
metadata and HTML as JSON; `raw_url` serves the HTML document directly. Browser
users who publish while signed in see their pages automatically under My pages.
They can permanently delete their own pages there after confirming. This removes
the stored document and disables its public links; it cannot be undone. Pages
published anonymously are not added to an account automatically.

## Handle errors

Errors return JSON with an `error` message. Common statuses are 400 for invalid
fields or JSON, 413 for oversized content, 415 for the wrong content type, 429
for publication limits, and 503 for temporary unavailability.

Creation allows 10 pages per minute and 100 per hour per IP. On 429, honor the
`Retry-After` header in seconds before retrying. Do not blindly retry an ambiguous
POST or network failure because it may have already published the page. Report
unresolved errors instead of claiming success or retrying repeatedly.