# Share links API

A share link plays one video for anyone holding its URL, until it expires or is revoked.

Source: https://clipmux.com/docs/reference/api/share-links

## Create a share link [#create-a-share-link]

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

Makes a share link and its own signed playback ID. `url` is the page to send. `name` is one line of up to 100 characters; `expires_at` must be in the future and can't be changed later. Allowed while the asset is processing.

**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 |
| --- | --- | --- | --- |
| `name` | string | no |  |
| `expires_at` | string (date-time) | no |  |

```json
{
  "name": "For the review",
  "expires_at": "2026-12-01T00:00:00Z"
}
```

### Response 201 [#response-201]

Created

```json
{
  "id": "shr_01jepn315k8tfeyh86qtbhnna7",
  "asset_id": "ast_01jhsze3w2mhtbzr5qv1w5xy68",
  "name": "For the review",
  "url": "https://video.example.com/s/QR2V7M4K5X3T6WAY5ZEB2CND4F",
  "playback_id": "pid_01jmgkyp0c3ct46ees12paekfv",
  "expires_at": "2026-12-01T00:00:00Z",
  "status": "active",
  "created_at": "2026-11-18T09:30:00Z"
}
```

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

## List an asset's share links [#list-an-assets-share-links]

`GET /v1/assets/{id}/shares`

The asset's share links, newest first, each with `views_30d`: its views over the last 30 UTC days.

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

### Parameters [#parameters-1]

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

### Response 200 [#response-200]

Newest first

```json
{
  "data": [
    {
      "id": "shr_01jepn315k8tfeyh86qtbhnna7",
      "asset_id": "ast_01jhsze3w2mhtbzr5qv1w5xy68",
      "name": "For the review",
      "url": "https://video.example.com/s/QR2V7M4K5X3T6WAY5ZEB2CND4F",
      "playback_id": "pid_01jmgkyp0c3ct46ees12paekfv",
      "expires_at": "2026-12-01T00:00:00Z",
      "status": "active",
      "created_at": "2026-11-18T09:30:00Z",
      "views_30d": 27
    }
  ]
}
```

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

## Revoke a share link [#revoke-a-share-link]

`DELETE /v1/shares/{id}`

Revokes the link's playback ID: `200` once unpublished, `202` while revoking. Revoking again changes nothing.

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

### Parameters [#parameters-2]

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

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

Unpublished

```json
{
  "id": "shr_01jepn315k8tfeyh86qtbhnna7",
  "asset_id": "ast_01jhsze3w2mhtbzr5qv1w5xy68",
  "name": "For the review",
  "url": "https://video.example.com/s/QR2V7M4K5X3T6WAY5ZEB2CND4F",
  "playback_id": "pid_01jmgkyp0c3ct46ees12paekfv",
  "expires_at": "2026-12-01T00:00:00Z",
  "status": "revoked",
  "created_at": "2026-11-18T09:30:00Z"
}
```

### Response 202 [#response-202]

Revoking

```json
{
  "id": "shr_01jepn315k8tfeyh86qtbhnna7",
  "asset_id": "ast_01jhsze3w2mhtbzr5qv1w5xy68",
  "name": "For the review",
  "url": "https://video.example.com/s/QR2V7M4K5X3T6WAY5ZEB2CND4F",
  "playback_id": "pid_01jmgkyp0c3ct46ees12paekfv",
  "expires_at": "2026-12-01T00:00:00Z",
  "status": "revoked",
  "created_at": "2026-11-18T09:30:00Z"
}
```

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

## A signed master.m3u8 URL for a share link [#a-signed-masterm3u8-url-for-a-share-link]

`POST /v1/shares/{id}/stream-url`

A signed `master.m3u8` URL for players that can't open the share page. It can't refresh: it lasts until the link's expiry or the longest token lifetime, whichever is first, and stops when the link is revoked.

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

### Parameters [#parameters-3]

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

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

The URL

```json
{
  "url": "https://media.example.com/v/eyJhbGciOiJFUzI1NiIs.../pid_01jmgkyp0c3ct46ees12paekfv/master.m3u8",
  "expires_at": "2026-11-25T09:30:00Z"
}
```

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