# Stow

> Quick public file storage for you and your agents. Upload a file, get back a
> public link nobody can guess, ready to resize on request.

Stow stores a file and serves it at `https://stow.sh/{26-character id}/{filename}`.
Anyone with the link can open the file; nobody can list or guess links. Add
query parameters to resize or convert an image (`?w=800&f=avif`), or to make a
clip, poster frame or spritesheet from a video (`?mode=frame&t=1s`).

## Connect an agent

- **Skill**: `npx skills add https://stow.sh` teaches Claude Code, Codex,
  Cursor and most coding agents to upload, share and resize with Stow.
- **MCP**: add `https://stow.sh/mcp` as a connector in Claude, ChatGPT or any
  MCP client and sign in. Stdio-only clients can run `stow mcp`.
- **CLI**: `stow put ./file` prints the link. `stow schema` describes every
  command as JSON.
- **HTTP API**: `PUT https://stow.sh/api/files/{filename}` with
  `Authorization: Bearer <API key>`. Described at
  [openapi.json](https://stow.sh/openapi.json).

## Pricing

| Plan | Price | Storage | Largest file |
| --- | --- | --- | --- |
| Personal | $5 a month | 10 GB | 100 MB |
| Studio | $15 a month, or $150 a year | 100 GB | 100 MB |

Both include image and video transforms and any number of agents. Bandwidth
isn't metered; fair-use allowances are in the [terms](https://stow.sh/terms).
Billed in US dollars by Halling Howells Ltd. Cancel any time. Subscribe at
[stow.sh/account](https://stow.sh/account).

## Small on purpose

There are no folders, dashboards, teams or search. A file goes up, a link
comes back, and `stow rm <url>` takes it down again. Treat a shared link as
published: resized versions can stay cached for a while after a delete.

Contact: hello@stow.sh. Abuse: abuse@stow.sh.

---

# Using Stow from an agent

Stow stores a file and returns a public URL:
`https://stow.sh/{26-character id}/{filename}`. Anyone with the link can open
it; nobody can list or guess links.

- **Uploading publishes.** Upload what the user asked to share, not files they
  didn't mention. Transformed copies can stay in caches after a delete.
- **Give the URL exactly as returned.**
- **Delete only when the user asks.** It is permanent. The `delete_file` tool
  needs `confirm: true`; `stow rm --dry-run` shows what would go.
- **Never print the API key** or write it to a file that gets committed.

## Pick a route

1. **Stow MCP tools** (`put_file`, `put_text`, `put_from_url`,
   `create_upload_url`, `list_files`, `delete_file`, `transform_url`,
   `get_account`): use them; they are signed in. To add them, connect
   `https://stow.sh/mcp`, or run `stow mcp` as a stdio server.
2. **A `stow` command on PATH**: use the CLI. `stow schema` prints every
   command, flag, output and error as JSON.
3. **Otherwise**: curl the HTTP API, described at https://stow.sh/openapi.json.

The CLI and API read the key from `STOW_TOKEN`, then `~/.config/stow/token`.
With neither, ask the user to create a key at https://stow.sh/account and save
it to `~/.config/stow/token` with `chmod 600`. An upload-only key can add files
but not list or delete them.

## Upload

```bash
stow put ./render.png                 # prints the URL
stow put a.jpg b.mp4                  # one URL per line
stow put https://example.com/x.jpg    # re-host a remote file
stow put ./clip.mp4 --json            # { url, key, size, contentType }

TOKEN="${STOW_TOKEN:-$(cat ~/.config/stow/token)}"
curl -sS -T ./render.png -H "Authorization: Bearer $TOKEN" \
  https://stow.sh/api/files/render.png
# => {"url":"https://stow.sh/.../render.png","key":"...","size":1234,"contentType":"image/png"}
```

With curl, the last path segment becomes the filename in the link (URL-encode
it) and its extension sets the content type. To re-host a remote file over
curl, download it first.

## Limits and errors

Files up to 100 MB. Personal holds 10 GB, Studio 100 GB. `/api` and `/mcp`
allow 120 requests a minute per key. Errors are
`{"code", "error", "retryable", "docs"}`; retry only when `retryable` is true.

| Status and code | What to do |
| --- | --- |
| 401 `unauthorized` | Key missing, wrong, revoked or expired. Ask for a new one. |
| 402 `payment_required` | No plan. Tell the user to subscribe at https://stow.sh/account. |
| 403 `forbidden` | Upload-only key tried to list or delete. Ask for a full-access key. |
| 413 `too_large` | Over 100 MB. Compress or trim it, or link the source. |
| 413 `storage_full` | Plan is full. The user can delete files or move to Studio. |
| 404 `not_found` | No such file, or not theirs. |
| 429 `rate_limited` | Wait `Retry-After` seconds, then retry. |
| 5xx `failed`, `fetch_failed` | Retry once, then tell the user. |

CLI exit codes: 1 failed, 2 bad request or too large, 3 not found, 4 auth or
plan, 5 rate limited. With `--json`, the error goes to stderr as JSON.

## Transforms

Add query params to any Stow URL, or build one with `stow url <url> w=800
f=avif` or the `transform_url` tool. Unknown params are ignored.

**A transform that can't be applied serves the original file.** Before handing
over a thumbnail or poster, GET it (HEAD never transforms) and check the
header: `curl -s -o /dev/null -D - '<url>' | grep -i x-stow-transform` gives
`ok` for a variant and `original` for a fallback.

Images:

| Param | Values |
| --- | --- |
| `w`, `h` | pixels, up to 4096 |
| `q` | 1-100, default 80 |
| `f` | `webp` (default), `avif`, `jpeg`, `png` |
| `fit` | `scale-down` (default), `contain`, `cover`, `crop`, `pad` |
| `gravity` | `auto` (subject-aware), `face`, `left`, `right`, `top`, `bottom`, `center` |
| `trim` | `border` removes flat borders; or `top;right;bottom;left` pixels |
| `trim.tolerance`, `trim.keep` | with `trim=border`: 1-255, and pixels of border to keep |

Videos (MP4 H.264, up to 100 MB and 10 minutes):

| Param | Values |
| --- | --- |
| `w`, `h` | pixels, 10-2000 |
| `fit` | `contain` (default), `cover`, `scale-down` |
| `t` | start time: `5`, `5s`, `500ms`, `1m` |
| `d` | duration, same format |
| `audio=false` | silent MP4 |
| `mode` | `video` (default), `frame` (still), `spritesheet`, `audio` (M4A) |
| `f` | `jpg` or `png` for `mode=frame` |
| `count` | frames in a spritesheet, up to 100 |

Recipes:

- Thumbnail: `?w=400&h=400&fit=cover&gravity=auto`
- Poster frame: `?mode=frame&t=1s&w=1280`
- Preview clip: `?w=480&t=0&d=5s&audio=false`

For a `<video>` tag, use the untransformed URL: it seeks everywhere, while a
transformed clip seeks only once cached. There is no HLS; for long videos,
link the original.

## List and delete

```bash
stow ls                                # one URL per line, newest first
stow ls --json --limit 20              # one JSON object per line
stow rm https://stow.sh/{id}/{filename}
curl -sS -H "Authorization: Bearer $TOKEN" 'https://stow.sh/api/files?limit=100'
# => {"files":[...],"cursor":"..."}; pass ?cursor= for the next page, null on the last
curl -sS -X DELETE -H "Authorization: Bearer $TOKEN" \
  https://stow.sh/api/files/{id}/{filename}
```

Only the uploading account can delete a file.
