Skip to main content
This is a tutorial. Follow it from top to bottom and you will end with a protected video playing on your own domain, and proof that a copied link returns 403. It takes about 10 minutes. You need one thing first: a website or test page whose domain you control, for example courses.example.com.
Want the reference instead of a lesson? See Set up your first project and Direct upload.

Step 1: Sign in

  1. Open https://app.segmnt.cloud.
  2. Pick Google or GitHub.
We create your free account on this first sign-in. There is no password and no card.

Step 2: Create a project

A project is one site, one client or one product. A free account has one project. In the dashboard, open Projects → New project, and give it a name. Keep the project id (prj_...); the next steps use it.

Step 3: Verify your domain

Playback is locked to a domain, so add the host that will show the video.
  1. Open the project → Domains → Add domain.
  2. Enter the exact host, for example courses.example.com. A subdomain is its own domain: add www.courses.example.com separately if you use it.
  3. Copy the TXT record we show you, and add it at your DNS provider.
  4. Click Verify. The status becomes Verified when the record is found.
Full detail: Accounts, projects, API keys and domains.

Step 4: Create an API key

  1. Open the project → API keys → Create key.
  2. Name it, and copy the secret (sk_...). We show it once.
Keep this key on your server. Never put it in a page.

Step 5: Upload a video

The fastest path is the dashboard: open the project, click Upload, and pick a short MP4. To upload from your own code, use the four calls in Direct upload. They send the file straight to storage with a pre-signed URL, so the file never passes through the API.

Step 6: Wait until the video is ready

We encode the video after the upload ends. Poll the video until status is ready:
Read status in the answer:
Note — the review hold is Coming soon. When the review hold is on, a free account’s first videos wait for review. Such a video can still report ready, but the playback-token call in Step 7 is refused with 409 video_not_ready. If that happens, read Moderation and held videos. The hold is off today, so a new free video is not held.

Step 7: Create a playback token

A playback token is a short, signed pass for one video on one domain. Create it on your server:
The answer is 201 and holds token, expiresAt and embedUrl. Keep the token value:
A token lives for 4 hours by default. For a real page, ask for a new token each time you show the video, from your server. See Create playback tokens on your server.

Step 8: Embed the video

Put this block on the page that you verified in Step 3. Replace vid_9xR4tL and the token with your own values:
Open your page. The video plays. That is your first protected video.

Step 9: Prove it is locked to your domain

Now try to use the video somewhere else. Ask for the video with a different origin — a site you did not verify:
The answer is 403 with the header X-Segmnt-Error: domain_mismatch. Ask with no token at all, and you get 403 token_missing:
The token is bound to your domain, so a copied link does not play anywhere else. This is the point of the product. Full detail: How playback protection works.

What you built

  • A project with a verified domain and an API key.
  • A video that we encoded to HLS.
  • A signed playback token for one video and one domain.
  • An embed that plays on your domain, and 403 off it.

Where to go next

Tested with the current release. The video events, tokens, domain lock and embed are the released API. If a step does not work for you, tell us which step and which answer you got.