Publish a playlist's draft.
Publish the draft playlist as the new LIVE snapshot. Always async (ADR 0003): the resolver marks StreamState.processing_state as processing, signals PreparePlaylistWorkflow, and returns. Editor polls Playlist.publishStatus to observe the PREPARING -> IDLE / FAILED transition. Top-level errors carry extensions.code one of: STALE_DRAFT, EMPTY_PLAYLIST, BROKEN_ITEM, RECIPE_MISMATCH, NOT_LIVE, NOT_FOUND, INTERNAL.
Authorizations
OAuth 2.1 authorization-code flow with PKCE.
Headers
Optional client-generated key. A repeated request with the same key replays the original response (within 24h) instead of re-executing — safe retries.
Path Parameters
Resource identifier.
Body
Required (asymmetric vs ApplyPlaylistOperationsInput.basedOnVersion, which is optional). Publish is the ONLY user-action that mutates runtime state, so editor-side OCC must be deliberate (NB-07). On STALE_DRAFT the editor refetches Playlist { version diff } using the returned currentVersion and retries.
Response
Successful response.
Snapshot-vs-draft diff (B-13 first-occurrence-by-objectId
algorithm; zero-distance items go in unchanged, not moved;
duplicate objectIds matched positionally). When no snapshot exists,
diff = { unchanged: items, added: [], removed: [], moved: [] }.
snapshot != nil && Playlist.version > snapshot.version. Returns false during the B-11 STREAMING+no-snapshot window — deliberate: the stream is live but nothing has been published yet.
video, audio Projected from PlaylistSnapshot.items JSON (NB-12) — never FK-hydrated against the live PlaylistItem table. Empty list during the B-11 STREAMING+no-snapshot window.
PlaylistSnapshot.version — Playlist.version frozen at the last LIVE write. Returns 0 when no snapshot exists OR during the B-11 STREAMING+no-snapshot transient window (WriteInitialPlaylistSnapshot retry).
sequential, shuffle Workflow-state derivation. NB-13: PREPARING wins over PENDING even when a concurrent edit advances Playlist.version while a publish is preparing.
IDLE, PENDING, PREPARING, FAILED, NOT_LIVE Bumped by 1 per committed spec mutation batch. Used for optimistic concurrency and as the snapshot handle for PreparePlaylistWorkflow.