The Streaming API provides two real-time communication channels — Server-Sent Events (SSE) for one-way server-to-client pushes and WebSocket for bidirectional messaging — plus a media proxy that streams video files directly from debrid providers. All SSE and proxy routes are prefixed withDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/rivenmedia/riven/llms.txt
Use this file to discover all available pages before exploring further.
/api/v1/stream; WebSocket routes use /api/v1/ws.
Server-Sent Events (SSE)
SSE lets a client maintain a long-lived HTTP connection and receive events as they occur on the server. Riven publishes events for log output, state changes, item completions, and more.GET /stream/event_types
List all currently registered event type names. The list grows as services start and register their topics.Array of event type name strings available to subscribe to.
GET /stream/
Subscribe to an event stream. The connection stays open and the server pushesdata: lines as events occur. Each data: line is a JSON string.
The event type to subscribe to. Must be one of the names returned by
GET /stream/event_types.Content-Type: text/event-stream. Standard auth headers are supported.
logging topic contains:
ISO 8601 datetime string of when the log record was created.
Log level:
DEBUG, INFO, WARNING, ERROR, or CRITICAL.The log message text.
Media proxy
Certain debrid providers require that media files be fetched through a server-side proxy rather than accessed directly by the client. Riven detects this automatically via thePROXY_REQUIRED_PROVIDERS list and routes those requests through the configured proxy.
GET /stream/file/
Stream a media file associated with a library item. Range requests (Range headers) are forwarded upstream, enabling seeking in video players. The MIME type is inferred from the file extension rather than relying on the provider’s Content-Type.
Internal database ID of the
MediaItem to stream.404 if the item does not exist, has no media entry, or has no valid stream URL. Returns 502 if the upstream debrid URL cannot be reached.
HLS transcoding
Riven can transcode media to HLS segments on the fly using FFmpeg. This is useful for clients that cannot play the source container directly.GET /stream/hls//index.m3u8
Generate an HLS playlist for the specified media item. Each segment references a/segment/{n}.ts endpoint.
Internal database ID of the media item.
FFmpeg pixel format (e.g.
yuv420p). Omit to keep the original.H.264 profile (e.g.
main, baseline). Omit to keep the original.H.264 level (e.g.
4.0). Omit to keep the original.Output resolution. Accepts
WIDTHxHEIGHT (e.g. 1280x720) or a height shorthand (e.g. 720). Omit to keep the original.GET /stream/hls//segment/.ts
Fetch a single HLS segment. FFmpeg seeks to the correct position and transcodes a 12-second chunk on demand.Internal database ID of the media item.
Zero-based segment sequence number.
FFmpeg pixel format.
H.264 profile.
H.264 level.
Output resolution.
video/mp2t.
WebSocket
The WebSocket endpoint provides real-time bidirectional communication. It publishes the same log events as the SSElogging stream and can be used by dashboard clients for live updates.
WS /ws/
Connect to a WebSocket topic. The server pushes JSON-encoded messages whenever an event is published on that topic.The topic to subscribe to (e.g.
logging).API key for authentication. WebSocket connections must use the query-parameter method — header-based auth is not supported for WebSocket upgrades.
logging topic is a JSON string with the same shape as the SSE logging events:
SSE vs WebSocket
| Feature | SSE (/stream/{type}) | WebSocket (/ws/{topic}) |
|---|---|---|
| Direction | Server → Client only | Bidirectional |
| Protocol | HTTP/1.1 keep-alive | WebSocket upgrade |
| Auth | Header or query param | Query param only |
| Browser support | EventSource API | WebSocket API |
| Reconnect | Automatic (browser) | Manual |
| Use case | Dashboards, log tailing | Interactive clients |