# Uploads API

Resumable browser uploads.

Source: https://clipmux.com/docs/reference/api/uploads

Your backend creates the upload; the browser sends S3 multipart parts straight to storage with the upload token, then completes it.

## Create an upload [#create-an-upload]

`POST /v1/uploads`

Call from your backend, then hand the body to the browser uploader. The asset exists at once in `waiting_upload`, with its playback IDs, so you can store them before the file arrives. `generate` asks for subtitles and chapters once the video is ready; `renditions` limits the ladder.

**Authentication:** An API key with `uploads:write`.

### Parameters [#parameters]

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | A retry with the same key and request returns the first response; a different request is 422 idempotency_key_reused. |

### Request body [#request-body]

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `size` | integer | yes | The file size in bytes. |
| `playback_policy` | "signed", "public" | no | The policy of the playback ID made with the asset. Default signed. |
| `passthrough` | string | no | Your own reference; it comes back on the asset and its webhooks. |
| `title` | string | no | One line, up to 200 characters. |
| `generate` | Generate | no | Ask for subtitles and chapters once the video is ready; chapters imply subtitles. |
| `renditions` | Renditions | no | The ladder rungs to encode, e.g. ["1080p", "480p"]. Rungs above the source are skipped; if none chosen fits, the largest rung that fits is encoded. Leave it out for every rung up to the source. Shown largest first. |

```json
{
  "size": 734003200,
  "playback_policy": "signed",
  "passthrough": "lesson_42",
  "title": "Lesson 42: Sorting",
  "generate": {
    "subtitles": true,
    "chapters": true
  }
}
```

### Response 201 [#response-201]

Created

```json
{
  "upload_id": "upl_01jx169zxgft4kq0ydjct7r5y4",
  "asset_id": "ast_01jhsze3w2mhtbzr5qv1w5xy68",
  "part_size": 33554432,
  "part_count": 22,
  "upload_token": "M4XQ7R2VK6WT5ZJYBNC3D4F7GH",
  "playback_ids": [
    {
      "id": "pid_01j88d4vyy93fwe7p3aqr8kcqz",
      "policy": "signed",
      "playable": true,
      "status": "active"
    }
  ]
}
```

### Errors [#errors]

