---
title: "Issue a WebRTC preview token"
method: POST
path: "/api/live-sources/{id}/preview-token"
tags: ["live-sources"]
---

# Issue a WebRTC preview token

`POST /api/live-sources/{id}/preview-token`

## Request

- The document declares no server URL.
- Auth: one of:
  - API key in header `Authorization`
  - API key in cookie `sessionid`

A short-lived bearer token that lets the caller's browser read this source's feed over WHEP, at `/<path>/whep` on the site's own host.

## Path parameters

- `id` integer, required

## Response `201`

- PreviewToken
  - `token` string, required: Send as `Authorization: Bearer <token>` with the WHEP request.
  - `expiresAt` string, date-time, required: The token must be presented before this; a session it started keeps playing.
  - `contributionPath` string, required: The original feed. WebRTC carries its video but not AAC audio.
  - `previewPath` string, required: The Opus-audio preview, if a conversion worker runs for this source.
  - `programPath` string, required: A low-latency copy of what the channel is airing, readable with the same token. Empty where the receiver has no programme return.

## Other responses

- `400`
- `401`
- `404`: No such enabled source in your organizations.
- `405`
- `406`
- `415`
- `500`

## Changes

- **2026-11-13** `aa0809308971`: 1 info
  - added the required property `programPath` to the response with the `201` status
- **2026-10-29** `8c34ebc45a28`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/frikanalen/apis/frikanalen-django-api/changes/api/live-sources/:id/preview-token/post.md)

---

[API](https://skmtc.dev/frikanalen/apis/frikanalen-django-api.md) - [All operations](https://skmtc.dev/frikanalen/apis/frikanalen-django-api/llms.txt) - [OpenAPI document](https://skmtc.dev/frikanalen/apis/frikanalen-django-api/revisions/ebd4175e41fe?raw)
