StreamDRM documentation
How to connect your storage, add files, embed the player, issue tickets and passes from your own system, and receive webhooks.
1. Quickstart
The player decrypts in the browser and draws each frame and page itself, adding the viewer's invisible mark. Files are encrypted with AES-256-GCM, and their keys are wrapped under your account's key, which is wrapped under the server's master key.
- Connect your storage. In the Studio, open Storage and choose Connect storage. Encrypted files are written to, and played from, your own bucket. We charge no bandwidth fee.
- Add a file. Upload a video, PDF or image (up to 250 MB) in the Studio, or register a file that is already in your storage with
POST /v1/assets. Accepted: MP4, MOV, M4V, PDF, PNG, JPEG, WebP. - Show it to a viewer. Your server mints a single-use ticket (or a personal pass) for that viewer, and your page loads the player with it. See Embed the player.
2. Connect storage
StreamDRM does not resell playback bandwidth: encrypted files are served from your own storage. Three connection types are supported.
| Connection type | Works with | Notes |
|---|---|---|
S3-compatible (s3) |
Cloudflare R2, Backblaze B2, Amazon S3, Wasabi, MinIO | R2 has no egress fee; B2 egress is free when served through Cloudflare. |
pCloud (pcloud) |
pCloud accounts, including lifetime plans | Connect with a pCloud access token. |
Publitio (publitio) |
Publitio accounts | Connect with your Publitio API key and secret; files stay on Publitio's CDN. |
When you save a connection, StreamDRM checks that it can read and write (the check gives up after 12 seconds) and tells you which step failed if it cannot.
3. Embed the player
Mint a ticket or pass on your server (never in the browser), then place a container and the loader on your page. The loader removes the ticket from the page as soon as it runs and hands it to the player over an origin-locked postMessage.
<div data-sdrm-embed
data-player-url="https://streamdrm.com/p/ten_<your tenant id>/player.html"
data-ticket="TICKET_FROM_YOUR_SERVER"></div>
<script src="https://streamdrm.com/embed.js" defer></script>
Other attributes: data-pass (a personal pass instead of a ticket), data-tenant (instead of data-player-url), data-width and data-height. The Studio shows this snippet with your own player URL. The player only opens on the sites you allow (your account's allowed origins).
4. WordPress and WooCommerce
The plugin works with any WordPress site and has built-in WooCommerce support. On membership or course plugins (MemberPress, LearnDash and similar), paste the shortcode on a lesson page; access to that page is still decided by your membership plugin.
- Download
streamdrm-embed.zip, then in WordPress go to Plugins > Add New > Upload Plugin and activate it. - Under Settings > StreamDRM, fill in StreamDRM Server URL (
https://streamdrm.com), Tenant ID (ten_…) and Tenant API Key (sdrm_live_…).
Shortcode, for logged-in pages:
[streamdrm asset="ast_<32 hex>" width="100%" height="540px"]
For each logged-in viewer, WordPress calls POST /v1/tickets from the server. The viewer reference is their email, or wp_user_{ID} with the privacy setting on, so marks carry no email address. The ticket reaches the player by postMessage; mode="url" puts it in the player URL instead.
WooCommerce, for paid products and PDFs: enter the StreamDRM Asset ID / Ref on a Simple product (Product data > General) or on each variation (a variation without one uses the parent's). When an order reaches Completed (or Processing, if you choose), the plugin calls POST /v1/passes and shows the buyer's personal link on the order page and in My Account; it can also add it to the order email. A refunded or cancelled order calls POST /v1/passes/{id}/revoke.
5. API authentication
Every tenant call carries your API key:
Authorization: Bearer sdrm_live_<16 hex>_<43 characters>
Keys can be scoped (for example a detect-only key for leak checks). IDs are a prefix plus 32 hex characters: ten_, ast_, con_, pas_.
6. Assets
Register a file that is already in a connected storage, and package it. Packaging needs an Idempotency-Key header.
POST https://streamdrm.com/v1/assets
Authorization: Bearer sdrm_live_…
Idempotency-Key: 2f0c6c1e-module-3
Content-Type: application/json
{
"kind": "video",
"title": "Module 3: Advanced analysis",
"source": {
"connection_id": "con_<32 hex>",
"key": "raw/module3.mp4"
},
"package": true
}
When packaging finishes, the asset.ready webhook fires.
7. Playback tickets
When a signed-in viewer opens a lesson, your server mints a single-use ticket. Give exactly one of asset_id or asset_ref; ttl_s is 60 to 300.
POST https://streamdrm.com/v1/tickets
Content-Type: application/json
{
"user_ref": "user_9482",
"asset_id": "ast_<32 hex>",
"ttl_s": 120
}
Response:
{
"ticket": "v4.public.…",
"jti": "tkt_…",
"expires_at": 1794538120000,
"player_url": "https://streamdrm.com/p/ten_…/player.html"
}
expires_at is in milliseconds. The ticket is a signed PASETO v4 token.
8. Viewer passes
A pass is a personal link for one buyer or student that works without an account, on a limited number of devices, until it expires or you revoke it.
POST https://streamdrm.com/v1/passes
Content-Type: application/json
{
"email": "buyer@example.com",
"asset_id": "ast_<32 hex>",
"max_devices": 3,
"expires_in_hours": 336
}
Use external_ref instead of email to keep email addresses out of StreamDRM. For many buyers at once, send recipients (a list of the same fields) or csv. The response includes each pass's pass_url. GET /v1/passes lists them; POST /v1/passes/{id}/revoke ends one and its sessions.
9. OEM and partner API
Platforms and media hosts that offer StreamDRM to their own customers use a partner key (Authorization: Bearer sdrm_partner_…) to create one isolated sub-tenant per customer, manage it, and read its usage.
Check your partner account: GET /v1/partner returns partner (with status and default_plan) and tenant_count, the number of sub-tenants.
Create a customer. Each sub-tenant gets its own keys and its own watermark code.
POST https://streamdrm.com/v1/partner/tenants
Authorization: Bearer sdrm_partner_…
Content-Type: application/json
{
"name": "Acme Coaching",
"external_customer_id": "cust_acme_42",
"plan": "oem",
"email": "owner@acmecoaching.example",
"origins": ["https://courses.acmecoaching.example"],
"api_key_label": "platform-prod"
}
- Your backend runs it (headless): use the
sdrm_live_…key in the response to add storage, register assets, mint tickets and run leak checks for that customer. - The customer signs in too (co-managed): with
emailset, the customer can sign in at /portal.html with a 6-digit email code, without touching your keys. Or callPOST /v1/partner/tenants/{id}/setup-linkfor a single-use onboarding link valid for 14 days (https://streamdrm.com/setup#t=…). Send"issue_api_key": falseif the customer will claim their key through that link.
Look up and change customers:
GET /v1/partner/tenants(filter with?external_customer_id=…) andGET /v1/partner/tenants/{id}.PATCH /v1/partner/tenants/{id}:status(activeorsuspended),plan,email, ororigins. New origins take effect at once in the player'sframe-ancestorspolicy.
Customer API keys:
GET /v1/partner/tenants/{id}/api-keyslists integration keys (short-lived sign-in keys are not listed).POST /v1/partner/tenants/{id}/api-keysissues a key, scoped or full;"rotate_oldest": trueretires the oldest at the same time.DELETE /v1/partner/tenants/{id}/api-keys/{key_id}revokes a key at once.
Usage: GET /v1/partner/usage and GET /v1/partner/tenants/{id}/usage, over ?since_ms=…&until_ms=…, return totals and per-customer customers[] with assets, ready_assets, storage_bytes, sessions, unique_viewers and key_releases.
Suspension: suspending a partner or a sub-tenant blocks setup links, API calls, new tickets and key releases straight away, with 403 SD-AUTH-04.
Leak tracing: scoped forensics:detect partner tenant keys call POST /v1/forensics/detect. See Forensics API for multipart fields, frame caps and async polling.
10. Webhooks
StreamDRM sends signed HTTP POST requests. Each carries SDRM-Signature (t=<unix seconds>,v1=<hex HMAC-SHA256 of t + "." + body>), SDRM-Event and SDRM-Webhook-Id. Reject a request whose time is more than 5 minutes off. A failed delivery is retried up to 6 times over about 9 hours.
Events sent today:
asset.ready: packaging finished.asset.rekeyed: the asset's keys were rotated.job.succeededandjob.failed: a background job finished.security.probe: the player reported a capture or tampering attempt.user.strikeanduser.locked: a viewer received a strike, or reached the strike limit (see below).
// user.locked
{
"id": "evt_<32 hex>",
"type": "user.locked",
"created": 1794538090000,
"tenant_id": "ten_…",
"data": {
"user_ref": "user_9482",
"reason": "rip_probe",
"strike_count": 3,
"strike_limit": 3,
"session_id": "…",
"revoked_sessions": 1,
"locked_at": 1794538090000,
"unblock_path": "/v1/users/user_9482/unblock"
}
}
11. Strike lockout
The player reports attempts to copy what it shows: canvas or media capture calls (captureStream, toDataURL, toBlob), elements injected into the player page by extensions, and the keyboard shortcuts that open developer tools or save the page. On a capture call, playback pauses and the call fails.
Each report is a strike. At the limit (3 by default; 1 to 10, set per account or per asset with strike_limit) the viewer, their network and their device are locked and their live sessions end. The lock has no expiry; you lift it with POST /v1/users/{ref}/unblock or in the Studio.
No browser can stop a screen recorder or a camera pointed at the screen. Those copies are traced by the invisible mark instead.
12. Checking a leak
If a clip or screenshot of your content turns up on Telegram, Discord or YouTube:
- Open the leak check with a detect-only key, or use Find a leak in the Studio.
- Add a screenshot, several screenshots, a phone photo of a document or chart, or a screen recording. The leak-check tool samples up to 96 frames from a video.
- The server reads the mark and names the viewing session. Camera perspective and multi-page searches take roughly 30 to 110 seconds.
Full frames and clear crops trace best; in our tests, phone photos of PDFs, charts and images also traced cleanly, while a single phone photo of a playing video frame or heavy screen glare can still return no match. A match is not proof on its own: check it against the visible code, the asset and the time.
13. Forensics API
Trace leaked screenshots, cropped figures, phone photos or sampled video frames server-side with a tenant key holding scope forensics:detect (a read-only detection scope that cannot create assets or mint playback tickets). History queries require scope tenant:read.
POST /v1/forensics/detect(forensics:detect): run watermark attribution on 1 to 96 uploaded frames.GET /v1/forensics/detect/{id}(forensics:detect, same API key): poll an asynchronous detection started withPrefer: respond-async. Returns202 Acceptedwhile running or200 OKwithDetectResponsewhen finished (kept for 1 hour).GET /v1/forensics/whoami(forensics:detect): verify the key'stenant_idand grantedscopes.GET /v1/forensics/detectionsandGET /v1/forensics/detections/{id}(tenant:read): list and inspect persisted detection records.
Multipart request (multipart/form-data):
meta(optional, must appear beforeframeparts, max4 KiBJSON): supportsasset_id(ast_…, speeds up and tightens page/figure search),label(printable ASCII up to 80 chars), andsource("video","screenshots","photos", or"export").asset_id(optional plain text field): shorthand when calling fromcurl -F "asset_id=ast_…"instead of JSONmeta(must match if both are supplied).frame(1 to 96 parts):image/png,image/jpeg, orapplication/x-sdrm-luma8. Each frame must be at most 4096 px on either side, 8,388,608 decoded pixels (8.38 MP, e.g.3840×2160), and 8 MiB encoded. Total request body is capped at 48 MiB (clients split batches around36 MiB). Downscale 12 MP+ camera photos and 5K screenshots inside these bounds before uploading; JPEG EXIF orientation is applied automatically on the server.
Async mode (recommended behind Cloudflare): camera perspective and multi-page searches often run 30 to 110 seconds, which can exceed Cloudflare's ~100 second origin timeout on a synchronous POST. Send Prefer: respond-async to receive an immediate 202 Accepted and poll poll every 2 to 3 seconds with the same key:
curl -sS -X POST https://streamdrm.com/v1/forensics/detect \
-H "Authorization: Bearer sdrm_live_…" \
-H "Prefer: respond-async" \
-F 'meta={"asset_id":"ast_…","source":"photos"};type=application/json' \
-F "[email protected];type=image/jpeg"
202 Accepted response:
{
"id": "fcs_<32 hex>",
"state": "running",
"poll": "/v1/forensics/detect/fcs_<32 hex>"
}
200 OK DetectResponse (sync or finished poll):
{
"id": "fcs_<32 hex>",
"verdict": "match",
"confidence": 0.9999999999999996,
"false_match_probability": 3.89e-16,
"tenant_false_match_bound": 3.89e-16,
"sync_strength": 18.4,
"attempts": 1852,
"frames_received": 1,
"frames_used": 1,
"frames_skipped": 0,
"match": {
"session_id": "ses_<32 hex>",
"user_ref": "alice@example.com",
"asset_id": "ast_<32 hex>",
"asset_kind": "pdf",
"session_created_at": 1794538000000,
"session_last_seen_at": 1794538420000,
"key_epoch": 1,
"visible_text": "ZNM6-D3TQ",
"support_ref": "sup_…",
"score": 18.4,
"sync_z": 9.8,
"data_z": 8.6
},
"secondary_marks": 0,
"corroborate": ["visible_code", "asset", "time_window"],
"notice": "A match shows that this session's invisible mark is in the capture. It is not proof of who leaked it: a mark can be copied onto other content. Before anyone is accused, check the visible code, the asset and the time window.",
"elapsed_ms": 42150,
"created_at": 1794539100000
}
verdict is "match", "no_match", or "inconclusive" (with optional reason: "multiple_marks", "asset_mismatch", "expired_mark", "unverified", or "time_limit"). Errors: 400 SD-WM-02 (invalid/oversized frame or meta), 408 SD-WM-06 (upload slower than 256 KiB/s), 413 SD-WM-03 (too many frames or > 48 MiB body), 429 SD-RATE-02 (4-request burst refilling 1 per 5 min per key, 1 concurrent check per tenant, or 200 checks / 1,800 CPU-seconds per UTC day), and 503 SD-WM-04 (retry after Retry-After).