---
title: "Upload a file"
method: PUT
path: "/v1/workspaces/{workspace}/files/{key}"
---

# Upload a file

`PUT /v1/workspaces/{workspace}/files/{key}`

## Request

- Base URL: `https://api.uploads.sh`
- URL: `https://api.uploads.sh/v1/workspaces/{workspace}/files/{key}`
- Auth: HTTP bearer

Send an Idempotency-Key to make retries safe for 24 hours. Reusing the key with the same effective request (keyed on the uploaded content) returns the original 201 response. Reusing it with a different request returns 409.

## Query parameters

- `replace` boolean
- `dryRun` boolean

## Headers

- `Idempotency-Key` string

## Response `200`

Dry-run result when `dryRun` is enabled.

- FileDryRun
  - `workspace` string, required
  - `key` string, required
  - `url` string, uri, nullable, required
  - `embedUrl` string, uri, nullable, required
  - `replaced` boolean, required
  - `wouldRefuse` boolean, required
  - `dryRun` unknown, required

## Other responses

- `201`: The file was stored.
- `400`: Invalid request.
- `401`: Missing or invalid credential.
- `403`: The credential lacks the required scope or role.
- `409`: The request conflicts with current resource state.
- `413`: The upload exceeds the workspace limit.
- `415`: The bytes are not an allowed media type.
- `429`: The workspace rate limit or upload budget was exceeded.

---

[API](https://skmtc.dev/uploads/apis/uploads-sh-api.md) · [All operations](https://skmtc.dev/uploads/apis/uploads-sh-api/llms.txt) · [OpenAPI document](https://skmtc.dev/uploads/apis/uploads-sh-api/revisions/6df242babacd?raw)
