> ## Documentation Index
> Fetch the complete documentation index at: https://docs.useshareable.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Uploads

> Send a large page, PDF or image from disk straight to storage, then publish it by upload_id.

## Create an upload

`POST https://useshareable.com/api/v1/uploads`

Use this when an agent has the file on disk and a shell. It's the fastest way to publish any HTML
page over \~50 KB, and the way to send a PDF or image over \~3 MB without hosting it somewhere
first. Inline `html` or `file_base64` is slow for large files because the model types every
byte, and it is capped at \~4 MB by the request-body limit. With an upload, one `curl` sends the
file from disk to storage, and you publish it by passing the `upload_id`. The MCP servers expose
this as the `create_upload` tool.

```bash theme={null}
FILE=report.html
curl -X POST https://useshareable.com/api/v1/uploads \
  -H "Authorization: Bearer $SHAREABLE_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"filename\": \"$FILE\", \"size\": $(wc -c < $FILE), \"sha256\": \"$(shasum -a 256 $FILE | cut -d' ' -f1)\"}"
```

```json theme={null}
{
  "data": {
    "upload_id": "eyJ1c2VySWQiOi…",
    "kind": "html",
    "upload_url": "https://…supabase.co/storage/v1/object/upload/sign/…",
    "method": "PUT",
    "headers": { "Content-Type": "text/html" },
    "size": 270726,
    "sha256": "25f1670b…",
    "expires_at": "2026-11-20T18:30:00.000Z",
    "curl": "curl -sS --fail -X PUT -H 'Content-Type: text/html' --data-binary @'report.html' '…'",
    "next": "PUT the file, then call publish_page (POST /api/v1/pages) or update_page (PATCH /api/v1/pages/{id}) with this upload_id instead of html."
  }
}
```

**filename** `string` *required*

The file's name with its extension. It sets the type: `.html`/`.htm` makes a page, and
`.pdf`/`.png`/`.jpg`/`.webp`/`.gif` makes a file. It can be a path; the returned `curl`
reads exactly what you pass, and only the base name is kept.

**size** `integer` *required*

The file's exact size in bytes. The uploaded file must match it exactly. A PDF/image can be up
to your plan's per-file cap (Free 5 MB, Pro 50 MB). An HTML page is limited to **7 MB** for
now, because larger pages time out when saved. For a bigger page, move images out into a
[deck](https://docs.useshareable.com/guides/multi-page-decks.md) as assets.

**sha256** `string`

Optional hex SHA-256 of the file. If given, an HTML upload whose bytes don't match is refused
with **`422`** when you use it.

**mime** `string`

Optional. Overrides the type inferred from `filename`.

Then:

1. **Send the file.** Run the returned `curl`, or `PUT` the raw bytes to `upload_url` with the
   given `headers`.
2. **Use it.** Pass `upload_id` in place of the content:

   * an HTML upload to [`POST /pages`](https://docs.useshareable.com/api-reference/pages) to create a page, or to `PATCH /pages/{id}` to replace a page's draft HTML;
   * a PDF/image upload to `POST /pages` to publish it.

   The other create options (`title`, `access`, controls) work as usual. HTML writes return
   `received: { bytes, sha256 }`, so you can confirm the server got exactly your file.

### Rules

* An `upload_id` belongs to the account that created it and expires after **30 minutes**.
* It **works once**: using it consumes the stored file. Retrying a PDF/image publish with the
  same id returns the page it already created.
* If a write fails (for example a duplicate title), the upload is kept, so you can retry with
  the same id.
* Files are stored in a private staging area until they are used. Unused uploads are deleted
  automatically.

### Errors

| Status | When |
| - | - |
| 400 | Missing `filename`/`size`, or an `upload_id` that is invalid, expired, already used, not uploaded yet, or a different size than declared |
| 401 | Missing or invalid credential |
| 403 | The `upload_id` belongs to another account |
| 413 | Over your plan's per-file cap, or an HTML page over 7 MB |
| 415 | Unsupported type (Office docs, SVG, etc.); export to PDF first |
| 422 | The SHA-256 doesn't match |
| 429 | Too many uploads in the last hour |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.