Skip to main content
A playback token is a short, signed pass that lets one video play on one domain for a short time. Your server creates it, and the CDN checks it on every request.
Never put your API key in a web page. The API key creates tokens, so anyone with the key can play your videos anywhere. Tokens are safe in a page. Keys are not.

The call

POST /v1/projects/{projectId}/videos/{videoId}/playback-tokens
  • Auth: your project API key, Authorization: Bearer sk_....
  • Call it from your server, each time you show the video (or per page load).
  • The video must be ready and not held for review.
  • The domain must be a verified domain of the project.
Body: Answer (201):
On a plan with white-label (Pro and Agency), the answer also has playlistUrl for your own hls.js player:
Put embedUrl in an iframe, or playlistUrl in your own player. See Embed a video on any website.

cURL

Node.js (18+)

PHP / Laravel

Keep services.segmnt.key in your server environment (.env), never in a Blade template or a page.

Put the token in the page

Build the iframe on your server and send only the finished HTML:
The page sees a token, never the key.

Errors

Errors use application/problem+json. Use the code field in your code, not the text.

Tested in TEST

Checked against https://test-api.segmnt.cloud on 15 Oct 2026:
  • POST /v1/projects/{projectId}/videos/{videoId}/playback-tokens with no key → 401 unauthorized (the route is live).
  • The route, the verified-domain check, the token TTL and the held-video 409 are covered by api/src/playback-tokens.test.ts.

Where to go next