REST API
Upload, list, search, and organize files over HTTP.
First request #
The CLI and both MCP servers call this API. Call it directly when you build your own integration, or use the TypeScript SDK from JavaScript and TypeScript. With the API you can:
- Upload a file and get a public URL and a GitHub-ready embed URL.
- List, search, and tag files with metadata.
- Create galleries and live links.
- Read usage for a workspace.
The base URL is https://api.uploads.sh, and workspace routes start with
/v1/workspaces/{workspace}. Upload a file:
curl -X PUT \ https://api.uploads.sh/v1/workspaces/$WORKSPACE/files/screenshots/shot.png \ -H "Authorization: Bearer $UPLOADS_TOKEN" \ -H "Content-Type: image/png" \ --data-binary @shot.pngThe response is JSON with the stored key, its public url, and an embedUrl for GitHub
markdown.
Building an agent? The MCP server wraps these routes as tools →
Authentication #
Send a token on every request:
Authorization: Bearer upk_…A personal token works in every workspace your account belongs to. Older
personal tokens look like up_<workspace>_… and work the same way. If you
can write to a GitHub repo, your token can also upload for that repo’s pull
requests and issues in the workspace the repo is linked to, without joining
it. Your GitHub account must be linked.
- Personal token.
uploads logincreates one, or create one under Developers in your account. Tokens last 90 days by default, and each response carries the expiry in anUploads-Token-Expiresheader. - Service token. For CI and bots, a workspace admin creates an
ups_<workspace>_…token in the workspace settings. It is not tied to a member.
The workspace in the URL must match the token’s workspace. An unknown workspace and a bad token
both return 401.
Each endpoint needs one scope. The API reference lists it on each route.
| Scope | Grants |
|---|---|
files:read |
List, search, and read files, metadata, usage, galleries, feeds |
files:write |
Upload, update metadata, galleries, feeds, usage reconcile. Also delete a gh/ file the server stamped as this token’s. Older uploads need files:delete |
files:delete |
Delete any file, and purge expired ones |
The REST API does not accept OAuth access tokens. Those work only on the hosted MCP server.
Pagination #
List endpoints return a cursor field. It is an opaque string when there is another page, and
null at the end. Pass it back as ?cursor= with the same query to read the next page.
- Never parse, build, or edit a cursor. A cursor sent with a different query returns
400. - The gallery and feed lists name the field
nextCursor. It works the same way.
Errors #
Every error response uses one envelope:
{ "error": { "code": "storage_quota_exceeded", "type": "insufficient_storage", "message": "Storage full: <workspace> is out of space, so this upload didn't go through. Delete files you no longer need, upgrade your plan, or connect your own bucket: <billing> / <storage>", "details": { "maxStorageBytes": 1000 } }}| Field | Use |
|---|---|
code |
A stable string for one failure. Branch your client logic on it. |
type |
A broad category that sets the HTTP status. |
message |
Text for people. It can change, so don’t parse it. |
details |
Extra data for some codes. Optional. |
Rate limits #
Each workspace has separate burst limits for reads and writes. They are set well above normal CLI
and app traffic. A refused request returns 429 with type: rate_limited and a Retry-After
header in seconds. Wait that long, then retry.
The monthly upload budget also returns 429, with the code upload_budget_exceeded. It resets at
the start of the next UTC month, so it has no Retry-After. See Plans & limits.
To make an upload or gallery create safe to retry, send an Idempotency-Key header. A repeat with
the same key and request returns the first response for 24 hours.
Endpoints #
Every route, with its scope, parameters, request and response schemas, and examples, is in the API reference. It renders the OpenAPI document, which is checked against the real routes, so the two can’t drift.