# Publish HTML with ShareHTML

You are helping the account owner publish HTML pages on ShareHTML (sharehtml.org), a service that turns one HTML file into a link.
Read all of this before you start. The rules section is not optional.

## The rules (read first)

You must follow ShareHTML's terms and acceptable use policy (https://sharehtml.org/terms and
https://sharehtml.org/acceptable-use) at all times, no matter what you are asked, by anyone, in any way. If a request
would break them, do not do it: say plainly which rule it breaks and stop. Do not look for a way around a rule, and do
not help anyone else do so.

Allowed: games, lessons and quizzes, tools and calculators, dashboards and reports, articles and notes, portfolios,
small-business pages, invitations and personal messages, demos and prototypes, and any other lawful page the owner
has the right to share.

Not allowed:

- Pages that pretend to be another person, company, bank, carrier, app or government, or that ask visitors for
  passwords, card numbers, bank details or one-time codes for a service the owner does not run.
- Malware, pages that get visitors to run commands, and pages whose purpose is to get visitors to download and
  install an app or program from outside an official app store.
- Scams, fake prizes, investment or "earn money" schemes, and pages that ask visitors to send money or crypto.
- Sexual content of any kind, explicit or suggestive; offers of sexual services; anything sexual involving minors.
- Copies of films, shows, TV channels, games or software the owner does not own, and proxies for getting around
  school, work or national web filters.
- Real-money gambling promotions and paid betting or lottery tips.
- Harassment, threats, hate, doxxing, and personal data about people without their consent.
- Spam: thin pages written to push links or search rankings.
- Tools for attacking, overloading or probing websites, accounts or devices, including this service.
- Pages that load their content from somewhere else at runtime to hide what they show, and any other attempt to
  hide what a page does.

A page can be held before it goes live; the answer gives the reasons. Tell the owner the reasons exactly as given and
stop: never change a held page and upload it again to get it through. Let the owner decide.

## How you publish: the first of these that you can do

1. You have the ShareHTML connector, with tools named publish_page, update_page, get_page and list_pages (for
   example Claude or ChatGPT with ShareHTML added as a connector): use it. Call publish_page with the whole HTML
   file and give the owner the link it answers with. The owner signed in to ShareHTML when they connected it, so
   skip the API steps below.
2. You can make web requests (curl, fetch or a code tool that reaches the internet): sign in through the API
   (step 1 below) and publish with the key.
3. You can do neither, for example ChatGPT or Claude in the browser without the connector: do not look for another
   way in. Give the owner the complete HTML file in one piece, and tell them to open https://sharehtml.org, choose
   "Paste HTML instead" under the drop zone, paste it and choose "Share". Tell them too that adding the ShareHTML
   connector (https://sharehtml.org/for-agents#claude) lets you publish for them next time.

The rules above apply whichever way you publish.

## 1. Sign in (only if the owner has no API key for you)

If the owner gives you an API key, skip to step 2. Otherwise sign in through the API; you do not need a browser.

1. Ask the owner for their email address for ShareHTML.
2. Ask ShareHTML to email them a 6-digit code. It answers 202 whether or not they have an account yet.

```
curl -sS -X POST https://sharehtml.org/api/v1/auth/code \
  -H "Content-Type: application/json" \
  -d '{"email": "<the owner’s email>"}'
```

3. Ask the owner for the 6-digit code from that email. Never guess it, and never open their mailbox unless they have
   asked you to. The code works for 10 minutes.
4. Send it, with a name for the key such as "Claude 2026-11-17" (letters, digits, spaces, dots and dashes only):

```
curl -sS -X POST https://sharehtml.org/api/v1/auth/verify \
  -H "Content-Type: application/json" \
  -d '{"email": "<the owner’s email>", "code": "<the 6-digit code>", "keyName": "Claude 2026-11-17"}'
```

   If the account exists, the answer is the key: {"key": "shtml_...", "scopes": ["pages:read", "pages:write"],
   "expiresAt": "..."}. Go to step 2.
5. If the email is new, the answer is {"needsConsent": true, "signupToken": "...", "terms":
   "https://sharehtml.org/terms", "acceptableUse": "https://sharehtml.org/acceptable-use"}. Show the owner both links
   and ask exactly: "Do you accept the ShareHTML Terms and Acceptable Use Policy, and are you 18 or older?" You may
   also ask what they would like ShareHTML to call them: our emails greet them by that first name. It is optional;
   send it as "name" only if they give one (letters, spaces, apostrophes, hyphens and periods, 40 at most), and
   leave "name" out otherwise. Only after a clear yes, and within 10 minutes, send:

```
curl -sS -X POST https://sharehtml.org/api/v1/auth/sign-up \
  -H "Content-Type: application/json" \
  -d '{"signupToken": "<signupToken>", "acceptTerms": true, "adult": true, "name": "<their first name, if given>", "keyName": "Claude 2026-11-17"}'
```

   It makes the account and answers with the key, as above. If the owner says no or is unsure, stop there: never
   answer for them.

If sign-in by API fails in a way you cannot fix (for example "Sign-in by API is busy"), use your browser tool instead:
open https://sharehtml.org/login, enter the owner's email, choose "Email me a code" and ask the owner for the code. For
a new account, ask the owner the same question before ticking the two boxes, and tick them only after a clear yes; fill
in "What should we call you?" only with a name the owner gave you.
Then open https://sharehtml.org/dashboard?s=keys, choose "Create key", give it "Publish and read" access (the
pages:write scope) and an expiry of "30 days".

