Skip to content
中文

Create a stream

Code Mode: praxis.media.streams.create

HTTP: POST /media/v1/streams

Register one live source and get its id; use it before anything else on this face, and use streams.update instead to change a stream you already have. Send input as {kind: pull, url} to have Praxis pull an https, http, rtmp or rtmps address (an HLS .m3u8 or HTTP-FLV playlist, or an RTMP URL; SRT is not supported and answers 400), or as {kind: push} to receive a push address: the response then carries push {url, token, expires_at}, and the token is shown only in this response and in streams.resetToken.create because only its hash is kept. For an encoder such as OBS send {kind: push, protocol: rtmp} (or srt): the response then carries push {protocol, url, stream_key} (srt: {protocol, url, stream_id, passphrase}), which you type into the encoder; the key is shown only in this response and never again, a stream read does not carry it, and there is no token to reset. The stream pulls what the encoder sends by itself, so it goes waiting at once and active a few seconds after the encoder connects; stopping and restarting the encoder inside reconnect_window_s continues the same broadcast. Turn recording on (recording.mode automatic) to keep the broadcast as an asset. A stream pushed over rtmp or srt cannot have outputs yet: streams.outputs.create answers 422 with OUTPUT_SOURCE_NOT_SUPPORTED. The answer shows the stream idle. A pull stream starts pulling as soon as it is created, so a read a few seconds later shows waiting or active; a push stream stays idle until a source connects. Nothing is charged until a source goes active. reconnect_window_s (0 to 1800, default 60) is how long a source that drops may come back and continue the same broadcast; max_continuous_duration_s (60 to 43200, default 43200) ends a broadcast that runs that long. recording defaults to off. The owner is your organization (and the agent and session when a session token calls); the body cannot set it and unknown fields answer 400. Example: {“input”:{“kind”:“pull”,“url”:“https://live.example.com/room/index.m3u8”},“recording”:{“mode”:“automatic”,“rendition”:“source”}}.

Signature

praxis.media.streams.create(args:{body:{input:{/** pull means Praxis pulls the address in url; push means your encoder or app sends to the push address returned when the stream is created. e.g. "pull" */ kind:"pull"|"push";/** Only for kind push; omit it for a push over the Praxis socket from a browser or app. e.g. "rtmp" */ protocol?:"rtmp"|"srt";/** The address to pull, present only when kind is pull: https, http (HLS .m3u8, HTTP-FLV) or rtmp, rtmps. e.g. "https://live.example.com/room/index.m3u8" */ url?:string};/** How many seconds a dropped source may take to come back and continue the same broadcast and recording; default 60. e.g. 60 */ reconnect_window_s?:number;/** How many seconds one broadcast may run before it ends as if the source had stopped (a source still live then starts the next broadcast); default and maximum 432 e.g. 43200 */ max_continuous_duration_s?:number;recording?:{/** automatic records every broadcast into a Media asset; off records nothing (the default). e.g. "off" */ mode?:"automatic"|"off";/** Which rendition to record: source keeps the stream as it arrives; highest, sd and lowest pick among the renditions the source offers; audio_only keeps no video. e.g. "source" */ rendition?:"source"|"highest"|"sd"|"lowest"|"audio_only";/** The Media library the recordings go to; omit to use the default library of your organization. */ library_id?:string;/** The folder inside the library the recordings are placed in; omit for the library root. */ asset_folder?:string;/** Delete each recording this many days after it was made; omit to keep recordings until you delete them. e.g. 30 */ delete_after_days?:number};playback?:{/** true keeps the newest segments of the broadcast readable so a player can follow it live (about a minute of media at a time); false (the default) keeps nothing f e.g. true */ enabled?:boolean};/** The id of the processing to run while the stream is active; the id of a pipeline of your organization (msp_ followed by 26 characters); an unknown one answers P */ pipeline_id?:(string)|null}}):Promise<({/** The stream id (mst_ and 26 lowercase base32 characters); stable and never reused. e.g. "mst_zpnqd7a2kxwg3vhr5tj4bfm6ec" */ id:string;/** Always media.stream; tells a stream from other objects in a mixed list. e.g. "media.stream" */ object:"media.stream";/** idle means no source is connected; waiting means a pulled source is not live yet (no failure and no charge beyond the poll); active means media is flowing and a e.g. "idle" */ status:"idle"|"waiting"|"active"|"disabled";input:{/** pull means Praxis pulls the address in url; push means your encoder or app sends to the push address returned when the stream is created. e.g. "pull" */ kind:"pull"|"push";/** Only for kind push; omit it for a push over the Praxis socket from a browser or app. e.g. "rtmp" */ protocol?:"rtmp"|"srt";/** The address to pull, present only when kind is pull: https, http (HLS .m3u8, HTTP-FLV) or rtmp, rtmps. e.g. "https://live.example.com/room/index.m3u8" */ url?:string};/** Seconds a dropped source may take to come back and continue the same broadcast. e.g. 60 */ reconnect_window_s:number;/** Seconds one broadcast may run before it ends. e.g. 43200 */ max_continuous_duration_s:number;recording:{/** automatic records every broadcast into a Media asset; off records nothing (the default). e.g. "off" */ mode?:"automatic"|"off";/** Which rendition to record: source keeps the stream as it arrives; highest, sd and lowest pick among the renditions the source offers; audio_only keeps no video. e.g. "source" */ rendition?:"source"|"highest"|"sd"|"lowest"|"audio_only";/** The Media library the recordings go to; omit to use the default library of your organization. */ library_id?:string;/** The folder inside the library the recordings are placed in; omit for the library root. */ asset_folder?:string;/** Delete each recording this many days after it was made; omit to keep recordings until you delete them. e.g. 30 */ delete_after_days?:number};playback?:{/** true keeps the newest segments of the broadcast readable so a player can follow it live (about a minute of media at a time); false (the default) keeps nothing f e.g. true */ enabled?:boolean};/** The processing attached to the stream, or null for none. */ pipeline_id:(string)|null;/** The Media asset the current broadcast is being recorded into, or null when no broadcast is recording. */ active_asset_id:(string)|null;/** The assets of the broadcasts before the current one, newest first. */ recent_asset_ids:Array<string>;/** The live health of the broadcast in progress; null unless the stream is active. */ health:(({/** Kilobits per second received over the last minute (bytes received over the media time they cover); null when no segment arrived in that minute. e.g. 2500 */ bitrate_kbps:(number)|null;/** Milliseconds from a segment's wall-clock start to the moment it was processed, averaged over the last minute. e.g. 1800 */ latency_ms:(number)|null;/** Segments the source skipped in this broadcast. e.g. 0 */ dropped_segments:number;/** Times the source dropped and came back inside the reconnect window in this broadcast. e.g. 1 */ reconnects:number;/** When the newest segment was processed, RFC 3339 UTC; null before the first segment of the broadcast. e.g. "2026-11-28T12:05:00.000Z" */ last_segment_at:(string)|null}))|null;usage:{/** The broadcast in progress; null unless the stream is active. */ broadcast:(({/** Seconds the stream was live, to the millisecond. e.g. 90.5 */ stream_seconds:number;/** Seconds of processing (pipeline processors and alert judgments) run for the stream, to the millisecond. e.g. 1.25 */ processor_seconds:number;/** Bytes recorded from the stream. e.g. 18500000 */ recorded_bytes:number}))|null;/** Across every broadcast of the stream. */ total:({/** Seconds the stream was live, to the millisecond. e.g. 90.5 */ stream_seconds:number;/** Seconds of processing (pipeline processors and alert judgments) run for the stream, to the millisecond. e.g. 1.25 */ processor_seconds:number;/** Bytes recorded from the stream. e.g. 18500000 */ recorded_bytes:number})};/** When the stream was created, RFC 3339 UTC. e.g. "2026-11-28T12:00:00.000Z" */ created_at:string;/** When the stream last changed (a setting or its status), RFC 3339 UTC. e.g. "2026-11-28T12:05:00.000Z" */ updated_at:string})&({push?:{/** Where to push: the WebSocket address of Praxis Realtime (it already carries the token as a query parameter), or the rtmps or srt server address of an encoder pu e.g. "wss://realtime.deepraxis.com/v1/media-streams/mst_zpnqd7a2kxwg3vhr5tj4bfm6ec/push?token=Zm9v" */ url:string;/** The capability token inside url, socket push only; keep it secret, only its hash is stored and it is shown only in this response. e.g. "Zm9vYmFy" */ token?:string;/** When the token stops working, RFC 3339 UTC, socket push only; call streams.resetToken.create for a new one. e.g. "2026-11-29T12:00:00.000Z" */ expires_at?:string;/** Encoder push only: rtmp means url and stream_key are an RTMPS address and key; srt means url, stream_id and passphrase are an SRT connection. e.g. "rtmp" */ protocol?:"rtmp"|"srt";/** RTMP push only: the stream key to type into the encoder after url; it is shown only in the response that creates the stream. e.g. "a1b2c3d4e5f60718293a4b5c6d7e8f90k1d2e3f4" */ stream_key?:string;/** SRT push only: the streamid of the connection; shown only in the response that creates the stream. e.g. "a1b2c3d4e5f60718293a4b5c6d7e8f90" */ stream_id?:string;/** SRT push only: the passphrase of the connection; shown only in the response that creates the stream. e.g. "k1d2e3f4a5b6c7d8e9f0a1b2c3d4e5f6" */ passphrase?:string}})>;

Request body

RequiredContent typesDescription
yesapplication/json

Responses

StatusContent typesDescription
201application/jsonThe stream, idle. A push stream also carries push; keep its token, it is not shown again by streams.retrieve.
400application/jsonA field is invalid: the error names it (for example input.url when the address is SRT or not https, http, rtmp or rtmps, or reconnect_window_s outside 0 to 1800). Correct that field and send again.
401application/jsonThe request carries no valid API key or session. Send a key of your organization.
404application/jsonMedia Streams is not released for your organization (flag media-streams-public is off). Ask the platform to enable it, or use another surface.
503application/jsonThis is a push stream and push is not available in this environment; create a pull stream, or retry later.