API Documentation

Streamix exposes a JSON REST API under /api/v1. The web client uses it for every interaction, and it is designed so a future mobile or TV app can use the same endpoints.

Live reference. The complete, always-current list is an OpenAPI spec generated from the route files. Signed-in admins can open it at /api/docs/v1 (Scalar UI; also in the admin sidebar as API Docs). The raw spec is /api/openapi.json, also admin-only. Regenerate it after adding or renaming routes with npm run gen:openapi.

This page explains the conventions and the main endpoints.

Conventions

Topic Rule
Format JSON in and out. Catalogue and playback endpoints wrap the payload as { data } (paginated lists add meta: { total, page, per_page, total_pages, sort }); small state changes return a flat object such as { in_my_list: true }. The generated spec shows each shape.
Errors { error: "message" } with a meaningful status: 400 validation, 401 not signed in, 402 no active plan, 403 not allowed, 404 not found, 409 conflict (no profile chosen, too many streams), 410 gone (stream ended elsewhere), 429 rate-limited.
Money Minor units (cents) with a currency code. The server always computes amounts.
Ids Titles are addressed by slug or public_id ({key}); profiles by public_id.

Authentication

  • Members: POST /api/v1/portal/auth/login sets an httpOnly member_session cookie (30 days, or a browser session when remember: false). The same JWT is also accepted as Authorization: Bearer <token>.
  • Active profile: chosen with POST /api/v1/profiles/{id}/select, which sets the sx_profile cookie. API clients can send X-Profile-Id: <public_id> instead. The profile is always checked against the signed-in account. Per-profile endpoints return 409 when no profile is selected.
  • Admins: admin_token cookie from /api/v1/admin/auth/login; each admin route checks a permission (requirePermission(action, resource)). Admin routes are not in the public spec.
  • Cron: /api/v1/cron needs Authorization: Bearer <CRON_SECRET> or ?key=<CRON_SECRET>.

Auth (/api/v1/portal/…)

Method & path Purpose
POST /portal/auth/check-email Does an account exist for this email (drives the sign-in/sign-up modal)
POST /portal/auth/register Create an account; sends a verification code
POST /portal/auth/verify-otp · POST /portal/auth/resend-verification Verify the email code
POST /portal/auth/login { email, password, remember?, captchaToken? }
POST /portal/auth/login-code → POST /portal/auth/login-code/verify Passwordless: 6-digit code by email, 15 min, 5 attempts. The response never reveals whether the email exists.
POST /portal/auth/forgot · POST /portal/auth/reset Password reset by code
GET /portal/auth/social/providers · GET /portal/auth/social/{provider}/start · …/callback Social sign-in (when a social add-on is connected)
POST /portal/auth/logout Sign out
GET /portal/me · PUT /portal/profile · POST /portal/change-password · GET/PUT /portal/notification-settings · POST /portal/delete-account Account basics

Catalogue

Method & path Purpose
GET /browse?page=home|tv|movies|kids|latest|genre&genre=<slug> Billboard and rows for the active profile
GET /browse/rows?page=…&cursor=<n>&limit=<n> Next batch of rows; returns { rows, next }
GET /titles/{key} Everything the title modal shows: synopsis, credits, seasons with episodes and progress, trailers, More Like This, and the profile's list/rating/reminder state. Public (no personal state when signed out).
GET /search?q= Titles by name, cast, genre or mood, filtered for the profile, plus related suggestions
GET /genres Genre tree
GET /avatars Avatar sets for the profile editor

Profiles

Method & path Purpose
GET /profiles · POST /profiles List or create (up to the admin's profile limit)
PATCH /profiles/{id} · DELETE /profiles/{id} Edit (name, avatar, kids, language, maturity, autoplay, subtitle style) or delete
POST /profiles/{id}/select Make active. Body { pin? }; PIN attempts are rate-limited.
PUT /profiles/{id}/pin { password, pin: "1234" | null } set or remove the lock (needs the account password)
GET/PUT/DELETE /profiles/{id}/blocked Titles blocked for the profile
GET/DELETE /profiles/{id}/ratings The profile's ratings

Per-profile state

Method & path Purpose
GET /my-list · PUT/DELETE /my-list/{key} My List
PUT /ratings/{key} { value: -1 | 1 | 2 | null } (not for me, I like this, love this, clear)
PUT/DELETE /reminders/{key} "Remind me" on a coming-soon title
DELETE /continue-watching/{key} Remove from Continue Watching (keeps the resume point)
GET/POST /notifications Bell notifications; mark as read
GET/DELETE /account/viewing-activity Viewing activity; hide entries

Playback

Method & path Purpose
GET /playback/{key} What to play: source (hls or mp4), MP4 fallback, thumbnails VTT, duration, resume position, intro/recap/credits markers, next episode, text and audio tracks, plan limits. Denied reasons: login, profile, subscribe, maturity, upcoming, no_video, not_found.
POST /playback/session Start a stream { title_id, episode_id?, device_key }. 409 { error: "too_many_streams", limit } when all screens are in use; 402 without a plan.
PATCH /playback/session Heartbeat { id, end? }. 410 when the session was ended elsewhere.
POST /playback/session-end End a session (used on page unload)
POST /playback/progress { title_id, episode_id?, position, duration, watched? } every ~10 s and on pause/exit

Billing and account

Method & path Purpose
POST /checkout/quote Price a plan with an optional coupon (display only; rate-limited)
POST /checkout/subscription Start a purchase: writes a pending subscription and transaction, returns the gateway's next step
POST /checkout/verify Capture and activate. Access is granted on capture, never on the return URL; idempotent.
POST /checkout/renew Pay for the next period (live, cancelled-but-running or on hold)
GET /member/subscription · DELETE /member/subscription Current subscription; cancel (runs to the end of the paid period)
GET /member/transactions · GET /member/invoice/{id} Payment history and invoice
POST /account/membership { action: "change", plan } switch plan now (new price from next payment) or { action: "restart" }
PUT /account/phone Mobile number
POST /account/sign-out-everywhere Sign out every device and end live streams
GET /account/export Personal data download (JSON)
POST /account/profile-transfer · POST /account/profile-transfer/redeem Issue or redeem a profile transfer code
GET/POST/DELETE /push/subscribe Web push: VAPID public key, subscribe, unsubscribe

Site content (public)

GET /brand, /pages/{slug}, /faqs, /blogs, /blogs/{slug}, /help, /help/categories/{slug}, /help/articles/{slug}, /help/search, POST /help/articles/{slug}/feedback, /languages, /countries, /currencies, /i18n/{code}, /app-version, and the forms POST /forms/contact, /forms/newsletter, /forms/enquiry.

Example: play a title

HTTP
POST /api/v1/profiles/<profile-public-id>/select
Content-Type: application/json

{ "pin": "1234" }
HTTP
GET /api/v1/playback/<title-slug>
HTTP
POST /api/v1/playback/session
Content-Type: application/json

{ "title_id": 42, "device_key": "<random-device-key>" }

Then send PATCH /api/v1/playback/session heartbeats and POST /api/v1/playback/progress while playing.

Adding an endpoint

Follow the route shape in the Developer Guide: auth first, validate input, scope queries to the caller, ok()/err(). Then run npm run gen:openapi and add request/response examples for important endpoints in the generator's OVERRIDES.


© CreativeCape Solutions · creative-cape.com · support@creative-cape.com