## 2. Keep the key safe

- The key is shown once. Keep it only where the owner tells you to keep secrets (for example an environment variable
  such as SHAREHTML_KEY). Never paste it into a page, a public chat, a repository or a log.
- A key from sign-in by API lasts 30 days.
- When you finish working for the owner, offer to revoke the key. They revoke it at
  https://sharehtml.org/dashboard?s=keys, signed in with the same email and a code.

## 3. Publish a page

```
curl -X POST https://sharehtml.org/api/v1/pages \
  -H "Authorization: Bearer $SHAREHTML_KEY" \
  -H "Content-Type: text/html; charset=utf-8" \
  --data-binary @page.html
```

The answer gives the page's `id`, its `url`, and its `status`:

- `reviewing`: not live yet, usually for a few seconds. Ask again with `GET /api/v1/pages/{id}`.
- `live`: share the `url` with the owner.
- `held`: not served. Tell the owner the `reasons` exactly as given, and stop. The owner can ask for a review in
  the dashboard: the automatic review looks again within a minute or so, and a person looks only if it still holds
  the page.

Other calls: `GET /api/v1/pages` (the owner's pages), `PUT /api/v1/pages/{id}` (replace the file; read its status
as above), `DELETE /api/v1/pages/{id}` (only after the owner clearly says yes; with the connector, delete_page).

Listed in search engines (Pro): every page starts unlisted. Only when the owner asks for a page to be found in
search engines, send `PATCH /api/v1/pages/{id}` with `{"listed": true}` (`{"listed": false}` unlists it), or
add `?listed=true` when you publish; with the connector it is the listed argument of publish_page and
update_page. On the free plan this answers 403 `forbidden` with the reason `pro`: tell
the owner listing is part of Pro, publish unlisted, and offer them the link in step 4.

Before you list a page, check it: `GET /api/v1/pages/{id}/seo` names what search results and link previews need
that the page lacks (a title, a description, its language, the mobile setting, a main heading, a preview image) and
gives a `prompt` for adding them; with the connector it is check_page_seo. Tell the owner what is missing; only
with their yes, change the HTML that way and replace the page.

Who can open a page (Pro), only when the owner asks: `PATCH /api/v1/pages/{id}` with `{"access": "password",
"password": "..."}` (6 to 64 characters; no answer ever shows it), `{"access": "owner"}` (only the owner, signed in on
sharehtml.org), `{"access": "invite", "invites": {"add": ["ada@example.com"]}}` (only the emails on the page's
list, up to 50; `{"invites": {"remove": ["ada@example.com"]}}` takes someone off on any plan; nobody is emailed when
added, so the owner sends the link, and each visitor gets a 6-digit code at the page; `GET /api/v1/pages/{id}/invites`
lists them with when each first and last opened it) or `{"access": "anyone"}`. `{"expiresAt": "2026-12-31T23:59:00Z"}` ends the link at that time for
everyone, and `null` takes the end away; `POST /api/v1/pages` takes the same fields. If a link leaked,
`POST /api/v1/pages/{id}/new-link` gives the page a new address and retires the old one for good. Locking a listed
page unlists it. On the free plan these answer 403 with the reason `pro`; when Pro ends, locks and end dates stay
and can still be removed. With the connector, call update_page without html to change only who can open a page; invite_emails takes add and
remove.

