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.
Public videos need no token
Status: Coming soon. The per-video public access mode is not released yet, so every video needs a token today. This section describes how it will work. See Feature status.When the mode ships, a video whose access mode is Public will play with no token, so you will not call this endpoint for it. Build the embed URL with no
?token=...: https://cdn.segmnt.cloud/e/{videoId}. See
Protected and public videos.
Protected is the default today; the rest of this page is about protected videos.
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
readyand not held for review. - The
domainmust be a verified domain of the project.
Answer (
201):
playlistUrl for your own hls.js player:
embedUrl in an iframe, or playlistUrl in your own player. See
Embed a video on any website.
Bind a token to the viewer’s network (optional)
Status: Coming soon. See Feature status.A project will be able to turn on network binding (
ipBinding, off by
default). Then each new token is bound to the viewer’s network, so a link
that is shared to another network stops working. See
Viewer network binding.
You will pass the viewer’s IP address as viewerIp. Our API sees your
server’s IP, not the viewer’s, so your server is the one that knows the
viewer’s address: read it from the request socket or a trusted proxy header, and
put it here.
Send the viewer’s own address, never your server’s:
viewerIp will be 400 invalid_request. When ipBinding is off, viewerIp is
ignored, so sending it is always safe. The setting applies to tokens you create
after you change it; a token created earlier keeps working (or stays bound) until
it expires. The CDN keeps only the viewer’s network prefix (IPv4 /24,
IPv6 /64) and refuses another network with 403 ip_mismatch.
cURL
Node.js (18+)
PHP / Laravel
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:Errors
Errors useapplication/problem+json. Use the code field in your code, not
the text.
Tested against the current release
Checked on 15 Oct 2026:POST /v1/projects/{projectId}/videos/{videoId}/playback-tokenswith no key →401 unauthorized(the route is live).- The route, the verified-domain check, the token TTL and the held-video
409are covered by our API tests.
Where to go next
- Embed a video on any website
- Add segmnt to WordPress
- How playback protection works
- Accounts, projects, API keys and domains — verify the domain and create the key.