Skip to content
中文

Add a re-broadcast target to a stream

Code Mode: praxis.media.streams.outputs.create

HTTP: POST /media/v1/streams/{stream_id}/outputs

Re-broadcast a live stream to another service (simulcast): give the target’s RTMP address in url and its stream key in stream_key, and every broadcast of this stream is also sent there, without transcoding, while the stream is active. Use it to feed YouTube, Twitch or your own RTMP server from one source; to follow what the target does read streams.events.list for output.status events, and use streams.outputs.retrieve for its current status. url must be rtmp:// or rtmps:// on a public host and name the application (rtmp://a.rtmp.youtube.com/live2); the key is write-only, it is never returned, a read only says stream_key_set is true. A stream has at most 5 outputs. A new output is idle and starts with the next broadcast, or at once when the stream is active. One output that is slow or down never affects the others, the recording or the pipeline. Example: {“url”:“rtmps://live.example.com:443/app”,“stream_key”:“live_abc123”}.

Signature

praxis.media.streams.outputs.create(args:{path:{/** e.g. "mst_zpnqd7a2kxwg3vhr5tj4bfm6ec" */ stream_id:string};body:{/** The target's RTMP address with its application: rtmp:// or rtmps://, a public host, no user or password. e.g. "rtmps://live.example.com:443/app" */ url:string;/** The key the target gave you for this stream, at most 512 characters without spaces; it is stored and never returned. e.g. "live_abc123" */ stream_key:string}}):Promise<{/** The output id (mso_ and 26 lowercase base32 characters); stable and never reused. e.g. "mso_zpnqd7a2kxwg3vhr5tj4bfm6ec" */ id:string;/** Always media.stream.output. e.g. "media.stream.output" */ object:"media.stream.output";/** The target's RTMP address with its application, rtmp:// or rtmps://; the stream key is not part of it. e.g. "rtmps://live.example.com:443/app" */ url:string;/** Always true: the key is write-only and never returned; send a new stream_key with streams.outputs.update to change it. e.g. true */ stream_key_set:true;/** idle means the stream is not live; starting means connecting, or waiting to try again (1 s, then longer up to 60 s); broadcasting means the target accepted the e.g. "broadcasting" */ status:"idle"|"starting"|"broadcasting"|"errored";/** Why the last connection failed, while the output is errored or starting again after a failure; null in every other status. */ error:(({/** OUTPUT_CONNECT_FAILED: the target could not be reached or refused the connection; OUTPUT_TARGET_UNREACHABLE_FROM_PLATFORM: the target is on the Cloudflare netwo e.g. "OUTPUT_PUBLISH_REJECTED" */ code:"OUTPUT_CONNECT_FAILED"|"OUTPUT_TARGET_UNREACHABLE_FROM_PLATFORM"|"OUTPUT_PUBLISH_REJECTED"|"OUTPUT_CONNECTION_LOST"|"OUTPUT_TARGET_FORBIDDEN"|"OUTPUT_UNSUPPORTED_MEDIA";/** A sentence saying what the target answered. e.g. "the target refused the stream: NetStream.Publish.BadName" */ message:string}))|null;/** When the output was created, RFC 3339 UTC. e.g. "2026-11-28T12:00:00.000Z" */ created_at:string;/** When the output last changed (a setting or its status), RFC 3339 UTC. e.g. "2026-11-28T12:05:00.000Z" */ updated_at:string}>;

Parameters

NameInTypeRequiredDescription
stream_idpathstringyesThe stream’s id, the id field returned by streams.create or streams.list (mst_ followed by 26 lowercase base32 characters); a stream of another organization answers 404.

Request body

RequiredContent typesDescription
yesapplication/json

Responses

StatusContent typesDescription
201application/jsonThe output, idle or starting.
400application/jsonA field is invalid (the error names it: url that is not rtmp or rtmps, names a private host or has no application, or a stream_key with spaces). Correct it and send again.
404application/jsonNo stream with this id in your organization, or Media Streams is not released for it.
422application/jsonThe stream is pushed over rtmp or srt and its segments are fMP4, which outputs cannot re-send yet (code OUTPUT_SOURCE_NOT_SUPPORTED).
429application/jsonThe stream already has 5 outputs (code OUTPUT_LIMIT_REACHED). Delete one with streams.outputs.delete first.