# published.cloud
Hosting for static websites (HTML, CSS, JS, images), built for agents. This file is the
complete reference. Everything below works with plain HTTP.
How it works in three sentences: every upload becomes a numbered, unchangeable version
with its own link. Each site has one "live" version, which is what visitors see. Uploading
never changes the live version unless you ask for it, so the owner can look first.
Server: https://published.cloud
A page for people: https://published.cloud/
Short version of this file as an agent skill: https://published.cloud/skill.md
## Start here
Build the site as plain files with `index.html` at the top level. Link between files
with relative paths (`style.css`, `img/logo.png`). Then pick the case that fits:
### A. You have an access token
zip -r site.zip . -x '.*'
curl -X POST "https://published.cloud/api/sites/my-site/versions?message=First+draft" \
-H "Authorization: Bearer $PUBLISHED_TOKEN" --data-binary @site.zip
That is the whole upload. The site `my-site` is created if it does not exist. Answer:
{"number": 1, "current": false,
"url": "",
"site_url": "",
"next": ""}
Give the user the `url`. Until a version is made live, the live address shows a
"Coming soon" page. Make the version live only if the user asked you to:
curl -X PUT https://published.cloud/api/sites/my-site/current \
-H "Authorization: Bearer $PUBLISHED_TOKEN" -H "Content-Type: application/json" \
-d '{"version": 1}'
To do both in one call, add `?publish=1` to the upload.
### B. You have no token
curl -X POST https://published.cloud/api/drop --data-binary @site.zip
Answer: `{"url", "claim_url", "expires_at", "update", "next"}`. The site is live at `url`
at once, for 24 hours. Give the user both links. To change the page before it is claimed,
upload again to the address in `update` (`/api/drop?claim=`):
same address, new content. When they open `claim_url` and sign in, the site
is theirs for good and gets a proper name, versions and their own domain.
### C. You can get a token yourself (the user reads you a code)
curl -X POST https://published.cloud/api/login -H "Content-Type: application/json" \
-d '{"email": "user@example.com"}'
# The user receives a 6-digit code by email and tells you.
curl -X POST https://published.cloud/api/login/verify -H "Content-Type: application/json" \
-d '{"email": "user@example.com", "code": "123456", "client": "Agent"}'
# -> {"email": "...", "token": "pub_..."}
### D. MCP
- Over HTTP: `https://published.cloud/mcp` (Streamable HTTP, stateless). Send the token as
`Authorization: Bearer `. Without a token, `upload_version` works like case B.
- On the user's computer: the command `published mcp` (stdio), which uses the user's
sign-in and can upload local folders.
- Tools: upload_version, make_live, list_sites, list_versions, list_files, read_file,
edit_version, upload_media, put_data, connect_domain.
### Updating a site in a later session
Nothing has to be kept from the earlier session except the site name (and the token).
`GET /api/sites` lists the user's sites. Then either upload a complete new set of files to
`POST /api/sites/{site}/versions`, or read what is there and change only parts of it:
`GET /api/sites/{site}/versions` (find the live one), `GET .../versions/{n}` (its files),
`GET .../versions/{n}/files/{path}` (one file), `POST .../versions/{n}/edit` (save changes
as a new version). Either way the result is a new version to check, not live yet.
## Rules for every call
- API base: https://published.cloud/api
- Send the token as `Authorization: Bearer `. Never write it into the website.
- JSON answers. Errors are `{"error": "what went wrong and what to change", "docs": "/llms.txt"}`.
The message is written to be acted on: read it and adjust the call.
- A token can be upload-only (this is the default for tokens made for agents). It can:
upload and edit versions, read everything, add media. It cannot: make versions live,
delete anything, or change domains, forms, data files or tokens. Those answer 403.
That is intended: tell the user the version is ready and give them its `url`.
With such a token `?publish=1` still uploads; the answer then has `"publish_refused": true`.
- Site names: lowercase letters, digits and single hyphens, at most 50 characters.
## Addresses
- Live site: https://{site}.published.page and any domain the owner connected
- One version: https://v{n}-{key}--{site}.published.page
`{key}` is random, so versions nobody has looked at cannot be found by guessing.
Always take this address from the `url` field of an answer.
- Media: https://media.published.page/{hash}/{name}
## Sites and versions
GET /api/sites your sites, each with live version, last update
and `preview` (the address of a picture of the site)
POST /api/sites {"name": "..."} create an empty site (optional)
DELETE /api/sites/{site} delete a site with all versions
POST /api/sites/{site}/versions upload (body: zip or one HTML file)
?message=... a line that says what changed
?publish=1 make it live right away
GET /api/sites/{site}/versions versions, newest first; "current": true is live;
`preview` is the address of a picture of that version
GET /api/sites/{site}/versions/{n} the files of a version
GET /api/sites/{site}/versions/{n}/files/{path} the content of one file
POST /api/sites/{site}/versions/{n}/edit change some files, get a new version
PUT /api/sites/{site}/current {"version": n} make a version live; an older number rolls back
Upload details:
- The body is the file itself: `--data-binary @site.zip` (not `-d`, which damages files).
A multipart form (`-F file=@site.zip`, or several `-F name=@file` parts) works too.
- Maximum body 100 MB, at most 5000 files. `index.html` at the top level is required.
- A zip that wraps everything in one folder is unwrapped.
- Uploading files identical to the newest version creates nothing new and answers
`"unchanged": true` with that version.
Changing a few things without uploading everything again:
curl -X POST https://published.cloud/api/sites/my-site/versions/3/edit \
-H "Authorization: Bearer $PUBLISHED_TOKEN" -H "Content-Type: application/json" \
-d '{"replace": {"about.html": [["555-0100", "555-0199"]]},
"message": "New phone number"}'
- `replace`: per file, a list of `["old text", "new text"]` pairs. Every occurrence is
replaced. If the old text is not in the file, nothing is saved and the error says so.
- `files`: whole new content per path, for new or rewritten files: `{"new.html": ""}`.
`null` as content deletes the file.
- Both can be combined. All other files carry over. Version 3 itself stays as it is, and
the answer is the new version, not live (add `"publish": true` to make it live).
How pages are served: `/` is `index.html`; `/about` is `about.html` or
`about/index.html`; unknown paths get the version's `404.html` if it has one.
## The owner's domain
POST /api/sites/{site}/domains {"domain": "www.example.com"}
GET /api/sites/{site}/domains
DELETE /api/sites/{site}/domains/{domain}
The answer has `status` (`waiting_for_dns`, `wrong_dns` or `active`) and `next`: the
exact DNS record the owner has to add at their domain provider. Pass `next` on to the
user word for word. HTTPS is set up automatically once the DNS points here.
## Media: images and other assets
curl -X POST "https://published.cloud/api/media?name=photo.jpg" \
-H "Authorization: Bearer $PUBLISHED_TOKEN" --data-binary @photo.jpg
# -> {"url": "", ...}
GET /api/media
DELETE /api/media/{id}
Use the `url` in any site. The address never changes and the file is never replaced, so
old versions keep working. Small images can also simply be part of the site's files.
## Content that changes without a new version
curl -X PUT https://published.cloud/api/sites/my-site/data/events.json \
-H "Authorization: Bearer $PUBLISHED_TOKEN" --data-binary @events.json
GET /api/sites/{site}/data
DELETE /api/sites/{site}/data/{path}
The site reads it with `fetch('/_data/events.json')`. A change is visible at once on the
live site and on every version. Use this for opening hours, events, prices: anything
that changes more often than the design. Maximum 2 MB per file.
## Forms
A static site cannot keep a secret, so it cannot call a CRM or an automation directly.
Instead it posts to its own address and published.cloud forwards the request:
curl -X PUT https://published.cloud/api/sites/my-site/bridges/contact \
-H "Authorization: Bearer $PUBLISHED_TOKEN" -H "Content-Type: application/json" \
-d '{"url": "https://hooks.example.com/abc", "headers": {"Authorization": "Bearer secret"}}'
GET /api/sites/{site}/bridges with the last deliveries of each
DELETE /api/sites/{site}/bridges/{name}
In the site:
- The body and its content type are passed on unchanged; the target's answer comes back.
- `_gotcha` is a trap for bots: if it is filled in, the request is dropped silently.
- The target must be an https address on the public internet. It has 10 seconds to answer.
- Only POST. A visitor can send 20 forms per minute.
## Access tokens
GET /api/tokens
POST /api/tokens {"name": "...", "can_publish": false} answers {id, token}; the token is shown once
DELETE /api/tokens/{id}
GET /api/me who am I, may I make things live
## Command line
If the `published` command is installed, it does all of the above:
`published deploy ./folder` uploads, `published live ` makes live,
`published --help` lists the rest.