---
name: published
description: Publish a static website (HTML, CSS, JS, images) to published.cloud and get a link. Use when the user wants a website, landing page, report or prototype online, wants to update a site that is already there, or wants to roll back to an earlier version.
---

# Publish websites with published.cloud

published.cloud hosts static websites. Every upload becomes a numbered version with its own
link. One version per site is "live": that is what visitors see. Uploading never changes
the live site on its own, so the user can look first.

Server: https://published.cloud
Full reference: https://published.cloud/llms.txt

## The fastest path

Build the site as plain files with an `index.html` at the top level and relative links.
Put `<script src="/_track.js" defer></script>` into every page (anonymous visitor numbers
for the owner) and let forms post to `/_form/contact` (stored for the owner, no setup).

**If you have an access token** (environment variable `PUBLISHED_TOKEN`):

    cd my-site && zip -r ../site.zip . && cd ..
    curl -X POST "https://published.cloud/api/sites/SITE-NAME/versions?message=What+changed" \
      -H "Authorization: Bearer $PUBLISHED_TOKEN" --data-binary @site.zip

The site is created if it does not exist. The answer has `url` (a link to check exactly
this version) and `next` (what to do now). Give the user the `url`.

**If you have no token**, upload without an account:

    curl -X POST https://published.cloud/api/drop --data-binary @site.zip

The site is live for 24 hours at the `url` in the answer. Give the user both the `url`
and the `claim_url`. To change the page afterwards, upload again to the `update` address
from the answer. Opening the claim link and signing in keeps the site for good.

A single HTML file works too: `--data-binary @index.html`.

## Updating a site that already exists

You do not need the old files. With a token, `GET https://published.cloud/api/sites` lists the sites;
`POST https://published.cloud/api/sites/SITE-NAME/versions/N/edit` with
`{"replace": {"index.html": [["old text", "new text"]]}}` changes parts of version N and
saves the result as a new version. Or upload a complete new zip as in the fastest path.

## Making a version live

Only do this when the user asked you to put it live.

    curl -X PUT https://published.cloud/api/sites/SITE-NAME/current \
      -H "Authorization: Bearer $PUBLISHED_TOKEN" -H "Content-Type: application/json" \
      -d '{"version": 3}'

Sending an older number rolls back. If the answer is 403, your token is upload-only:
tell the user the version is ready and give them the link.

## Rules

- Never put the token into the website's files.
- Site names: lowercase letters, digits and single hyphens.
- Errors are JSON: `{"error": "what went wrong and how to fix it"}`. Read the message; it
  tells you what to change.
- "How is my page doing?" is `GET https://published.cloud/api/sites/SITE-NAME/stats`; "who wrote to me?" is
  `GET https://published.cloud/api/sites/SITE-NAME/forms/contact/submissions`. Both work with any token.
- For small changes to an existing site, images with permanent addresses, forms, statistics
  and content that changes without a new version, see https://published.cloud/llms.txt.
