# Playback IDs API

Each video has one or more playback IDs, public or signed, each revocable on its own.

Source: https://clipmux.com/docs/reference/api/playback-ids

## Add a playback ID [#add-a-playback-id]

`POST /v1/assets/{id}/playback-ids`

Adds a playback ID. A `signed` one plays only with a token your backend signs; a `public` one plays for anyone with the URL.

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

### Parameters [#parameters]

| 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]

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `policy` | "signed", "public" | yes |  |

```json
{
  "policy": "public"
}
```

### Response 201 [#response-201]

Created

```json
{
  "id": "pid_01jmgkyp0c3ct46ees12paekfv",
  "policy": "public",
  "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) |
| 404 | [`not_found`](/docs/reference/errors#not_found) |
| 409 | [`asset_deleted`](/docs/reference/errors#asset_deleted) |
| 409 | [`too_many_playback_ids`](/docs/reference/errors#too_many_playback_ids) |
| 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) |

## Revoke a playback ID [#revoke-a-playback-id]

`DELETE /v1/assets/{id}/playback-ids/{pid}`

Revokes a playback ID: `200 revoked` once it is unpublished, `202 revoking` before. Its playback stops; the asset's other IDs keep playing.

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

### Parameters [#parameters-1]

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

### Response 200 [#response-200]

Revoked

```json
{
  "id": "pid_01j88d4vyy93fwe7p3aqr8kcqz",
  "policy": "signed",
  "playable": false,
  "status": "revoked"
}
```

### Response 202 [#response-202]

Revoking

```json
{
  "id": "pid_01j88d4vyy93fwe7p3aqr8kcqz",
  "policy": "signed",
  "playable": false,
  "status": "revoking"
}
```

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