Skip to main content
This guide puts a segmnt video inside a WordPress page. It works with the Gutenberg editor and any theme. You use a Custom HTML block, and the video’s playback token comes from your server.
The examples use the TEST hosts. In production the API host is api.segmnt.cloud and the embed host is cdn.segmnt.cloud.

What you need

  1. A ready segmnt video (vid_...).
  2. A verified domain: the WordPress site’s own domain, for example blog.example.com or courses.example.com. If WordPress is at www.example.com, verify www.example.com too, because we match the exact host. See Accounts, projects, API keys and domains.
  3. A playback token for that video. Your server makes it; see below.

Step 1: Add a Custom HTML block

  1. Edit the page in WordPress.
  2. Click +, search for Custom HTML, and add the block.
  3. Paste this, and replace vid_9xR4tL with your video id and YOUR_PLAYBACK_TOKEN with a real token:
  1. Preview the page. The video plays on the preview domain only if that domain is verified and the token was made for it.

Step 2: Where the token comes from

A token expires (4 hours by default), so pasting one token into the block is only good for a short test. For a real page, the token must be fresh on each page load. There are two ways.

Option A: A quick test (paste a token by hand)

Make a token once from your server with the playback-tokens call, paste it into the block, and preview the page. This is fine to check the setup. It stops playing when the token expires.
Copy the token value from the answer. See Create playback tokens on your server. WordPress runs on PHP on your server, so it can call our API and print the iframe with a fresh token. Add a small shortcode to your theme or a small plugin, then use [segmnt video="vid_9xR4tL"] in any page (or keep the Custom HTML block and paste the built HTML). Keep the API key in wp-config.php, never in a page or the block:
Then in the page use the shortcode block:
Notes:
  • The shortcode runs in PHP on your server, so the API key never reaches the browser.
  • WordPress caches pages. If your site serves cached HTML, keep the token’s life longer than the cache (for example expiresInSeconds of 6 hours for a 4-hour page cache), or refresh the cache before the token expires.
  • If the page is public and long-lived, a short token is safer. Ask for a new token per page load, and do not cache the HTML that holds it.

Common problems

Where to go next

Tested in TEST

Checked on TEST on 15 Oct 2026:
  • The embed host serves the player: GET /e/{videoId} with no token → 403 token_missing; GET /segmnt-player.js → 200.
  • The playback-tokens route is live: with no key it answers 401 unauthorized.
  • The WordPress shortcode uses the public WordPress HTTP API (wp_remote_post), the same call as the cURL example, which is covered by api/src/playback-tokens.test.ts.