# Videos API

A video is an asset in the API: its status, playback IDs, tracks and renditions.

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

Find one by your own `passthrough`, page through changes, rename, re-encode or delete it.

## Import from a URL, or attach a PC agent's local file [#import-from-a-url-or-attach-a-pc-agents-local-file]

`POST /v1/assets`

Two ways to make an asset without an upload. With `url`, the server fetches a public http(s) URL and encodes it; a non-public or credentialed URL is `400 import_url_refused`, and a fetch that fails ends `errored` with `import_url_refused`, `import_failed` or `import_too_large`. With `agent_source_id`, it attaches a file a PC agent registered for `clipmux push --local`, and its jobs run only on that agent.

**Authentication:** An API key with `assets: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]

One of these, **ImportURL**:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `url` | string (uri) | yes |  |
| `playback_policy` | "signed", "public" | no |  |
| `passthrough` | string | no |  |
| `title` | string | no |  |
| `generate` | Generate | no |  |
| `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. |

One of these, **AttachAgentSource**:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agent_source_id` | string | yes |  |
| `playback_policy` | "signed", "public" | no |  |
| `passthrough` | string | no |  |
| `title` | string | no |  |
| `generate` | Generate | no |  |
| `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
{
  "url": "https://files.example.com/lesson-42.mp4",
  "playback_policy": "signed",
  "passthrough": "lesson_42",
  "title": "Lesson 42: Sorting"
}
```

### Response 201 [#response-201]

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]

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

## Find by passthrough, or page through changes [#find-by-passthrough-or-page-through-changes]

`GET /v1/assets`

With `passthrough`, the app's assets with that reference, newest first. With `updated_since`, every change since an RFC 3339 time, oldest first, deleted assets included, up to 100 a page with `next_cursor`: the way to catch up after missed webhooks.

**Authentication:** An API key with `assets:read`.

### Parameters [#parameters-1]

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `passthrough` | query | string | no | Your reference; newest first. |
| `updated_since` | query | string (date-time) | no | Every change since this time, oldest first, deleted included. |
| `cursor` | query | string | no |  |
| `limit` | query | integer | no |  |

### Response 200 [#response-200]

Assets

```json
{
  "data": [
    {
      "id": "ast_01jhsze3w2mhtbzr5qv1w5xy68",
      "app_id": "app_01j6hrm8vmt8f27hd13py42rdc",
      "status": "ready",
      "version": 4,
      "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": 1830.4,
      "tracks": [
        {
          "id": "trk_01j0qtsj1vyp4dyn7fsdkb9t8q",
          "kind": "subtitles",
          "source": "generated",
          "status": "ready",
          "language": "en",
          "name": "English"
        },
        {
          "id": "trk_01jbz1ke29rzfnpwz5grhd401k",
          "kind": "chapters",
          "source": "generated",
          "status": "ready"
        }
      ],
      "created_at": "2026-11-18T09:30:00Z",
      "updated_at": "2026-11-18T09:34:12Z"
    }
  ]
}
```

### Errors [#errors-1]

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

## Get an asset [#get-an-asset]

`GET /v1/assets/{id}`

The asset, as it is now. Keep the highest `version` you have seen.

**Authentication:** An API key with `assets:read`.

### Parameters [#parameters-2]

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Asset ID (ast_…). |

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

The asset

```json
{
  "id": "ast_01jhsze3w2mhtbzr5qv1w5xy68",
  "app_id": "app_01j6hrm8vmt8f27hd13py42rdc",
  "status": "ready",
  "version": 4,
  "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": 1830.4,
  "tracks": [
    {
      "id": "trk_01j0qtsj1vyp4dyn7fsdkb9t8q",
      "kind": "subtitles",
      "source": "generated",
      "status": "ready",
      "language": "en",
      "name": "English"
    },
    {
      "id": "trk_01jbz1ke29rzfnpwz5grhd401k",
      "kind": "chapters",
      "source": "generated",
      "status": "ready"
    }
  ],
  "created_at": "2026-11-18T09:30:00Z",
  "updated_at": "2026-11-18T09:34:12Z"
}
```

### 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) |

## Change an asset's title [#change-an-assets-title]

`PATCH /v1/assets/{id}`

Sets the title; `""` or `null` clears it. A change raises `version` and sends `video.asset.updated`; the same title changes nothing.

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

### Parameters [#parameters-3]

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Asset ID (ast_…). |

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `title` | string or null | yes |  |

```json
{
  "title": "Lesson 42: Sorting algorithms"
}
```

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

The asset

```json
{
  "id": "ast_01jhsze3w2mhtbzr5qv1w5xy68",
  "app_id": "app_01j6hrm8vmt8f27hd13py42rdc",
  "status": "ready",
  "version": 5,
  "passthrough": "lesson_42",
  "title": "Lesson 42: Sorting algorithms",
  "base_url": "https://media.example.com",
  "playback_ids": [
    {
      "id": "pid_01j88d4vyy93fwe7p3aqr8kcqz",
      "policy": "signed",
      "playable": true,
      "status": "active"
    }
  ],
  "duration_seconds": 1830.4,
  "tracks": [
    {
      "id": "trk_01j0qtsj1vyp4dyn7fsdkb9t8q",
      "kind": "subtitles",
      "source": "generated",
      "status": "ready",
      "language": "en",
      "name": "English"
    },
    {
      "id": "trk_01jbz1ke29rzfnpwz5grhd401k",
      "kind": "chapters",
      "source": "generated",
      "status": "ready"
    }
  ],
  "created_at": "2026-11-18T09:30:00Z",
  "updated_at": "2026-11-18T09:34:12Z"
}
```

### Errors [#errors-3]

| 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) |
| 409 | [`asset_deleted`](/docs/reference/errors#asset_deleted) |
| 429 | [`rate_limited`](/docs/reference/errors#rate_limited) |

## Delete an asset [#delete-an-asset]

`DELETE /v1/assets/{id}`

Playback stops at once. `200` once the files are gone, `202` while the delete job runs.

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

### Parameters [#parameters-4]

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Asset ID (ast_…). |

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

Files are gone

```json
{
  "id": "ast_01jhsze3w2mhtbzr5qv1w5xy68",
  "app_id": "app_01j6hrm8vmt8f27hd13py42rdc",
  "status": "deleted",
  "version": 5,
  "passthrough": "lesson_42",
  "title": "Lesson 42: Sorting",
  "base_url": "https://media.example.com",
  "playback_ids": [
    {
      "id": "pid_01j88d4vyy93fwe7p3aqr8kcqz",
      "policy": "signed",
      "playable": false,
      "status": "revoked"
    }
  ],
  "duration_seconds": 1830.4,
  "tracks": [
    {
      "id": "trk_01j0qtsj1vyp4dyn7fsdkb9t8q",
      "kind": "subtitles",
      "source": "generated",
      "status": "ready",
      "language": "en",
      "name": "English"
    },
    {
      "id": "trk_01jbz1ke29rzfnpwz5grhd401k",
      "kind": "chapters",
      "source": "generated",
      "status": "ready"
    }
  ],
  "created_at": "2026-11-18T09:30:00Z",
  "updated_at": "2026-11-18T09:34:12Z"
}
```

### Response 202 [#response-202]

The delete job runs

```json
{
  "id": "ast_01jhsze3w2mhtbzr5qv1w5xy68",
  "app_id": "app_01j6hrm8vmt8f27hd13py42rdc",
  "status": "deleted",
  "version": 5,
  "passthrough": "lesson_42",
  "title": "Lesson 42: Sorting",
  "base_url": "https://media.example.com",
  "playback_ids": [
    {
      "id": "pid_01j88d4vyy93fwe7p3aqr8kcqz",
      "policy": "signed",
      "playable": false,
      "status": "revoking"
    }
  ],
  "duration_seconds": 1830.4,
  "tracks": [
    {
      "id": "trk_01j0qtsj1vyp4dyn7fsdkb9t8q",
      "kind": "subtitles",
      "source": "generated",
      "status": "ready",
      "language": "en",
      "name": "English"
    },
    {
      "id": "trk_01jbz1ke29rzfnpwz5grhd401k",
      "kind": "chapters",
      "source": "generated",
      "status": "ready"
    }
  ],
  "created_at": "2026-11-18T09:30:00Z",
  "updated_at": "2026-11-18T09:34:12Z"
}
```

### 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) |

## Re-encode an asset [#re-encode-an-asset]

`POST /v1/assets/{id}/reencode`

Encodes the source again, for example with other `renditions`. The current output keeps playing until the new one is ready. `409 job_active` (with `job_id`) while another job changes the asset; `supersede` cancels it.

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

### Parameters [#parameters-5]

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Asset ID (ast_…). |
| `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-2]

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `supersede` | boolean | no |  |
| `renditions` | Renditions | no | Replaces the asset's choice for this output and the ones after it; leave it out to keep it. |

```json
{
  "renditions": [
    "1080p",
    "720p",
    "480p"
  ]
}
```

### Response 202 [#response-202-1]

Queued

```json
{
  "id": "job_01jq68ea3qk8sxe3rv83fez7sf",
  "kind": "reencode",
  "status": "queued"
}
```

### Errors [#errors-5]

| 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) |
| 409 | [`job_active`](/docs/reference/errors#job_active) |
| 409 | [`source_missing`](/docs/reference/errors#source_missing) |
| 409 | [`asset_not_ready`](/docs/reference/errors#asset_not_ready) |
| 409 | [`asset_deleted`](/docs/reference/errors#asset_deleted) |
| 409 | [`idempotency_in_progress`](/docs/reference/errors#idempotency_in_progress) |
| 422 | [`idempotency_key_reused`](/docs/reference/errors#idempotency_key_reused) |
| 429 | [`rate_limited`](/docs/reference/errors#rate_limited) |
