Zyflix
● Get started

Quickstart

Three calls to a working vertical feed in the sandbox: exchange a session token on your server, initialise the SDK, mount the feed.

Before you start

  • Sandbox API key and HMAC secret, stored in env or a KMS
  • A backend route your app can call while a viewer is signed in
  • An anonymous, stable ID for each viewer and each device. IDs that look like an email address or phone number are rejected; never send names

1Exchange a session token

This is the only backend endpoint the feed needs. Your server signs POST /v1/session/launch and returns the session token and capabilities to your client. Wallet unlocks also need your wallet callbacks and a signed unlock request from your server. The Node SDK has zero dependencies; other languages implement the signing spec.

import { ZyflixServerClient } from '@zyflix/sdk-node';

const zyflix = new ZyflixServerClient({ baseUrl, apiKey, secret });  // env or KMS

app.get('/api/zyflix/session', requireLogin, async (req, res) => {
  res.json(await zyflix.launchSession({
    hostUserId: req.user.anonymousId,  // never email or phone
    deviceId: req.get('x-device-id'),   // stable per device
    language: req.user.locale,
    region: req.user.country,
  }));
});

2Initialise the SDK

Render from the returned capabilities. Where wallet_unlock is false, the market does not allow wallet charges for digital content, so offer ad_unlock or your own IAP.

import { Zyflix } from '@zyflix/sdk-web';
import Hls from 'hls.js';

// Non-2xx throws with its status: the SDK retries 5xx and stops on 401
const fetchSession = async () => {
  const r = await fetch('/api/zyflix/session', { headers: { 'x-device-id': deviceId } });
  if (!r.ok) throw Object.assign(new Error(`session ${r.status}`), { status: r.status });
  return r.json();
};
const session = await fetchSession();

const zy = await Zyflix.init({
  baseUrl,  // configured API origin
  sessionToken: session.session_token,
  capabilities: session.capabilities,
  language: session.language,
  preset: 'verticalFeed',
  hlsFactory: () => new Hls(),          // hls.js, where HLS is not native
  onSessionExpired: async () => (await fetchSession()).session_token,
});
Session tokens last two hours and belong to one viewer: a leaked token lets someone browse and play as that viewer until it expires. Keep wallet signing on (the default for new hosts). With signing on, a leaked token alone cannot spend money. With it off, a leaked token can spend up to the viewer’s daily cap in each UTC day — up to twice the cap if its two hours span midnight UTC — or the viewer’s whole wallet balance if no cap is set. The HMAC secret never leaves your backend.

3Mount the feed

One call renders the vertical swipe feed with autoplay, telemetry, paywall, favourite and share, the EU DSA report entry and the AI-generated label. To build your own UI, use the feed, player and paywall controllers instead.

await zy.mountFeed(document.getElementById('drama-feed'));
Last updated 24 Nov 2026 · SDK 0.2.0 (pre-release)