| Status | Code |
| --- | --- |
| 400 | [`invalid_request`](/docs/reference/errors#invalid_request) |
| 401 | [`unauthorized`](/docs/reference/errors#unauthorized) |
| 403 | [`insufficient_scope`](/docs/reference/errors#insufficient_scope) |
| 409 | [`idempotency_in_progress`](/docs/reference/errors#idempotency_in_progress) |
| 413 | [`too_large`](/docs/reference/errors#too_large) |
| 422 | [`idempotency_key_reused`](/docs/reference/errors#idempotency_key_reused) |
| 429 | [`rate_limited`](/docs/reference/errors#rate_limited) |

## Sign part URLs [#sign-part-urls]

`POST /v1/uploads/{id}/parts`

Up to 100 part numbers at a time. PUT each part's bytes to its URL before `expires_at`, and keep the `ETag` storage returns for each.

**Authentication:** The upload's `upload_token`.

### Parameters [#parameters-1]

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body [#request-body-1]

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `part_numbers` | array of integer | yes |  |

```json
{
  "part_numbers": [
    1,
    2,
    3
  ]
}
```

### Response 200 [#response-200]

Signed URLs; PUT each part and keep its ETag

```json
{
  "parts": [
    {
      "part_number": 1,
      "url": "https://storage.example.com/...&partNumber=1&..."
    }
  ],
  "expires_at": "2026-11-18T10:30:00Z"
}
```

### Errors [#errors-1]

| Status | Code |
| --- | --- |
| 400 | [`invalid_request`](/docs/reference/errors#invalid_request) |
| 401 | [`unauthorized`](/docs/reference/errors#unauthorized) |
| 403 | [`insufficient_scope`](/docs/reference/errors#insufficient_scope) |
| 403 | [`upload_mismatch`](/docs/reference/errors#upload_mismatch) |
| 404 | [`not_found`](/docs/reference/errors#not_found) |
| 409 | [`upload_not_active`](/docs/reference/errors#upload_not_active) |
| 409 | [`upload_expired`](/docs/reference/errors#upload_expired) |
| 429 | [`rate_limited`](/docs/reference/errors#rate_limited) |

## List stored parts, for resuming [#list-stored-parts-for-resuming]

`GET /v1/uploads/{id}/parts`

The parts storage already holds, so an upload can resume after a dropped connection or a closed tab.

**Authentication:** The upload's `upload_token`.

### Parameters [#parameters-2]

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Response 200 [#response-200-1]

Parts storage holds

```json
{
  "parts": [
    {
      "part_number": 1,
      "etag": "\"9b2cf535f27731c974343645a3985328\"",
      "size": 33554432
    }
  ]
}
```

### Errors [#errors-2]

| Status | Code |
| --- | --- |
| 400 | [`invalid_request`](/docs/reference/errors#invalid_request) |
| 401 | [`unauthorized`](/docs/reference/errors#unauthorized) |
| 403 | [`insufficient_scope`](/docs/reference/errors#insufficient_scope) |
| 404 | [`not_found`](/docs/reference/errors#not_found) |
| 429 | [`rate_limited`](/docs/reference/errors#rate_limited) |

## Complete an upload [#complete-an-upload]

`POST /v1/uploads/{id}/complete`

Send every part's number and `ETag`. The asset moves to `processing`, and encoding starts.

**Authentication:** The upload's `upload_token`.

### Parameters [#parameters-3]

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body [#request-body-2]

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `parts` | array of object | yes |  |

```json
{
  "parts": [
    {
      "part_number": 1,
      "etag": "\"9b2cf535f27731c974343645a3985328\""
    }
  ]
}
```

### Response 200 [#response-200-2]

The asset, processing

```json
{
  "id": "ast_01jhsze3w2mhtbzr5qv1w5xy68",
  "app_id": "app_01j6hrm8vmt8f27hd13py42rdc",
  "status": "processing",
  "version": 2,
  "passthrough": "lesson_42",
  "title": "Lesson 42: Sorting",
  "base_url": "https://media.example.com",
  "playback_ids": [
    {
      "id": "pid_01j88d4vyy93fwe7p3aqr8kcqz",
      "policy": "signed",
      "playable": true,
      "status": "active"
    }
  ],
  "duration_seconds": null,
  "tracks": [],
  "created_at": "2026-11-18T09:30:00Z",
  "updated_at": "2026-11-18T09:30:00Z"
}
```

### Errors [#errors-3]

| Status | Code |
| --- | --- |
| 400 | [`invalid_request`](/docs/reference/errors#invalid_request) |
| 400 | [`invalid_parts`](/docs/reference/errors#invalid_parts) |
| 401 | [`unauthorized`](/docs/reference/errors#unauthorized) |
| 403 | [`insufficient_scope`](/docs/reference/errors#insufficient_scope) |
| 403 | [`upload_mismatch`](/docs/reference/errors#upload_mismatch) |
| 404 | [`not_found`](/docs/reference/errors#not_found) |
| 409 | [`upload_not_active`](/docs/reference/errors#upload_not_active) |
| 409 | [`upload_expired`](/docs/reference/errors#upload_expired) |
| 409 | [`upload_missing`](/docs/reference/errors#upload_missing) |
| 409 | [`size_mismatch`](/docs/reference/errors#size_mismatch) |
| 429 | [`rate_limited`](/docs/reference/errors#rate_limited) |

## Cancel an upload [#cancel-an-upload]

`POST /v1/uploads/{id}/cancel`

Stops the upload. The asset becomes `errored` with `error_code` `upload_cancelled`. Takes the upload token or an API key with `uploads:write`.

**Authentication:** The upload's `upload_token`, or An API key with `uploads:write`.

### Parameters [#parameters-4]

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Response 200 [#response-200-3]

The asset, errored with upload_cancelled

```json
{
  "id": "ast_01jhsze3w2mhtbzr5qv1w5xy68",
  "app_id": "app_01j6hrm8vmt8f27hd13py42rdc",
  "status": "errored",
  "version": 2,
  "passthrough": "lesson_42",
  "title": "Lesson 42: Sorting",
  "base_url": "https://media.example.com",
  "playback_ids": [
    {
      "id": "pid_01j88d4vyy93fwe7p3aqr8kcqz",
      "policy": "signed",
      "playable": true,
      "status": "active"
    }
  ],
  "duration_seconds": null,
  "tracks": [],
  "created_at": "2026-11-18T09:30:00Z",
  "updated_at": "2026-11-18T09:30:00Z",
  "error_code": "upload_cancelled"
}
```

### Errors [#errors-4]

| Status | Code |
| --- | --- |
| 400 | [`invalid_request`](/docs/reference/errors#invalid_request) |
| 401 | [`unauthorized`](/docs/reference/errors#unauthorized) |
| 403 | [`insufficient_scope`](/docs/reference/errors#insufficient_scope) |
| 404 | [`not_found`](/docs/reference/errors#not_found) |
| 429 | [`rate_limited`](/docs/reference/errors#rate_limited) |
