External Integrations

Ads Platform External Documentation

Minimal integration documentation for authentication, screen-first device binding, runtime device endpoints, API keys, and operational errors.

What This Covers

This is the canonical external docs surface for the current platform implementation in apps/api. It is intentionally minimal and implementation-truthful.

Quickstart

  1. 1.Create venue and screen in tenant context (/v1/venues, /v1/screens).
  2. 2.Generate screen-bound provisioning code with POST /v1/devices/provisioning-codes.
  3. 3.Enter pairing code in the TV app and register via POST /devices/register.
  4. 4.Persist one-time dak_ key on device and call runtime endpoints with Bearer auth.
  5. 5.Monitor status/errors via provisioning status checks and X-Request-ID correlation IDs.

Minimal Endpoint Surface

MethodPathAuthSummary
POST/devices/registerPublic (no auth header)Registers a TV device from a provisioning code and returns a one-time device API key.
GET/devices/:id/playlistDevice API key (dak_) in Authorization headerReturns active playlist (Turso, on-demand, or R2 fallback) for the authenticated device context.
GET/devices/:id/configDevice API key (dak_) in Authorization headerReturns device config or a default config payload with HTTP 200 when no custom config exists.
POST/devices/:id/eventsDevice API key (dak_) in Authorization headerAccepts 1-100 telemetry events and returns accepted count.
POST/v1/devices/provisioning-codesClerk JWT (tenant-scoped)Generates a screen-bound pairing code for device onboarding.
GET/v1/devices/provisioning-codes/:code/statusClerk JWT (tenant-scoped or platform-admin scoped read)Returns pending/activated/expired status plus screen and optional device reference.
POST/v1/devices/:id/revokeClerk JWT (tenant-scoped)Suspends a bound device, revokes active device keys, and resets screen to provisioning.
GET/v1/api-keysClerk JWT (tenant-scoped)Lists tenant machine API keys (prefix, status, usage metadata).
POST/v1/api-keysClerk JWT + role tenant_admin|super_adminCreates tenant API key and returns one-time key material.
POST/v1/api-keys/:id/rotateClerk JWT + role tenant_admin|super_adminRotates key hash/prefix and returns new one-time key material.
POST/v1/api-keys/:id/revokeClerk JWT + role tenant_admin|super_adminMarks tenant API key as revoked.

System Context

Architecture context is available in Architecture Context.