Appearance
Playback
All paths are under /v1. Responses use { data, meta }; errors are RFC 9457 problems with code. "User" means a platform access token; "Public" also accepts no token (guest).
Lease (one active device per account)
A device must hold the lease to fetch full manifests and keys. Claiming from another device increments the fencing token and sends playback:preempted to the account's sockets; the named device must pause. Heartbeat every heartbeatSeconds; the lease lapses after expiresInSeconds.
| Method | Path | Auth | Body | Response | Errors |
|---|---|---|---|---|---|
| POST | /playback/lease | User | { deviceId } | LeaseView | DEVICE_NOT_FOUND |
| POST | /playback/lease/heartbeat | User | { deviceId, fencingToken } | LeaseView | PLAYBACK_LEASE_STALE |
| POST | /playback/lease/release | User | { deviceId, fencingToken } | { status: "ok" } | — |
LeaseView: { deviceId, fencingToken, heartbeatSeconds, expiresInSeconds }.
Manifest and keys
| Method | Path | Auth | Query | Response | Errors |
|---|---|---|---|---|---|
| GET | /playback/manifest | Public | contentType (recording, video, episode, dj_set), contentId, deviceId?, fencingToken?, lossless? | ManifestView | PLAYBACK_CONTENT_NOT_FOUND, PLAYBACK_LEASE_REQUIRED, PLAYBACK_LEASE_STALE, RATE_LIMITED |
| GET | /playback/keys/:keyId | Public (preview) / User (full) | deviceId?, fencingToken? | 16 raw bytes, application/octet-stream | NOT_FOUND, PLAYBACK_NOT_ENTITLED (remedy subscribe), PLAYBACK_LEASE_REQUIRED, PLAYBACK_LEASE_STALE |
Guests and non-entitled users always get the 15 s preview rendition (reason: guest / not_entitled). Entitled users get the full rendition and must send the lease proof. lossless=true is honoured only when the plan includes it.
ManifestView: { contentType, contentId, rendition: "full"|"preview", reason, manifestUrl, expiresAt, keyUrl|null, durationMs, previewStartMs|null, previewDurationMs|null, codecs[], isLossless }. Cache-Control: no-store.
Event ingest
| Method | Path | Auth | Body | Response | Errors |
|---|---|---|---|---|---|
| POST | /playback/events | User | { deviceId, events: PlayEvent[1..200] } | 202 { accepted } | VALIDATION_FAILED, RATE_LIMITED |
PlayEvent: { playId (uuid, one per play of one item), sequence, type, clientTime, contentType, contentId, rendition, positionMs, context: { type, id|null }, fromPositionMs? (seek), listenedMs? (offline_play), bitrateKbps?, codec?, errorCode?, isOffline? }. Types: start, progress (every 10 s), pause, resume, seek, skip, complete, end, error, quality_change, offline_play. Context types: album, playlist, radio, together, search, moment, dj_set, artist, library, show, unknown. The country comes from the edge header (CF-IPCountry / X-Country-Code), never the body.
Events are queued (playback-ingest) and filed in monthly partitions of play_events. A play becomes a qualified stream once heard for min(30 s, duration / 3) of a full rendition; the listener's paid/trial state at play time is recorded with it. Retries and reordering are safe (playId + sequence).
Queue
| Method | Path | Auth | Body | Response | Errors |
|---|---|---|---|---|---|
| GET | /me/playback/queue | User | — | { queue: QueueView | null } | — |
| PUT | /me/playback/queue | User | { context, items: ContentRef[≤500], startIndex?, positionMs?, isShuffled? } | QueueView | PLAYBACK_QUEUE_TOO_LONG |
| PATCH | /me/playback/queue | User | any of { isShuffled, repeatMode (off/all/one), currentItemId, positionMs, crossfadeMs (0-12000), isAutomix } | QueueView | NOT_FOUND |
| POST | /me/playback/queue/items | User | { items: ContentRef[], placement: "next"|"end" } | QueueView | NOT_FOUND, PLAYBACK_QUEUE_TOO_LONG |
| DELETE | /me/playback/queue/items/:itemId | User | — | QueueView | NOT_FOUND |
| POST | /me/playback/queue/advance | User | { direction: "next"|"previous" } | QueueView | NOT_FOUND |
| POST | /playback/automix/plan | User | { recordingIds[2..51], crossfadeMs? } | { transitions: TransitionHint[] } | — |
QueueView.items are in play order (shuffle applied; user-queued items play right after the current one). TransitionHint: { fromRecordingId, toRecordingId, style: beatmatch|crossfade|cut, startAtMs, enterAtMs, crossfadeMs, tempoRatio, isKeyCompatible, gainDb }; pairs without analysis are omitted.
History
| Method | Path | Auth | Query / Body | Response |
|---|---|---|---|---|
| GET | /me/recently-played | User | cursor?, limit? | page of { contentType, contentId, context, playedAt, playCount } |
| GET | /me/resume-positions | User | items=episode:<id>,... (≤100) | { items: ResumePosition[] } |
| PUT | /me/resume-positions | User | { contentType, contentId, positionMs, durationMs, isCompleted? } | { status: "ok" } |
| GET | /me/continue-listening | User | limit? (≤50) | { items: ResumePosition[] } |
Resume positions are also written automatically from ingest for episodes and DJ sets.
Socket namespace /playback
| Direction | Event | Payload | Ack |
|---|---|---|---|
| client → server | lease:claim | { deviceId } | LeaseView |
| client → server | lease:heartbeat | { deviceId, fencingToken } | LeaseView or PLAYBACK_LEASE_STALE |
| client → server | lease:release | { deviceId, fencingToken } | { status: "ok" } |
| client → server | events:ingest | { deviceId, events } | { accepted } |
| server → client | playback:preempted | { deviceId, fencingToken, claimedByDeviceId, currentFencingToken } | room user:<id> |
| server → client | queue:updated | { version } | room user:<id> |
Clearing history
DELETE /me/recently-played and DELETE /me/recently-played/:contentType/:contentId clear the history list only. Qualified streams, charts and royalties are untouched.
Clearing history
DELETE /me/recently-played and DELETE /me/recently-played/:contentType/:contentId clear the history list only; qualified streams, charts and royalties stay.
Keys for AVPlayer
When GET /playback/manifest is called for a full rendition with deviceId and fencingToken, the playlist's EXT-X-KEY URI carries ?t=<signed proof> bound to that key, the person, the session and the lease, valid until the playlist expires. GET /playback/keys/:keyId?t=... then needs no header; the lease and entitlement are still checked. Without t, send the Bearer token and ?deviceId=&fencingToken= as before.