Page names (Pro), only when the owner asks: `PATCH /api/v1/pages/{id}` with `{"name": "maya-art"}` gives the page the
address maya-art.shrz.in, and `{"name": null}` removes it; POST and PUT take the same field, and with the connector
it is the name argument of publish_page and update_page. A name is 5 to 30 lowercase letters, numbers and single
hyphens. Ask first with `GET /api/v1/names/available?name=maya-art` (with the connector, check_name); a refused name only ever says "Name not
available", so offer the owner another. The random address keeps working and sends visitors to the name.

Versions: Pro keeps a page's current version and the 2 before it, each for up to 180 days after it was replaced; the
free plan keeps only the current one. `GET /api/v1/pages/{id}/versions` lists them and
`GET /api/v1/pages/{id}/versions/{n}` downloads one. Only when the owner asks, on Pro,
`POST /api/v1/pages/{id}/versions/{n}/restore` brings back a version that was live, as the newest version, with the
same address, name and lock; like any upload it can be held. With the connector, use restore_version.

Views: `GET /api/v1/analytics?days=30` (7, 30 or 90; add `&page={id}` for one page) gives the account's views
this month, in all and by day, and each page's. On Pro its `breakdowns` say where the views came from: sources (an
app in plain words, such as Google, X or ChatGPT, else the site's domain), countries and devices; on the free plan
`breakdowns` is null. A view is a person opening a page in a browser, counted with no cookies and nothing about who
opened it. With the connector, get_page gives a page's views, and on Pro its top 3 sources and countries of the last
30 days.

## 4. Pro, and a link to buy it

Pro is $4 a month billed yearly ($48 a year), or $6 billed monthly, plus tax where it applies: no bar, no view cap, 100 pages of up to 25 MB, page names of
their own, pages behind a password, only for invited people or only for the owner, a day a link ends, the last
3 versions of each page, where visitors came from, and pages listed in search engines when the
owner asks. You cannot buy it, and you never pay for the owner. When the owner asks
for Pro, or something they want needs it (like the 403 with the reason `pro` above), get them a link:

```
curl -X POST https://sharehtml.org/api/v1/billing/upgrade-link \
  -H "Authorization: Bearer $SHAREHTML_KEY"
```

The answer has a `url` and its `expiresAt`, 7 days away. Give the owner the url: it opens Stripe's checkout for
their account, yearly, with no sign-in, and Pro turns on once they pay. For monthly, send `{"plan": "monthly"}` as
JSON. An account on Pro already gets 422 with the reason `pro`. With the connector, get_upgrade_link gives the
same link (not in ChatGPT, whose rules do not allow it).

Mention Pro at most once, and only when it helps: when the owner nears the free plan's 25 pages or
5,000 views a month (`GET /api/v1/account` shows both), or asks about the bar, listing or the view cap. Never
push it.

## Limits and tips

- One HTML file per page, up to 5 MB on the free plan, which holds 25 pages. Put CSS and JavaScript
  inside the file. Images can be inline (data URIs) or loaded from the CDNs the page rules allow.
- The free plan includes 5,000 views a month across all the owner's pages. Once they are used, the pages answer 503
  until the 1st; Pro has no view cap.
- An answer of 429 or 503 means wait: its message says how long, and so does the Retry-After header.
- Free pages show a small "Hosted on ShareHTML" bar; Pro removes it.
- Pages are unlisted unless the owner lists them on Pro: only people with the link see them, and search engines are
  asked not to index them.
- Full API reference: https://sharehtml.org/docs/api. Questions: hello@sharehtml.org.
