# putlive > putlive hosts what an AI agent made (a page, a small site, a single-page app, a file) and gives back a link. The link is private by default. This page is written for you, the agent: read it before you publish. The API is at https://api.putlive.dev. Its machine-readable description (OpenAPI 3.1) is https://api.putlive.dev/openapi.json. Published sites live at `.putlive.page` (a generated name, or one the user chose), and, where this service offers own domains and the account's plan includes one, on a domain of the user's own. Where it does not offer them, adding a domain is refused with `not_enabled` and the words "Own domains are not switched on for this service yet."; where the plan has none, with `forbidden` and "Own domains are not part of this account's plan." ## What this service is for Use it when a person asks you to put something online or share it as a link: "publish this", "host this", "share this as a link", "put this online", "make this page private". You send the files, the service checks them, and you get an address you can hand to the person. It serves static files only. No code of yours runs on the server. A page can have scripts that run in the visitor's browser, but there is no backend, no database and no secret kept for you. ## Rules that always apply 1. **The default is a private link.** A new site gets a generated address, long and random, and tells search engines to skip it. Anyone who has the address can open it. That is the safe starting point, as long as the site has only the generated address: a name of the user's own (see "A name for the address") makes an address that can be guessed, and the default then only keeps the site out of search engines. A password or a list of e-mail addresses is what keeps such a site private. 2. **Widening access needs the user's word.** Do not set `public`, and do not remove a password or an e-mail list, unless the user said so in this conversation. Narrowing access (a password, a list of addresses, an expiry) you may offer. 3. **Never publish secrets or other people's data.** Not API keys, tokens, passwords, `.env` files, private keys, cookies, or exports that hold other people's personal data. If a file looks like one of these, stop and ask the user. A published file can be opened by everyone who has the link. 4. **A page that calls a model from inside a sandbox will not work once published.** An artifact or demo that calls an AI model through the sandbox it was made in (no key of its own) has no such sandbox here, so those calls fail. Tell the user before you publish. 5. **Tell the user the truth about the result.** Say the address, who can open it, and, if the service held or refused the publication, why (see below). Do not call something published that is not `live`. 6. **Keep the API key secret.** It is shown once. Do not print it in the chat, do not write it into a file you publish, do not commit it. ## Install You can use the HTTP API below with `curl` alone (and `sha256sum` when you upload files). You can also install the Agent Skill of this service, which teaches an agent the same steps and brings a publisher script that needs `bash`, `curl`, `jq`, `sha256sum` (or `shasum`) and the `head` and `tail` that every system has: run `curl -fsSL https://putlive.dev/install.sh | sh` (it writes two files into your skills folder, asks before replacing an old copy, runs nothing it downloads and says what it wrote). The skill's files are also at https://putlive.dev/.well-known/skills/index.json. The command-line client of this service is a package: install it with `npm install -g putlive`, or run it once with `npx putlive ` (it needs Node.js 20 or newer). Do not run `npx` or `npm install` for any other package of this name. ## Sign in Where this service lets anybody make an account, an e-mail address is all it takes, and an `invite` you send is ignored. Where accounts are by invitation, a NEW address needs the invitation code (the `invite`) the first time; after that the e-mail address alone is enough. You cannot know which it is before you ask: send the `invite` when the user has one and leave the field out when they have none. 1. Ask the user for their e-mail address (and the invitation code, if they have one and have not signed in before). 2. Make a `request_id` of your own for this request: **22 characters** of `A-Z`, `a-z`, `0-9`, `-` and `_` (for example `head -c 16 /dev/urandom | base64 | tr '+/' '-_' | tr -d '='`), a new one every time you request a code. **Keep it** until step 4: the code is worth nothing without the value of the request that asked for it. Keep it only when the service took the request (the answer below is 204); after any other answer no code was sent, so the value is of no use: make a new one for the next request. Then request the code: ``` curl -sS -X POST https://api.putlive.dev/v1/auth/code \ -H 'Content-Type: application/json' \ -d '{"email":"person@example.com","request_id":"EXAMPLE-REQUEST-ID-22","invite":"EXAMPLE-INVITE"}' ``` The answer is 204 and nothing else. Where anybody can make an account it is the same for every well-formed address: it does not say whether the address has an account. Where accounts are by invitation, an address that has no account and sends no valid `invite` is refused here with `forbidden` (the hint is `invite required`): no code was sent, so ask the user for the invitation code, or tell them that accounts are by invitation, and begin again with a new `request_id`. When the answer is 204, a mail with an **8-digit code** is on its way, shown as two groups of four (`0000 0000`). It works once and for 10 minutes. If you get `invalid_request` that names `request_id`, your copy of the skill or of the command line is older than the service: update it. 3. Ask the user to read the code from their mail and tell it to you. **Never guess a code.** A code is looked at 5 times and then it is dead. If the code was wrong or too old, **do not ask for it again straight away: request a new code first** (step 2, with a new `request_id`), then ask for the new one. At most 5 codes an hour go to one address. 4. Trade the code for a key, with the **same** `request_id` as in step 2 (a code with another value is answered like a wrong code and uses one of its looks). If you have no value that a 204 of the last 10 minutes was answered for, for this address, **do not send the trade**: ask for a code first (step 2), because a trade with a missing, old or foreign value uses up a look of the code: ``` curl -sS -X POST https://api.putlive.dev/v1/auth/token \ -H 'Content-Type: application/json' \ -d '{"email":"person@example.com","code":"0000 0000","request_id":"EXAMPLE-REQUEST-ID-22","key_name":"my agent"}' ``` The answer holds `api_key` (it starts with `ah_`). Keep it for the rest of the session and send it on every call as `Authorization: Bearer `. If you lose it, sign in again for a new one. An address that has an account always signs in. Where anybody can make an account, a new address can be told `rate_limited` here ("New accounts cannot be made right now"): the service limits how many new accounts one network, one mailbox and the whole service make in a day or an hour, and the answer never says which. If the answer names a wait of a few seconds, the service was only busy making other accounts and the code is GIVEN BACK: trade the same code again after that wait. A longer wait is a cap, and the code is used up: wait that long, then begin again at step 2, and do not try again at once. A code that was used up is answered like a wrong code: then ask for a new one. Sign-up from some countries is refused (`forbidden`); the United Kingdom is closed at the launch. Throw-away e-mail domains are refused too. ## Publish with one request For a small page or site (text files, up to 256 KB together) one request is enough. The service stores the files, runs the checks and answers when the site is live or the checks are done: ``` curl -sS -X POST 'https://api.putlive.dev/v1/sites?wait=60' \ -H "Authorization: Bearer $API_KEY" \ -H 'Content-Type: application/json' \ -d '{"title":"My page","inlineFiles":[{"path":"index.html","content":"

