Skip to main content

Before You Start

You’ll need a TMDB ID for the content you want to stream. Every movie and TV show on themoviedb.org has one — it’s the number in the URL.

Authenticate

The Vyla API supports two authentication methods — session tokens for browser apps, and API keys for server-side integrations. See Authentication for full details. Browser apps: your server calls POST /api/auth with a valid API key to receive a session token, then passes that token to the client. The client sends X-Session-Token on every request. Your API key never touches the browser. Server-side: send a standard or partner key as Authorization: Bearer <key> or X-API-Key: <key>.
The public key (public_api_key) can only access /api/health, /api/subtitles, and /api/downloads. Streaming endpoints (/movie, /tv, /api/test) require a standard or partner key, or a session token issued from one via POST /api/auth. POST /api/auth itself requires a valid API key of any tier.

Step 1 — Open the SSE Stream

The /movie and /tv endpoints are Server-Sent Events — not JSON. Open a streaming connection and handle three event types as they arrive: meta, source, and done.

Step 2 — Handle Events and Play

Parse each data: line as JSON and act on the type field. Start playback on the first source event — don’t wait for done.

Step 3 — Build a Fallback Queue

Sources stream in order of speed. Load the first one immediately and queue the rest — if one dies mid-stream, try the next.

Step 4 — Add Subtitles

Subtitles arrive in the meta event, before any source. Attach them to your video element immediately.

Check Provider Health

Before building, verify which providers are currently live. The health endpoint accepts any valid API key or session token.
status: "degraded" means at least one provider is down — the rest still work and your fallback queue handles it automatically.

Debug a Single Provider

Use /api/test to isolate a specific provider without running the full fanout. This endpoint requires a standard/partner key or session token.
Available provider keys are listed in the /api/health response under the sources field.

Full API Reference →

See complete SSE event docs for every endpoint.