Configure Cloudflare Stream signed URL tokens with per-viewer accessRules (IP and country) and a downloadable flag for token-gated playback
domain: developers.cloudflare.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
Create a signing key via the Stream API or dashboard and keep the private key on your server only, never exposed to clients
On your backend, mint a signed Stream token for the video UID with an explicit exp claim, since calling the token endpoint with no body returns a token that defaults to a short (about one hour) expiry with no other restrictions
Add an accessRules array to scope the token to specific IPs, IP ranges, or countries; rules are evaluated in order and the first matching rule's allow/block action applies, so put the most specific rule first
Set downloadable to true only when you intend to expose the signed MP4 download link for that token - it has no effect unless requireSignedURLs is also enabled on the video
Enable requireSignedURLs on the video itself so unsigned playback requests are rejected
Serve the resulting token to the authenticated viewer and build the manifest URL as https://customer-code.cloudflarestream.com/{token}/manifest/video.m3u8
Known gotchas
Forgetting to set exp explicitly leaves you with the default short-lived token, which will unexpectedly cut off long viewing sessions
The downloadable flag only enables a download link when requireSignedURLs is on and the flag is present in that specific token - it is not a video-level setting
accessRules rely on Cloudflare's edge-detected IP/geolocation, which can misclassify users on corporate VPNs or mobile carrier NAT, causing false blocks
Give your agent this knowledge — and 15,500+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?