Hello

"}]}' ``` The answer has `status`, `site.url` (the address to give the user), `site.id` and `release.id`. Act on `status`, and only on it: - `live`: it went up. Give the user `site.url` and say who can open it. - `checking` (HTTP 202): the checks are still running. Call `POST https://api.putlive.dev/v1/releases//finalize?wait=60` again, and again, until the status is something else. Repeating that call is safe. - `pending_review` (HTTP 200): the publication is held for a person. **Stop. There is nothing to retry and nothing to wait for in a loop.** Tell the user that a person will look at it and that the decision comes by e-mail. If nobody has looked within 72 hours the publication is refused: an update can then be published again, but a first publication leaves a `rejected` site, which cannot be updated, so it has to be deleted (`DELETE https://api.putlive.dev/v1/sites/`) and published again as a new site. Show the `reasons`. If this was an update, the version that was live keeps serving meanwhile. - `rejected`: refused by the safety checks. Show the `reasons` to the user; do not send the same files again. A single-page app that must answer every path with `index.html`: add `"spa":true`. ## Publish a bigger site, or binary files 1. For each file work out its path (relative, `/` separators, no `..`), its size in bytes and its SHA-256 in lower-case hex. 2. `POST https://api.putlive.dev/v1/sites` with `{"files":[{"path":"index.html","size":14,"sha256":"<64 hex>"}]}` (you may add `inlineFiles` for small text files). The answer is 201 with `uploads` (one entry per file the service does not hold yet), `finalizeUrl` and `release.id`. 3. For each entry of `uploads`: `curl -sS -X PUT "" -H "Authorization: Bearer $API_KEY" -H 'Content-Type: application/octet-stream' --data-binary @file`. Use the `url` exactly as given: each path segment is already percent-encoded. A file of 16 MB or less goes in one request like this; send a bigger one in parts (the next section). 4. `POST` the `finalizeUrl` (add `?wait=60`). If it answers `upload_incomplete`, `error.missing` lists the paths to upload again. To publish a new version of a site you already made, `POST https://api.putlive.dev/v1/sites//releases` with the same body. Files that did not change are reused. The upload session of a release ends 30 minutes after the last upload request that passed its checks, and 24 hours after the release was created at the latest (the next section says what that means). A publication has at most 2500 files; an account may start 4 publications in 24 hours for each site the plan allows (20 on Free). ## Send a big file in parts A file may go whole, with one `PUT` as above, or in parts. A file of 16 MB or less is sent whole; a bigger one is better sent in parts. **A single request may be ended after about a minute by the network in front of the service**: its answer is then not the service's own JSON (for example a proxy's own 499, 502, 503 or 504), and a whole file that was cut off has delivered nothing that is kept. So send a bigger file in parts of 16 MB, and after a part that was cut off ask where the file stands and go on from there: what arrived is kept. A whole `PUT` is accepted at any time, also after parts of the file arrived: it replaces them (while another request for the same file is running it is `conflict`), so a client of your own may fall back to it; the command-line client never sends whole a file that has bytes at the service. Three calls, on the `url` of the file's entry in `uploads` (used exactly as given) and on the release. Each carries the same `Authorization: Bearer $API_KEY` header as the `PUT` above, and the `PATCH` also `Content-Type: application/octet-stream`: - `GET ` answers the state of ONE file: `path`, `size` (from the file list), `received` (how many bytes the service holds of it), `complete` and, when something is wrong with the file, `problem`: `"mismatch"` after a file arrived with other bytes than the list announced, `"stuck"` when the service holds every byte and could not finish the file. It changes nothing and does not keep the upload session open. - `PATCH ?offset=` with the bytes from that byte on as the body (`Content-Type: application/octet-stream`) appends them and answers the state. The `offset` must be exactly where the file continues. There are no part numbers, no parallel parts of one file and no call that completes a file: the part that brings the last byte completes it. - `GET https://api.putlive.dev/v1/releases//uploads` answers the state of every file of the release at once (`files`, in the order of the file list, with the release's `status` and `expiresAt`): the call for taking an upload up again. For each file: 1. Ask the state. A file the service holds nothing of is `received: 0`. 2. Send the bytes from `received` on, at most 16 MB in a request. 3. After ANY failure that is not a refusal a person must read (a network error, an answer that is not the service's own JSON, `conflict`, `unavailable`, `rate_limited` after its pause, `upload_incomplete`; but a `conflict` that says the release is no longer open ends it: see below), ask the state and go on from the `received` it names, never from what you believe you sent: a request that was cut off has delivered bytes you never saw counted. A request that was cut off may still be held on the way for a moment, and a part sent meanwhile is `conflict`: pause, ask again, and give the upload up only when nothing has moved for some minutes. 4. `forbidden`, `not_found`, `limit_exceeded` and `invalid_request` stop the upload: read the message and the entry of that code below, and do not retry in a loop. That holds for `limit_exceeded` with the `limit` `disk` as well: while the storage is nearly full a part and a whole `PUT` are answered "Uploads are paused for a moment: the storage is nearly full. Try again later." Stop the loop and tell the user; run the upload again some minutes later, not seconds. What arrived stays, and the refused request does not move the end of the release's upload session (30 minutes after the last request that was accepted): while the release is still open ask the state and go on from `received`, and when it has ended start a new release. 5. `received` equal to `size` with `complete` false and no `problem`: every byte is here and the service is checking the file. Ask the state again every 2 seconds. `complete: true`: the file is a file of the release. A `finalize` that meets a file that is still being checked answers `upload_incomplete` with the hint that a large file is still being checked: ask again in a few seconds, and send nothing again. `problem: "stuck"`: see below, the checking is over and waiting for it does not help. What the three answers that surprise mean. `conflict` with the sentence "This release is no longer open for uploads.", from a part, a whole `PUT` or a state ask, is the END of this release (its session ended and it was settled, or it was finished): stop, do not ask again, and start a new release. `conflict` with the sentence "This file continues at byte N." means that the `offset` is not where the file continues: ask the state and send from its `received`. `conflict` with "Another upload of this file is in progress." means that a request for the same file is running (or one that was cut off is still held): wait, and ask again; never send two requests for one file at the same moment. `problem: "mismatch"` means that every byte arrived and their SHA-256 is not the one of the file list: the service removed the file and `received` is 0. Send it once more from byte 0; if it comes back as `mismatch` a second time, stop and tell the user: if the file changed after the list was made, publish again with a new list, and if it did not, the connection changes bytes on the way. `problem: "stuck"` means that every byte arrived and their SHA-256 is right, but the service could not finish the file (placing it failed, for example because its storage is full): stop asking every 2 seconds and send nothing again. The service tries to finish the file again when its state is asked or a part of it is sent, and not before a pause of its own after the last failed try; while it tries, the state shows every byte and no `problem`, and then says `complete: true` (the file is done) or `stuck` again. So ask the file's state again in a few minutes. A `finalize` that meets such a file answers `upload_incomplete` with the hint that a large file holds every byte but could not be finished; `finalize` starts no try, so do the same: ask the file's state in a few minutes, then call `finalize` again. How long it may take. The upload session of a release ends 30 minutes after the last upload request that passed its checks (a request that only asks where a file stands does not count), and 24 hours after the release was created, whatever arrives. That holds for a whole `PUT` as for a part, and a request that the network cut off counts. After the end a part, a whole `PUT` and a `finalize` are `forbidden` ("The upload session of this release has expired."); a state ask still answers as before, and `expiresAt` of `GET https://api.putlive.dev/v1/releases//uploads` is in the past while its `status` is still `uploading`. Within minutes of the end the service settles the release and removes the bytes that were sent: from then on a part, a whole `PUT` and a state ask are `conflict` with "This release is no longer open for uploads.", a `finalize` answers the stored state of the release (`status` `superseded`), and that list answers its `status` with no `files`. Any `status` there other than `uploading` means that this release is over. In every case start a new release (`POST https://api.putlive.dev/v1/sites//releases` with the same body) and send the files again. The command-line client does all of this by itself: it sends a file larger than a part in parts, goes on after a break, and takes an upload up again. When a publication to an account that holds a file larger than a part was stopped (the program was ended, or the connection was lost for good), run the same command again, with the same files and the same options, while the release is still open, and only what is missing is sent. The skill's script sends in parts and goes on after a break within one run, but it cannot take an upload up again after it was stopped: run it again, and the files are sent again. ## Publish a file by its address Where this service offers it, and the account's plan includes it, you can give the address of ONE public file and the service fetches it and publishes it as a site, instead of you downloading and uploading it: ``` curl -sS -X POST 'https://api.putlive.dev/v1/sites/import?wait=60' \ -H "Authorization: Bearer $API_KEY" \ -H 'Content-Type: application/json' \ -d '{"url":"https://files.example.com/report.pdf","title":"The report"}' ``` `title` is optional, and so is `siteId`: with it the file becomes a new version of that site of the account (without it, a new site is made). The address is at most 2048 characters, and `siteId` is the id of the site (a UUID), never its address or its name: anything else is `invalid_request` before anything is fetched. The answer is a publication's (`status`, `site.url`, `site.id`, `release.id`, and 202 while the checks still run: act on `status` as above) with two more fields: `file`, what was imported (`name` on the site, `size` in bytes and `contentType`, as the service read the file), and `warnings`, a list. Look at `file` before you tell the person it is done: when the person expected a document and the file is an HTML page (a page that asks for a sign-in looks like this), say so and offer to delete the site. `relative_files` in it means that the page refers to other files by a relative address and that those files were NOT imported: tell the user, because the page may look incomplete, and publish the whole folder instead. The command-line client does the same with `putlive publish --from-url
[--site ] [--title ]` (no path, and no other option: each is refused by name), the skill's script with `bash scripts/publish.sh --from-url
`, and a connected assistant with the tool `publish_from_url` (a new site only). What it takes: a direct link, `http` or `https`, to a file that opens for anybody, with no sign-in, and that is at most the account's file size and 100 MB. An HTML page becomes `index.html`; another file keeps its name. What it does not take, each answered `invalid_request` with ONE sentence for its reason and the hint to download the file and publish it as a file: a link into an assistant's own viewer (a shared chat, canvas or artifact link, or an address that REDIRECTS into one, by an HTTP redirect within the few the service follows, such as a short link or an older address of the same assistant: "This link opens a page inside an assistant's own viewer, not a file.": ask the assistant for the page's code, or download the file, then publish that; a page that sends a browser on by its own markup or script is an ordinary page, and is fetched as it is), an archive, a kind of file the service does not publish, an empty file, a file whose name looks like a secret or is a hidden file, an address the service does not fetch from, a server that cannot be reached, that does not hand out a file, that sends the request on too many times or that is too slow. A file that is too large is `limit_exceeded` with `limit` `file_size`. The service fetches from a part of its own that has its own rules; this API never connects to the address, and nothing the other server wrote is repeated in an answer. Where the service does not offer it, the answer is `not_enabled` with the words "Import by link is not switched on for this service yet." (do not retry); where the plan does not include it, `forbidden` with "Import by link is not part of this account's plan." (do not retry; tell the user). Both carry the same `hint`, which says what to do instead: "Publish the file itself instead: an agent sends its content, and an assistant in a chat makes an upload link for a file that is not text." An account may start 30 imports a day: a request counts once its address was handed to the serving side to be fetched, also when the serving side then refused the address or the file or no answer came; a request that was refused before that (an address of the wrong shape, a link on a viewer's host as given, a plan without it, storage nearly full) or that found the serving side busy or switched off does not; past that the answer is `rate_limited` with `Retry-After`, and another import running at that moment is `rate_limited` with a wait of a few seconds ("Another import is running. Try again in a moment."). ## If you are connected through MCP Some assistants do not hold an API key: the person added this service to them once, as a remote MCP server at https://putlive.dev/mcp, and signed in and pressed Allow on a page of this service. If your tools are `get_usage`, `list_sites`, `get_site`, `publish_site`, `update_site`, `set_access`, `delete_site`, `create_upload`, `add_domain` and `publish_from_url`, you are connected that way: use those tools instead of the HTTP calls above, and the rules above apply to you in the same way. The server also tells you these rules when the connection starts: - A new site is private: search engines skip it, and it opens only through its address. The generated address is long and cannot be guessed; an address made from a name of the person's own can, and then a password or an e-mail list is what keeps the site private. Keep it so unless the person asked for more. Ask the person before you choose public access; never choose it on your own. - Never publish a password, an API key, a token, a private key or another person's data. If a file holds one, leave the file out and say so. - Only text files go in the call itself. For anything else (images, PDFs, archives, other binary files) use create_upload: it gives the person a link on which they add the files themselves. - After you publish, tell the person the address and who can open it. Read both from the result: the access mode and, when they are there, whether access was switched off or has an end date. - The result's `page`, when it has one, says what the address opens: a player, a gallery, a PDF made from an office file or a download page. Nothing is converted: a file plays only where the person's browser can play it. - To put a site on a domain the person owns, use add_domain: it lists the DNS records the person must create at their domain, and calling it again looks again. Tell the person the records as they are. - To publish ONE public file that the person gave as a web address, use publish_from_url: it takes a direct link that opens without signing in, never a page inside an assistant's own viewer or an archive. For those, publish the page's text, or use create_upload. If it answers that import is not switched on or not part of the plan, do not retry it: publish the content with publish_site, or use create_upload for what is not text. - An error says what went wrong and what to do. Fix the cause before you try again, and do not repeat a request that was refused. The result of a publication carries the same `status` values as the API and a `note` to repeat to the person as it is. Only `live` means the site is open. The person can end the connection at any moment in their dashboard; your next call is then refused. ## What the address of a file opens A publication of an account that has no `index.html` opens as a page the service makes, not only as bare files. `site.page` of the answer (`page` in the connector's results, and in `GET https://api.putlive.dev/v1/sites/`) says which one: `site` (your files), `markdown`, `file` (the one file itself), `player`, `gallery`, `document` or `download`. Tell the user what the address opens, not only that it is live; where `page` is missing, the service has not said. - **One video** (`mp4`, `m4v`, `mov`, `webm`): on an account whose plan has video pages (`limits.videoPages` is true in `GET https://api.putlive.dev/v1/me`) a page with a player and the video's first picture as its poster (`player`); on any other plan the video file itself (`file`). - **One sound** (`mp3`, `m4a`, `aac`, `wav`, `flac`, `ogg`, `oga`, `opus`): a page with a player, on every plan (`player`). - **One office file** (`pptx`, `docx`, `xlsx`): a page that shows the PDF made from it, with the PDF linked beside the file, on every plan (`document`). A file above 100 MB, a document that would make more than 500 pages, or one the converter cannot read gets the `download` page instead. - **Two files or more, all of them pictures, sound or video, and no `index.html`**: a gallery (`gallery`). Each picture of up to 64 MB has a small picture of its own (a vector picture, `svg`, is shown as itself), each sound has a player, and each video is a clip with its first picture on a plan with video pages and a link on any other. A folder that holds a file of another kind beside them is a site, as it always was. - **One file of any other kind** (an archive, a video format with no player such as `mkv` or `avi`, a picture the service does not read such as `heic`): a download page that names the file, its size and its type and links it (`download`). A picture, a PDF, a text, an HTML page or a JSON file is opened as it is (`file`), and one Markdown file is shown as a page (`markdown`). - **An `index.html`**, with or without other files: your site, as it always was (`site`). The service never replaces it with a page of its own. Nothing is converted to another format: a video or a sound plays where the visitor's browser can play it, and a vector picture is never turned into a bitmap. The small pictures, the first pictures of videos and the PDFs are made on the service's own servers by programs that have no network; they are kept with the version and removed with it. They are made before the version goes out when that takes a few seconds. For a big gallery or a long document the version goes out at once with plain tiles or a download page, and the pictures follow a few minutes later: the answer says what the address opens at that moment, and `GET https://api.putlive.dev/v1/sites/` says it later. A page that could not be made never stops the publication: the file stays the page, or the site stays as it was. ## Who can open a site `PATCH https://api.putlive.dev/v1/sites//access` with a `mode`: - `link` (default): anyone who has the address, and search engines are told to skip it. - `password`: visitors are asked for a password you set (`password`, 8 to 256 characters). - `email`: visitors give an e-mail address from your list (`emails`, or `emailDomains`) and get a code by mail. - `public`: searchable, no secret in the address. Not on the Free plan (`forbidden`), and never without the user's word. Optional: `expiresAt` (a date and time with a time zone, in the future, or `null`) and `revoke` (`true` switches access off for everybody). Other calls: `GET /v1/sites`, `GET /v1/sites/`, `POST /v1/sites//rollback`, `DELETE /v1/sites/` (refused with `conflict` while the site is switched off, waits for a person or has a report that its sender confirmed and we have not decided yet: tell the user the message and stop), `GET /v1/me`, `GET /v1/usage`. ## A name for the address A site can have a name of its own for its address: it then answers on `.putlive.page` as well as on its generated address, and **the first address keeps working**. Only accounts whose plan includes it may set one; the others are refused with `forbidden`, and giving a name up is always allowed. Ask the user which name they want; never choose one for them, and tell them that an address made from a name can be guessed, so a site that must stay private needs a password or an e-mail list. A site that has a name is told as `site.url` (the address to give the user) and `site.addresses` (all of them, best first), and `site.name` is the name, or `null`. Send `"name":""` with the first `POST https://api.putlive.dev/v1/sites`, or `PATCH https://api.putlive.dev/v1/sites/` with `{"name":""}` for a site that exists (`{"name":null}` gives it up). A name is 3 to 40 letters, digits and hyphens, with no hyphen at either end and no two in a row, and it may not hold a word that is a well-known brand or that looks like a sign-in page (`invalid_request`, and `error.hint` states the rule). A name that is already the address of a site or that another account holds is `conflict`: ask the user for another. The number of changes a day is bounded (`rate_limited`). With the command-line client the same is `putlive publish --name ` for a new site and `putlive name ` for a site that exists (`--clear` gives the name up); through the connector, `publish_site` takes `name` for a new site. ## How often a site was opened Where the account's plan includes it, the service counts how often the account's sites are opened, and mails the owner at the next opening when the owner asks. `site.opens` in every answer that shows a site (`GET /v1/sites`, `GET /v1/sites/`, the answer of a publication) holds `total`, `last30Days`, `firstAt`, `lastAt` (the start of the 10 minutes in which it happened) and `notice` (`armed`: the owner is mailed the next time the site is opened). For an account whose plan does not include it `site.opens` is absent, not zero. `GET https://api.putlive.dev/v1/sites//opens` answers `days` (a count per day for the recent days, newest first; a day on which the site was not opened is not listed) and, for a site in the mode `email`, `recipients`: which address of the person's own list signed in with a code, how many times, and when first and last. `PATCH https://api.putlive.dev/v1/sites/` with `{"notifyNextOpen":true}` asks for ONE mail at the next opening (ask again for the next one; a site of such a plan is asked for by itself, from 10 minutes after it first goes live). Openings are counted in steps of 10 minutes, and the mail is for the first step that begins after the request (an opening in the same step as the request, or in the first steps after a site went live, does not send it): tell the user so, so that they do not think it was missed. The refusal of an account whose plan does not include it is `forbidden` with "Opens are not part of this account's plan.": tell the user that and go on without it. Say what the numbers are. An opening is a browser's navigation to a page of the site that was allowed, as far as the request can tell: a reload counts, the person's own visits count, a request that does not look like a browser's does not. It is never a count of people, and the service keeps nothing about a visitor for it: no address, no browser, no path (for an e-mail site only the address the person put on the list). The command-line client's `putlive opens ` prints the days and `--notify` asks for the mail; a connected assistant gets the summary from the tool `get_site`. ## A domain of the user's own A site can also answer on a domain the user already owns (`example.com`, `www.example.com`). Only accounts whose plan includes it may add one; the others are refused with `forbidden`, and where this service does not offer it yet the answer is `not_enabled`. Ask the user which domain they want; never choose one for them. `POST https://api.putlive.dev/v1/sites//domains` with `{"domain":"example.com"}` adds it and looks at its DNS once: the domain WAITS (`status` is `pending`) until its two records are right. `domain.records` are the DNS records the user makes where the domain is managed: a TXT record that shows the domain is theirs, and the record that points it here (a CNAME, or an A record for the bare name of a zone). The value of the TXT record is made by the service for this account and this name: it is shown only in this account's own answers and is written to no log, and once the user has made the record DNS shows it to everybody, which does no harm, because a name is taken only with the taker's own record at the domain. `domain.problems` say what the last look found, each with the record to create, change or remove: tell it to the user in those words. After the user made the records, `POST https://api.putlive.dev/v1/sites//domains//check` looks again; the service also looks by itself for a while after the domain was added, and later only when the person asks for a look, so do not call it in a loop. When both records are right the domain is `active` and the site answers on it, and `domain.certificate` is `pending` until its certificate works; the user is told by e-mail when a domain is connected, when it has a problem and when it is disconnected. `GET https://api.putlive.dev/v1/sites//domains` lists the domains of a site, and `DELETE https://api.putlive.dev/v1/sites//domains/` removes one (`unavailable` means nothing changed: repeat the call). A domain and its `www.` twin count as one. A name that cannot be used is `invalid_request` and `error.hint` says what to type; a domain the account has is `conflict`; the number of domains the plan includes is `limit_exceeded` with `limit` `domains`: offer to remove a domain the user no longer uses, with their word. With the command-line client the same is `putlive domain add ` (and `domain list`, `domain check`, `domain remove`); through the connector it is the tool `add_domain`. A domain is served over HTTPS only, with a certificate the service gets by itself at the first request for the name, which the service makes itself as soon as the domain is connected and our servers answer on it; a proxy or a CDN that is switched on for the name keeps that from working, so the records must be DNS only. A connected domain that stops pointing here is served for a grace period and then disconnected, and the user is told by e-mail both times. A domain that is connected to one account is not given to another account until the first account's TXT record is gone from it. ## Take the files of a site home `GET https://api.putlive.dev/v1/sites//files` lists the files of the version the site serves now: the `release` and, for each file, its `path`, `size` and `sha256`. `GET https://api.putlive.dev/v1/sites//files/` (each path segment percent-encoded, the slashes kept) sends the bytes of one file as a download. Compare what arrives with the size and the hash before you keep it. The command `putlive export ` does this for every site of the account: one folder per site, each file checked, a file already there with the same size and hash left alone. The bytes taken home in a day are bounded (`rate_limited` with `Retry-After` when a file would pass the day's budget): the command stops at once with that one answer, and a later run goes on from what is already in the folder. A site that is switched off after a report or a check (`quarantined`) is not given out: the answer is `forbidden`, and the user should contact support. ## People of the account An account whose plan includes a team has its owner and up to 4 members. The key you hold can be a member's key. It acts for the owner's account: the same sites, the same limits and the same usage, and `GET https://api.putlive.dev/v1/me` shows `account` (the owner's) and `actor` (`email` and `role`, `owner` or `member`, of the person the key belongs to). A member publishes and manages the account's sites, and makes keys and connections of their own. A member cannot read the log, invite or remove people, or do anything about the account's plan: such a request is `forbidden` with a sentence that says why. Do not repeat it: tell the user that the owner has to do it. The API has no call to invite or remove people: the owner does that on the Team page of the dashboard. Removing a person ends every key, session and connection through which they acted, and the upload links made with them: your next request with such a key is `unauthorized`. Do not try to sign in again with a key that was ended; ask the user. The mail "tell me at the next opening" goes to the address of the account, also when a member asks for it. If the user asks how to add a person: the owner invites them on the Team page of the dashboard, with the person's e-mail address. The person opens the link in the mail within 7 days, signs in with that same address and presses the button "Accept the invitation". A person whose own account has sites, members, open invitations or a plan that still runs cannot join until they have deleted the sites, removed the members, cancelled the invitations or ended that plan. A member can leave at any time, and the owner can remove a member: the keys and connected apps they made for the account end, and their own account stays. The log keeps an entry for 365 days. ## The log of the account's actions `GET https://api.putlive.dev/v1/log` answers the log of what the people of the account did for it, newest first: `entries` (each with `at`, `actor`, `via`, `action`, `target`, `result` and `network`) and `next`. Only the owner of an account whose plan includes the log may ask: any other key (a member's among them) is `forbidden` with a sentence that says why, and a member's attempt is itself written to the log. Do not repeat such a call: tell the user. A service that has switched the log off answers `not_enabled` with the words "The log of actions is not switched on for this service yet." (do not retry). `limit` (default 50, at most 10000; more is cut, not refused), `from`, `to`, `actor` (the id an entry gives), `action` and `format=csv` narrow it or make it a file. When `next` is not `null` (for a CSV: when the header `X-Log-Next` is there) more is left: send it as `before`, with the same other parameters, until it is `null`. An entry shows the network of a request and never its whole address, and a person whose own account was erased has no `actor.email`. Tell the user what the log holds if they ask: the time, the person, the way in (a key, the dashboard, a connected app, an upload link), the action and what it was done to, and nothing of the files. ## Publish a page without an account Where this service offers it, a page can be published with no sign-in and no key, for the user who has no account and wants a link now. Where it does not, starting a link (step 1), sending the link's list of files (the first `POST` of step 2) and finishing the page (`/finalize`) answer `not_enabled` with the words "Publishing without an account is not switched on for this service yet." (do not retry); the door is read at those three calls, so a page whose files were still being uploaded when the door was closed is not finished: start again where the service offers it, or use an account. Prefer the account route above whenever the user has an account or can sign in: this one is smaller on purpose. 1. `POST https://api.putlive.dev/v1/anonymous/uploads` (no key; the body is `{}` or nothing) answers 201 with `{"upload":{"url","expiresAt"}}`. `url` is an upload link, `/u/`. 2. Use the link like the one a connected assistant is given: `POST /publish` with `{"files":[{"path","size","sha256"}]}`, then a `PUT` to the address of every file it lists (the answer says which), then `POST /finalize?wait=60`. The link works once. 3. Both POSTs answer with `claimUrl` and `expiresAt`, except that the answer of `finalize` for a page the checks refused (`rejected`) has `expiresAt` and no `claimUrl`: such a page cannot be kept, and is deleted at its time. **Give the user the page's address and the `claimUrl`, and say that the page is deleted at `expiresAt` unless they open the `claimUrl` while signed in** (or you call `POST https://api.putlive.dev/v1/sites/claim` with a key and `{"token":""}`). The `claimUrl` is a secret: do not log it or share it. With the skill's script or the command-line client the same is one line, and they do the three steps for you: `bash scripts/publish.sh --anonymous` or `putlive publish --anonymous`. Neither reads or sends a key, even when one is set; both print the page's address, when it is deleted and the claim address (the JSON has `url`, `expiresAt` and `claimUrl`), and both refuse (exit 2, naming the option) `--site`, `--name`, `--title`, `--spa`, `--access`, `--password`, `--emails` and `--expires`, which belong to an account. Where this service does not offer it they exit with 7 (`not_enabled`): do not try again, tell the user, and use an account instead if they have one. The claim is `putlive claim ` or `bash scripts/publish.sh --claim `, with a key: only the last part of the address is used, and the page then becomes a site of that account, under its plan's limits. What such a page is: a Free page with less. It goes through every safety check before anybody can open it (`status` `pending_review` or `rejected` as for any publication); its address is random and private (never `public`); visitors first see a notice that it was published without an account, and the badge is on it; it is deleted 24 hours after it was published unless it is claimed. What it is not: it has no name and no domain of its own, it is never updated (one link makes one page: for a new version start again), nobody is e-mailed about it, and it cannot be changed or deleted by you afterwards: there is no account to do it. Limits: 100 files, 10 MB a file, 25 MB for the page, and 2 GB of downloads in all, after which the page is switched off; each is `limit_exceeded` (`files`, `file_size`, `storage`) with the number in the `message`, and an account gives more room. It also takes only the kinds of file a site is made of (pages, styles, scripts, pictures, fonts, sound, video, PDFs and plain data files such as text, JSON and CSV): the first file of another kind is refused with `limit_exceeded`, with no `limit` name and a `message` that names the file; publish such a file from an account. One client network may start 3 pages a day, and the whole service a number of its own: past either, `rate_limited` with `Retry-After`. `unavailable`: the storage is nearly full or too many such pages are alive, try again later. One confirmed report about such a page switches it off at once. ## What happens after you publish - **Every publication of a Free account is checked before it is served.** The checks look for malware, for dangerous links, for pages that imitate another service, and for password or card forms. This takes seconds, sometimes longer. - **Held for a person.** A publication that looks risky (for example a page with a password field, or links that could not be checked) is held. The answer has `status` `pending_review` and `reasons`. A person looks at it and the decision comes to the user by e-mail; after 72 hours without a decision it is refused. A held update can then be published again; a held first publication leaves a `rejected` site that cannot be updated, so delete it and publish the files as a new site. Tell the user the publication is waiting for a review and why (`reasons`) and stop: do not retry, do not poll. A held first publication has `site.status` `pending_review` and cannot be changed meanwhile (`pending_review` error). A held update leaves `site.status` `live`: the version that was live keeps serving until the person decides. - **Refused.** `status` is `rejected` and `reasons` says why in plain sentences. Show the reasons to the user. Do not try to get the same files through again; fix the cause or stop. - **On the Free plan an update never takes the live version down while it is checked.** If the new version is held or refused, the old one keeps serving. - **On the other plans a new version is served at once and checked right after.** The answer lists the malware check and the link check as `pending`, and they normally finish within minutes. The malware scanner does not read a file larger than 2047 MB. A definite finding switches the whole site off (`quarantined`), also when a newer version has gone live meanwhile, and the user is told the reasons by e-mail. Tell the user, and do not republish. Once the version is live, a language model also reads its pages once: if it is sure that a page imitates the sign-in page of a well-known service, that is a definite finding too; if it only suspects it, a person looks at the page and the site stays online meanwhile. - **A site can answer visitors with 509 for the rest of the month** when the account has used its monthly transfer. `GET /v1/usage` shows the numbers and `transfer.resetsAt`, when they reset. The site comes back by itself at that moment. - **An account that is not on the Free plan is stopped later.** Its sites are served until the month's transfer reaches three times `transfer.limitBytes` of `GET https://api.putlive.dev/v1/usage`, and only then answer visitors with 509, until `transfer.resetsAt` or until that limit grows (the stop is lifted at the next count, which can be 30 minutes behind). The limits in `GET https://api.putlive.dev/v1/me` and `GET https://api.putlive.dev/v1/usage` are the account's own numbers: room the user added to the account counts in them, so they can be bigger than the name of the plan suggests. Read them there and never work a limit out from the plan's name. When a site is stopped, tell the user, and do not republish. - **A Free account that is not used for 90 days loses its publications.** After two warnings by mail the sites go offline at 90 days (the files are kept for a while) and are deleted later. Using the API key, signing in, or a call through a connected app counts as use. Where anybody can make an account, an account that never had a site and was never used is mailed once and is removed at the same 90 days, but WHOLE (nothing of anybody's is on it, so no record stays); signing in keeps it. Tell the user if they made an account and have not used it. - A site can be switched off after a report or a check (`quarantined`). It cannot be updated then (`forbidden`); the user should contact support. ## Errors Every error is JSON: `{"error":{"code","message","hint?","limit?","missing?"}}`. Decide by `code`, never by the wording of `message`. Show the user the `message` and the `hint` when you cannot fix the cause yourself. This list is complete: it holds every code the API answers with. - `invalid_request` (400): the request is wrong. Read `message` and `hint`, fix the request, send it again. Do not repeat it unchanged. For a part of a file this includes an `offset` that is missing, given twice, not a whole number of bytes, or beyond the size of the file. - `unauthorized` (401): no valid key, or the sign-in code was wrong or too old. For a key: sign in again. For a code: request a new code first, then ask the user for it. - `forbidden` (403): refused on purpose: no invitation (where accounts are by invitation), a country that is closed, a throw-away address, the `public` mode on the Free plan, a feature that is not part of the account's plan (import by link), a switched-off site, or an upload session that ended. Do not retry. Tell the user; for an ended session start a new release. - `not_found` (404): no such site or release, or it is not this account's. Check the id with `GET /v1/sites`. - `conflict` (409): the request does not fit the state (for example "not live", "already live", "no earlier version"), or another change was being finished. If the message says another change is in progress, wait a few seconds and repeat once. For an upload, "This file continues at byte N." means that the `offset` of a part is not where the file continues, and "Another upload of this file is in progress." that a request for the same file is running: ask the state of the file, wait if you must, and send from its `received` (see "Send a big file in parts"). Otherwise change the request. Deleting a site that is switched off, waits for a person or has a report that its sender confirmed and we have not decided yet is refused with `conflict`: its files are kept until the case is closed. Show the user the `message` and `hint`; do not retry. - `limit_exceeded` (403): a limit is reached; `error.limit` names it: `sites`, `storage`, `file_size`, `files`, `publishes_per_day`, `email_list`, `api_keys`, `domains` or `disk`. For `sites` or `storage` offer to delete a site you no longer need, with the user's word; for `domains`, to remove a domain they no longer use. For `file_size` and `files` publish fewer or smaller files. For `publishes_per_day` wait or combine changes. For `api_keys` (signing in by a code: an account holds at most 20 active keys, and the refusal does not use the code up) ask the user to revoke a key they no longer use on the keys page of the dashboard, then call again with the same code, or ask for a new one. For `disk` the service is paused for a moment: try again later (minutes, not seconds). For `email_list` shorten the list of addresses and domains. - `too_large` (413): the request body is over its limit (`error.limit`). Send less: move large files from `inlineFiles` to `files` and upload them. - `upload_incomplete` (409): files are missing or arrived with another size or hash; `error.missing` lists the paths. Upload exactly those again, then finalize again. A part that is longer than what is left of the file, or that broke off, is this code too: ask the state of the file and go on from its `received`. When the hint says that a large file is still being checked, ask again in a few seconds: nothing needs to be sent again. - `pending_review` (409): the site waits for a person, so it cannot be changed now. Do not retry. Tell the user. (The answer of a publication that was itself held is not this error: it is a 200 with `status` `pending_review`, see above.) - `rejected` (403): the safety checks refused the site. Do not retry. Tell the user the reasons. - `rate_limited` (429): too many requests (30 imports by link a day per account, 120 a minute per key, 600 a minute for the whole account across all its keys, 1200 a minute for uploads, and per-hour limits on sign-in, reports and report confirmations: 5 codes an hour per address, 10 reports an hour and 60 confirmation attempts an hour per client network). Wait `Retry-After` seconds, then continue; slow down. - `unavailable` (503): the service or its storage cannot answer. Nothing was changed. Wait a little and repeat the same call, up to three times with growing pauses, then tell the user. On a sign-up it can also mean that sign-ups are paused for a moment while the service makes room (when it comes as you trade a code, the code is not used up: repeat the call later). - `not_enabled` (501): this instance does not offer what was asked (for example own domains, publishing a page without an account, or import by link, where they are not switched on). Nothing was changed, and asking again changes nothing. Do not retry and do not wait: tell the user what the `message` says. ## Report a page Anyone can report an address under `putlive.page`, or on a domain that is connected to a site, with `POST https://api.putlive.dev/v1/reports` (no key) or at https://putlive.dev/report. The reporter must confirm the receipt that is mailed to them.