# Live Inputs ## List live inputs `stream.live_inputs.list(LiveInputListParams**kwargs) -> LiveInputListResponse` **get** `/accounts/{account_id}/stream/live_inputs` Lists the live inputs created for an account. To get the credentials needed to stream to a specific live input, request a single live input. ### Parameters - `account_id: str` Identifier. - `include_counts: Optional[bool]` Includes the total number of videos associated with the submitted query parameters. ### Returns - `class LiveInputListResponse: …` - `live_inputs: Optional[List[LiveInput]]` - `created: Optional[datetime]` The date and time the live input was created. - `delete_recording_after_days: Optional[float]` Indicates the number of days after which the live inputs recordings will be deleted. When a stream completes and the recording is ready, the value is used to calculate a scheduled deletion date for that recording. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. - `enabled: Optional[bool]` Indicates whether the live input is enabled and can accept streams. - `meta: Optional[object]` A user modifiable key-value store used to reference other systems of record for managing live inputs. - `modified: Optional[datetime]` The date and time the live input was last modified. - `uid: Optional[str]` A unique identifier for a live input. - `range: Optional[int]` The total number of remaining live inputs based on cursor position. - `total: Optional[int]` The total number of live inputs that match the provided filters. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) live_inputs = client.stream.live_inputs.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(live_inputs.live_inputs) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "liveInputs": [ { "created": "2014-01-02T02:20:00Z", "deleteRecordingAfterDays": 45, "enabled": true, "meta": { "name": "test stream 1" }, "modified": "2014-01-02T02:20:00Z", "uid": "66be4bf738797e01e1fca35a7bdecdcd" } ], "range": 1000, "total": 35586 } } ``` ## Retrieve a live input `stream.live_inputs.get(strlive_input_identifier, LiveInputGetParams**kwargs) -> LiveInput` **get** `/accounts/{account_id}/stream/live_inputs/{live_input_identifier}` Retrieves details of an existing live input. ### Parameters - `account_id: str` Identifier. - `live_input_identifier: str` A unique identifier for a live input. ### Returns - `class LiveInput: …` Details about a live input. - `created: Optional[datetime]` The date and time the live input was created. - `delete_recording_after_days: Optional[float]` Indicates the number of days after which the live inputs recordings will be deleted. When a stream completes and the recording is ready, the value is used to calculate a scheduled deletion date for that recording. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. - `enabled: Optional[bool]` Indicates whether the live input is enabled and can accept streams. - `meta: Optional[object]` A user modifiable key-value store used to reference other systems of record for managing live inputs. - `modified: Optional[datetime]` The date and time the live input was last modified. - `recording: Optional[Recording]` Records the input to a Cloudflare Stream video. Behavior depends on the mode. In most cases, the video will initially be viewable as a live video and transition to on-demand after a condition is satisfied. - `allowed_origins: Optional[List[str]]` Lists the origins allowed to display videos created with this input. Enter allowed origin domains in an array and use `*` for wildcard subdomains. An empty array allows videos to be viewed on any origin. - `hide_live_viewer_count: Optional[bool]` Disables reporting the number of live viewers when this property is set to `true`. - `mode: Optional[Literal["off", "automatic"]]` Specifies the recording behavior for the live input. Set this value to `off` to prevent a recording. Set the value to `automatic` to begin a recording and transition to on-demand after Stream Live stops receiving input. - `"off"` - `"automatic"` - `require_signed_urls: Optional[bool]` Indicates if a video using the live input has the `requireSignedURLs` property set. Also enforces access controls on any video recording of the livestream with the live input. - `timeout_seconds: Optional[int]` Determines the amount of time a live input configured in `automatic` mode should wait before a recording transitions from live to on-demand. `0` is recommended for most use cases and indicates the platform default should be used. - `rtmps: Optional[Rtmps]` Details for streaming to an live input using RTMPS. - `stream_key: Optional[str]` The secret key to use when streaming via RTMPS to a live input. - `url: Optional[str]` The RTMPS URL you provide to the broadcaster, which they stream live video to. - `rtmps_playback: Optional[RtmpsPlayback]` Details for playback from an live input using RTMPS. - `stream_key: Optional[str]` The secret key to use for playback via RTMPS. - `url: Optional[str]` The URL used to play live video over RTMPS. - `srt: Optional[Srt]` Details for streaming to a live input using SRT. - `passphrase: Optional[str]` The secret key to use when streaming via SRT to a live input. - `stream_id: Optional[str]` The identifier of the live input to use when streaming via SRT. - `url: Optional[str]` The SRT URL you provide to the broadcaster, which they stream live video to. - `srt_playback: Optional[SrtPlayback]` Details for playback from an live input using SRT. - `passphrase: Optional[str]` The secret key to use for playback via SRT. - `stream_id: Optional[str]` The identifier of the live input to use for playback via SRT. - `url: Optional[str]` The URL used to play live video over SRT. - `status: Optional[Literal["connected", "reconnected", "reconnecting", 5 more]]` The connection status of a live input. - `"connected"` - `"reconnected"` - `"reconnecting"` - `"client_disconnect"` - `"ttl_exceeded"` - `"failed_to_connect"` - `"failed_to_reconnect"` - `"new_configuration_accepted"` - `uid: Optional[str]` A unique identifier for a live input. - `web_rtc: Optional[WebRtc]` Details for streaming to a live input using WebRTC. - `url: Optional[str]` The WebRTC URL you provide to the broadcaster, which they stream live video to. - `web_rtc_playback: Optional[WebRtcPlayback]` Details for playback from a live input using WebRTC. - `url: Optional[str]` The URL used to play live video over WebRTC. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) live_input = client.stream.live_inputs.get( live_input_identifier="66be4bf738797e01e1fca35a7bdecdcd", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(live_input.uid) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "created": "2014-01-02T02:20:00Z", "deleteRecordingAfterDays": 45, "enabled": true, "meta": { "name": "test stream 1" }, "modified": "2014-01-02T02:20:00Z", "recording": { "allowedOrigins": [ "example.com" ], "hideLiveViewerCount": false, "mode": "off", "requireSignedURLs": false, "timeoutSeconds": 0 }, "rtmps": { "streamKey": "2fb3cb9f17e68a2568d6ebed8d5505eak3ceaf8c9b1f395e1b76b79332497cada", "url": "rtmps://live.cloudflare.com:443/live/" }, "rtmpsPlayback": { "streamKey": "2fb3cb9f17e68a2568d6ebed8d5505eak3ceaf8c9b1f395e1b76b79332497cada", "url": "rtmps://live.cloudflare.com:443/live/" }, "srt": { "passphrase": "2fb3cb9f17e68a2568d6ebed8d5505eak3ceaf8c9b1f395e1b76b79332497cada", "streamId": "f256e6ea9341d51eea64c9454659e576", "url": "srt://live.cloudflare.com:778" }, "srtPlayback": { "passphrase": "2fb3cb9f17e68a2568d6ebed8d5505eak3ceaf8c9b1f395e1b76b79332497cada", "streamId": "f256e6ea9341d51eea64c9454659e576", "url": "rtmps://live.cloudflare.com:443/live/" }, "status": "connected", "uid": "66be4bf738797e01e1fca35a7bdecdcd", "webRTC": { "url": "https://customer-m033z5x00ks6nunl.cloudflarestream.com/b236bde30eb07b9d01318940e5fc3edake34a3efb3896e18f2dc277ce6cc993ad/webRTC/publish" }, "webRTCPlayback": { "url": "https://customer-m033z5x00ks6nunl.cloudflarestream.com/b236bde30eb07b9d01318940e5fc3edake34a3efb3896e18f2dc277ce6cc993ad/webRTC/play" } } } ``` ## Create a live input `stream.live_inputs.create(LiveInputCreateParams**kwargs) -> LiveInput` **post** `/accounts/{account_id}/stream/live_inputs` Creates a live input, and returns credentials that you or your users can use to stream live video to Cloudflare Stream. ### Parameters - `account_id: str` Identifier. - `default_creator: Optional[str]` Sets the creator ID asssociated with this live input. - `delete_recording_after_days: Optional[float]` Indicates the number of days after which the live inputs recordings will be deleted. When a stream completes and the recording is ready, the value is used to calculate a scheduled deletion date for that recording. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. - `enabled: Optional[bool]` Indicates whether the live input is enabled and can accept streams. - `meta: Optional[object]` A user modifiable key-value store used to reference other systems of record for managing live inputs. - `recording: Optional[Recording]` Records the input to a Cloudflare Stream video. Behavior depends on the mode. In most cases, the video will initially be viewable as a live video and transition to on-demand after a condition is satisfied. - `allowed_origins: Optional[SequenceNotStr[str]]` Lists the origins allowed to display videos created with this input. Enter allowed origin domains in an array and use `*` for wildcard subdomains. An empty array allows videos to be viewed on any origin. - `hide_live_viewer_count: Optional[bool]` Disables reporting the number of live viewers when this property is set to `true`. - `mode: Optional[Literal["off", "automatic"]]` Specifies the recording behavior for the live input. Set this value to `off` to prevent a recording. Set the value to `automatic` to begin a recording and transition to on-demand after Stream Live stops receiving input. - `"off"` - `"automatic"` - `require_signed_urls: Optional[bool]` Indicates if a video using the live input has the `requireSignedURLs` property set. Also enforces access controls on any video recording of the livestream with the live input. - `timeout_seconds: Optional[int]` Determines the amount of time a live input configured in `automatic` mode should wait before a recording transitions from live to on-demand. `0` is recommended for most use cases and indicates the platform default should be used. ### Returns - `class LiveInput: …` Details about a live input. - `created: Optional[datetime]` The date and time the live input was created. - `delete_recording_after_days: Optional[float]` Indicates the number of days after which the live inputs recordings will be deleted. When a stream completes and the recording is ready, the value is used to calculate a scheduled deletion date for that recording. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. - `enabled: Optional[bool]` Indicates whether the live input is enabled and can accept streams. - `meta: Optional[object]` A user modifiable key-value store used to reference other systems of record for managing live inputs. - `modified: Optional[datetime]` The date and time the live input was last modified. - `recording: Optional[Recording]` Records the input to a Cloudflare Stream video. Behavior depends on the mode. In most cases, the video will initially be viewable as a live video and transition to on-demand after a condition is satisfied. - `allowed_origins: Optional[List[str]]` Lists the origins allowed to display videos created with this input. Enter allowed origin domains in an array and use `*` for wildcard subdomains. An empty array allows videos to be viewed on any origin. - `hide_live_viewer_count: Optional[bool]` Disables reporting the number of live viewers when this property is set to `true`. - `mode: Optional[Literal["off", "automatic"]]` Specifies the recording behavior for the live input. Set this value to `off` to prevent a recording. Set the value to `automatic` to begin a recording and transition to on-demand after Stream Live stops receiving input. - `"off"` - `"automatic"` - `require_signed_urls: Optional[bool]` Indicates if a video using the live input has the `requireSignedURLs` property set. Also enforces access controls on any video recording of the livestream with the live input. - `timeout_seconds: Optional[int]` Determines the amount of time a live input configured in `automatic` mode should wait before a recording transitions from live to on-demand. `0` is recommended for most use cases and indicates the platform default should be used. - `rtmps: Optional[Rtmps]` Details for streaming to an live input using RTMPS. - `stream_key: Optional[str]` The secret key to use when streaming via RTMPS to a live input. - `url: Optional[str]` The RTMPS URL you provide to the broadcaster, which they stream live video to. - `rtmps_playback: Optional[RtmpsPlayback]` Details for playback from an live input using RTMPS. - `stream_key: Optional[str]` The secret key to use for playback via RTMPS. - `url: Optional[str]` The URL used to play live video over RTMPS. - `srt: Optional[Srt]` Details for streaming to a live input using SRT. - `passphrase: Optional[str]` The secret key to use when streaming via SRT to a live input. - `stream_id: Optional[str]` The identifier of the live input to use when streaming via SRT. - `url: Optional[str]` The SRT URL you provide to the broadcaster, which they stream live video to. - `srt_playback: Optional[SrtPlayback]` Details for playback from an live input using SRT. - `passphrase: Optional[str]` The secret key to use for playback via SRT. - `stream_id: Optional[str]` The identifier of the live input to use for playback via SRT. - `url: Optional[str]` The URL used to play live video over SRT. - `status: Optional[Literal["connected", "reconnected", "reconnecting", 5 more]]` The connection status of a live input. - `"connected"` - `"reconnected"` - `"reconnecting"` - `"client_disconnect"` - `"ttl_exceeded"` - `"failed_to_connect"` - `"failed_to_reconnect"` - `"new_configuration_accepted"` - `uid: Optional[str]` A unique identifier for a live input. - `web_rtc: Optional[WebRtc]` Details for streaming to a live input using WebRTC. - `url: Optional[str]` The WebRTC URL you provide to the broadcaster, which they stream live video to. - `web_rtc_playback: Optional[WebRtcPlayback]` Details for playback from a live input using WebRTC. - `url: Optional[str]` The URL used to play live video over WebRTC. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) live_input = client.stream.live_inputs.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(live_input.uid) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "created": "2014-01-02T02:20:00Z", "deleteRecordingAfterDays": 45, "enabled": true, "meta": { "name": "test stream 1" }, "modified": "2014-01-02T02:20:00Z", "recording": { "allowedOrigins": [ "example.com" ], "hideLiveViewerCount": false, "mode": "off", "requireSignedURLs": false, "timeoutSeconds": 0 }, "rtmps": { "streamKey": "2fb3cb9f17e68a2568d6ebed8d5505eak3ceaf8c9b1f395e1b76b79332497cada", "url": "rtmps://live.cloudflare.com:443/live/" }, "rtmpsPlayback": { "streamKey": "2fb3cb9f17e68a2568d6ebed8d5505eak3ceaf8c9b1f395e1b76b79332497cada", "url": "rtmps://live.cloudflare.com:443/live/" }, "srt": { "passphrase": "2fb3cb9f17e68a2568d6ebed8d5505eak3ceaf8c9b1f395e1b76b79332497cada", "streamId": "f256e6ea9341d51eea64c9454659e576", "url": "srt://live.cloudflare.com:778" }, "srtPlayback": { "passphrase": "2fb3cb9f17e68a2568d6ebed8d5505eak3ceaf8c9b1f395e1b76b79332497cada", "streamId": "f256e6ea9341d51eea64c9454659e576", "url": "rtmps://live.cloudflare.com:443/live/" }, "status": "connected", "uid": "66be4bf738797e01e1fca35a7bdecdcd", "webRTC": { "url": "https://customer-m033z5x00ks6nunl.cloudflarestream.com/b236bde30eb07b9d01318940e5fc3edake34a3efb3896e18f2dc277ce6cc993ad/webRTC/publish" }, "webRTCPlayback": { "url": "https://customer-m033z5x00ks6nunl.cloudflarestream.com/b236bde30eb07b9d01318940e5fc3edake34a3efb3896e18f2dc277ce6cc993ad/webRTC/play" } } } ``` ## Update a live input `stream.live_inputs.update(strlive_input_identifier, LiveInputUpdateParams**kwargs) -> LiveInput` **put** `/accounts/{account_id}/stream/live_inputs/{live_input_identifier}` Updates a specified live input. ### Parameters - `account_id: str` Identifier. - `live_input_identifier: str` A unique identifier for a live input. - `default_creator: Optional[str]` Sets the creator ID asssociated with this live input. - `delete_recording_after_days: Optional[float]` Indicates the number of days after which the live inputs recordings will be deleted. When a stream completes and the recording is ready, the value is used to calculate a scheduled deletion date for that recording. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. - `enabled: Optional[bool]` Indicates whether the live input is enabled and can accept streams. - `meta: Optional[object]` A user modifiable key-value store used to reference other systems of record for managing live inputs. - `recording: Optional[Recording]` Records the input to a Cloudflare Stream video. Behavior depends on the mode. In most cases, the video will initially be viewable as a live video and transition to on-demand after a condition is satisfied. - `allowed_origins: Optional[SequenceNotStr[str]]` Lists the origins allowed to display videos created with this input. Enter allowed origin domains in an array and use `*` for wildcard subdomains. An empty array allows videos to be viewed on any origin. - `hide_live_viewer_count: Optional[bool]` Disables reporting the number of live viewers when this property is set to `true`. - `mode: Optional[Literal["off", "automatic"]]` Specifies the recording behavior for the live input. Set this value to `off` to prevent a recording. Set the value to `automatic` to begin a recording and transition to on-demand after Stream Live stops receiving input. - `"off"` - `"automatic"` - `require_signed_urls: Optional[bool]` Indicates if a video using the live input has the `requireSignedURLs` property set. Also enforces access controls on any video recording of the livestream with the live input. - `timeout_seconds: Optional[int]` Determines the amount of time a live input configured in `automatic` mode should wait before a recording transitions from live to on-demand. `0` is recommended for most use cases and indicates the platform default should be used. ### Returns - `class LiveInput: …` Details about a live input. - `created: Optional[datetime]` The date and time the live input was created. - `delete_recording_after_days: Optional[float]` Indicates the number of days after which the live inputs recordings will be deleted. When a stream completes and the recording is ready, the value is used to calculate a scheduled deletion date for that recording. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. - `enabled: Optional[bool]` Indicates whether the live input is enabled and can accept streams. - `meta: Optional[object]` A user modifiable key-value store used to reference other systems of record for managing live inputs. - `modified: Optional[datetime]` The date and time the live input was last modified. - `recording: Optional[Recording]` Records the input to a Cloudflare Stream video. Behavior depends on the mode. In most cases, the video will initially be viewable as a live video and transition to on-demand after a condition is satisfied. - `allowed_origins: Optional[List[str]]` Lists the origins allowed to display videos created with this input. Enter allowed origin domains in an array and use `*` for wildcard subdomains. An empty array allows videos to be viewed on any origin. - `hide_live_viewer_count: Optional[bool]` Disables reporting the number of live viewers when this property is set to `true`. - `mode: Optional[Literal["off", "automatic"]]` Specifies the recording behavior for the live input. Set this value to `off` to prevent a recording. Set the value to `automatic` to begin a recording and transition to on-demand after Stream Live stops receiving input. - `"off"` - `"automatic"` - `require_signed_urls: Optional[bool]` Indicates if a video using the live input has the `requireSignedURLs` property set. Also enforces access controls on any video recording of the livestream with the live input. - `timeout_seconds: Optional[int]` Determines the amount of time a live input configured in `automatic` mode should wait before a recording transitions from live to on-demand. `0` is recommended for most use cases and indicates the platform default should be used. - `rtmps: Optional[Rtmps]` Details for streaming to an live input using RTMPS. - `stream_key: Optional[str]` The secret key to use when streaming via RTMPS to a live input. - `url: Optional[str]` The RTMPS URL you provide to the broadcaster, which they stream live video to. - `rtmps_playback: Optional[RtmpsPlayback]` Details for playback from an live input using RTMPS. - `stream_key: Optional[str]` The secret key to use for playback via RTMPS. - `url: Optional[str]` The URL used to play live video over RTMPS. - `srt: Optional[Srt]` Details for streaming to a live input using SRT. - `passphrase: Optional[str]` The secret key to use when streaming via SRT to a live input. - `stream_id: Optional[str]` The identifier of the live input to use when streaming via SRT. - `url: Optional[str]` The SRT URL you provide to the broadcaster, which they stream live video to. - `srt_playback: Optional[SrtPlayback]` Details for playback from an live input using SRT. - `passphrase: Optional[str]` The secret key to use for playback via SRT. - `stream_id: Optional[str]` The identifier of the live input to use for playback via SRT. - `url: Optional[str]` The URL used to play live video over SRT. - `status: Optional[Literal["connected", "reconnected", "reconnecting", 5 more]]` The connection status of a live input. - `"connected"` - `"reconnected"` - `"reconnecting"` - `"client_disconnect"` - `"ttl_exceeded"` - `"failed_to_connect"` - `"failed_to_reconnect"` - `"new_configuration_accepted"` - `uid: Optional[str]` A unique identifier for a live input. - `web_rtc: Optional[WebRtc]` Details for streaming to a live input using WebRTC. - `url: Optional[str]` The WebRTC URL you provide to the broadcaster, which they stream live video to. - `web_rtc_playback: Optional[WebRtcPlayback]` Details for playback from a live input using WebRTC. - `url: Optional[str]` The URL used to play live video over WebRTC. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) live_input = client.stream.live_inputs.update( live_input_identifier="66be4bf738797e01e1fca35a7bdecdcd", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(live_input.uid) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "created": "2014-01-02T02:20:00Z", "deleteRecordingAfterDays": 45, "enabled": true, "meta": { "name": "test stream 1" }, "modified": "2014-01-02T02:20:00Z", "recording": { "allowedOrigins": [ "example.com" ], "hideLiveViewerCount": false, "mode": "off", "requireSignedURLs": false, "timeoutSeconds": 0 }, "rtmps": { "streamKey": "2fb3cb9f17e68a2568d6ebed8d5505eak3ceaf8c9b1f395e1b76b79332497cada", "url": "rtmps://live.cloudflare.com:443/live/" }, "rtmpsPlayback": { "streamKey": "2fb3cb9f17e68a2568d6ebed8d5505eak3ceaf8c9b1f395e1b76b79332497cada", "url": "rtmps://live.cloudflare.com:443/live/" }, "srt": { "passphrase": "2fb3cb9f17e68a2568d6ebed8d5505eak3ceaf8c9b1f395e1b76b79332497cada", "streamId": "f256e6ea9341d51eea64c9454659e576", "url": "srt://live.cloudflare.com:778" }, "srtPlayback": { "passphrase": "2fb3cb9f17e68a2568d6ebed8d5505eak3ceaf8c9b1f395e1b76b79332497cada", "streamId": "f256e6ea9341d51eea64c9454659e576", "url": "rtmps://live.cloudflare.com:443/live/" }, "status": "connected", "uid": "66be4bf738797e01e1fca35a7bdecdcd", "webRTC": { "url": "https://customer-m033z5x00ks6nunl.cloudflarestream.com/b236bde30eb07b9d01318940e5fc3edake34a3efb3896e18f2dc277ce6cc993ad/webRTC/publish" }, "webRTCPlayback": { "url": "https://customer-m033z5x00ks6nunl.cloudflarestream.com/b236bde30eb07b9d01318940e5fc3edake34a3efb3896e18f2dc277ce6cc993ad/webRTC/play" } } } ``` ## Delete a live input `stream.live_inputs.delete(strlive_input_identifier, LiveInputDeleteParams**kwargs)` **delete** `/accounts/{account_id}/stream/live_inputs/{live_input_identifier}` Prevents a live input from being streamed to and makes the live input inaccessible to any future API calls. ### Parameters - `account_id: str` Identifier. - `live_input_identifier: str` A unique identifier for a live input. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) client.stream.live_inputs.delete( live_input_identifier="66be4bf738797e01e1fca35a7bdecdcd", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) ``` #### Response ```json {} ``` ## Domain Types ### Live Input - `class LiveInput: …` Details about a live input. - `created: Optional[datetime]` The date and time the live input was created. - `delete_recording_after_days: Optional[float]` Indicates the number of days after which the live inputs recordings will be deleted. When a stream completes and the recording is ready, the value is used to calculate a scheduled deletion date for that recording. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. - `enabled: Optional[bool]` Indicates whether the live input is enabled and can accept streams. - `meta: Optional[object]` A user modifiable key-value store used to reference other systems of record for managing live inputs. - `modified: Optional[datetime]` The date and time the live input was last modified. - `recording: Optional[Recording]` Records the input to a Cloudflare Stream video. Behavior depends on the mode. In most cases, the video will initially be viewable as a live video and transition to on-demand after a condition is satisfied. - `allowed_origins: Optional[List[str]]` Lists the origins allowed to display videos created with this input. Enter allowed origin domains in an array and use `*` for wildcard subdomains. An empty array allows videos to be viewed on any origin. - `hide_live_viewer_count: Optional[bool]` Disables reporting the number of live viewers when this property is set to `true`. - `mode: Optional[Literal["off", "automatic"]]` Specifies the recording behavior for the live input. Set this value to `off` to prevent a recording. Set the value to `automatic` to begin a recording and transition to on-demand after Stream Live stops receiving input. - `"off"` - `"automatic"` - `require_signed_urls: Optional[bool]` Indicates if a video using the live input has the `requireSignedURLs` property set. Also enforces access controls on any video recording of the livestream with the live input. - `timeout_seconds: Optional[int]` Determines the amount of time a live input configured in `automatic` mode should wait before a recording transitions from live to on-demand. `0` is recommended for most use cases and indicates the platform default should be used. - `rtmps: Optional[Rtmps]` Details for streaming to an live input using RTMPS. - `stream_key: Optional[str]` The secret key to use when streaming via RTMPS to a live input. - `url: Optional[str]` The RTMPS URL you provide to the broadcaster, which they stream live video to. - `rtmps_playback: Optional[RtmpsPlayback]` Details for playback from an live input using RTMPS. - `stream_key: Optional[str]` The secret key to use for playback via RTMPS. - `url: Optional[str]` The URL used to play live video over RTMPS. - `srt: Optional[Srt]` Details for streaming to a live input using SRT. - `passphrase: Optional[str]` The secret key to use when streaming via SRT to a live input. - `stream_id: Optional[str]` The identifier of the live input to use when streaming via SRT. - `url: Optional[str]` The SRT URL you provide to the broadcaster, which they stream live video to. - `srt_playback: Optional[SrtPlayback]` Details for playback from an live input using SRT. - `passphrase: Optional[str]` The secret key to use for playback via SRT. - `stream_id: Optional[str]` The identifier of the live input to use for playback via SRT. - `url: Optional[str]` The URL used to play live video over SRT. - `status: Optional[Literal["connected", "reconnected", "reconnecting", 5 more]]` The connection status of a live input. - `"connected"` - `"reconnected"` - `"reconnecting"` - `"client_disconnect"` - `"ttl_exceeded"` - `"failed_to_connect"` - `"failed_to_reconnect"` - `"new_configuration_accepted"` - `uid: Optional[str]` A unique identifier for a live input. - `web_rtc: Optional[WebRtc]` Details for streaming to a live input using WebRTC. - `url: Optional[str]` The WebRTC URL you provide to the broadcaster, which they stream live video to. - `web_rtc_playback: Optional[WebRtcPlayback]` Details for playback from a live input using WebRTC. - `url: Optional[str]` The URL used to play live video over WebRTC. ### Live Input List Response - `class LiveInputListResponse: …` - `live_inputs: Optional[List[LiveInput]]` - `created: Optional[datetime]` The date and time the live input was created. - `delete_recording_after_days: Optional[float]` Indicates the number of days after which the live inputs recordings will be deleted. When a stream completes and the recording is ready, the value is used to calculate a scheduled deletion date for that recording. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. - `enabled: Optional[bool]` Indicates whether the live input is enabled and can accept streams. - `meta: Optional[object]` A user modifiable key-value store used to reference other systems of record for managing live inputs. - `modified: Optional[datetime]` The date and time the live input was last modified. - `uid: Optional[str]` A unique identifier for a live input. - `range: Optional[int]` The total number of remaining live inputs based on cursor position. - `total: Optional[int]` The total number of live inputs that match the provided filters. # Outputs ## List all outputs associated with a specified live input `stream.live_inputs.outputs.list(strlive_input_identifier, OutputListParams**kwargs) -> SyncSinglePage[Output]` **get** `/accounts/{account_id}/stream/live_inputs/{live_input_identifier}/outputs` Retrieves all outputs associated with a specified live input. ### Parameters - `account_id: str` Identifier. - `live_input_identifier: str` A unique identifier for a live input. ### Returns - `class Output: …` - `enabled: Optional[bool]` When enabled, live video streamed to the associated live input will be sent to the output URL. When disabled, live video will not be sent to the output URL, even when streaming to the associated live input. Use this to control precisely when you start and stop simulcasting to specific destinations like YouTube and Twitch. - `stream_key: Optional[str]` The streamKey used to authenticate against an output's target. - `uid: Optional[str]` A unique identifier for the output. - `url: Optional[str]` The URL an output uses to restream. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.stream.live_inputs.outputs.list( live_input_identifier="66be4bf738797e01e1fca35a7bdecdcd", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.uid) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "enabled": true, "streamKey": "uzya-f19y-g2g9-a2ee-51j2", "uid": "baea4d9c515887b80289d5c33cf01145", "url": "rtmp://a.rtmp.youtube.com/live2" } ] } ``` ## Create a new output, connected to a live input `stream.live_inputs.outputs.create(strlive_input_identifier, OutputCreateParams**kwargs) -> Output` **post** `/accounts/{account_id}/stream/live_inputs/{live_input_identifier}/outputs` Creates a new output that can be used to simulcast or restream live video to other RTMP or SRT destinations. Outputs are always linked to a specific live input — one live input can have many outputs. ### Parameters - `account_id: str` Identifier. - `live_input_identifier: str` A unique identifier for a live input. - `stream_key: str` The streamKey used to authenticate against an output's target. - `url: str` The URL an output uses to restream. - `enabled: Optional[bool]` When enabled, live video streamed to the associated live input will be sent to the output URL. When disabled, live video will not be sent to the output URL, even when streaming to the associated live input. Use this to control precisely when you start and stop simulcasting to specific destinations like YouTube and Twitch. ### Returns - `class Output: …` - `enabled: Optional[bool]` When enabled, live video streamed to the associated live input will be sent to the output URL. When disabled, live video will not be sent to the output URL, even when streaming to the associated live input. Use this to control precisely when you start and stop simulcasting to specific destinations like YouTube and Twitch. - `stream_key: Optional[str]` The streamKey used to authenticate against an output's target. - `uid: Optional[str]` A unique identifier for the output. - `url: Optional[str]` The URL an output uses to restream. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) output = client.stream.live_inputs.outputs.create( live_input_identifier="66be4bf738797e01e1fca35a7bdecdcd", account_id="023e105f4ecef8ad9ca31a8372d0c353", stream_key="uzya-f19y-g2g9-a2ee-51j2", url="rtmp://a.rtmp.youtube.com/live2", ) print(output.uid) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "enabled": true, "streamKey": "uzya-f19y-g2g9-a2ee-51j2", "uid": "baea4d9c515887b80289d5c33cf01145", "url": "rtmp://a.rtmp.youtube.com/live2" } } ``` ## Update an output `stream.live_inputs.outputs.update(stroutput_identifier, OutputUpdateParams**kwargs) -> Output` **put** `/accounts/{account_id}/stream/live_inputs/{live_input_identifier}/outputs/{output_identifier}` Updates the state of an output. ### Parameters - `account_id: str` Identifier. - `live_input_identifier: str` A unique identifier for a live input. - `output_identifier: str` A unique identifier for the output. - `enabled: bool` When enabled, live video streamed to the associated live input will be sent to the output URL. When disabled, live video will not be sent to the output URL, even when streaming to the associated live input. Use this to control precisely when you start and stop simulcasting to specific destinations like YouTube and Twitch. ### Returns - `class Output: …` - `enabled: Optional[bool]` When enabled, live video streamed to the associated live input will be sent to the output URL. When disabled, live video will not be sent to the output URL, even when streaming to the associated live input. Use this to control precisely when you start and stop simulcasting to specific destinations like YouTube and Twitch. - `stream_key: Optional[str]` The streamKey used to authenticate against an output's target. - `uid: Optional[str]` A unique identifier for the output. - `url: Optional[str]` The URL an output uses to restream. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) output = client.stream.live_inputs.outputs.update( output_identifier="baea4d9c515887b80289d5c33cf01145", account_id="023e105f4ecef8ad9ca31a8372d0c353", live_input_identifier="66be4bf738797e01e1fca35a7bdecdcd", enabled=True, ) print(output.uid) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "enabled": true, "streamKey": "uzya-f19y-g2g9-a2ee-51j2", "uid": "baea4d9c515887b80289d5c33cf01145", "url": "rtmp://a.rtmp.youtube.com/live2" } } ``` ## Delete an output `stream.live_inputs.outputs.delete(stroutput_identifier, OutputDeleteParams**kwargs)` **delete** `/accounts/{account_id}/stream/live_inputs/{live_input_identifier}/outputs/{output_identifier}` Deletes an output and removes it from the associated live input. ### Parameters - `account_id: str` Identifier. - `live_input_identifier: str` A unique identifier for a live input. - `output_identifier: str` A unique identifier for the output. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) client.stream.live_inputs.outputs.delete( output_identifier="baea4d9c515887b80289d5c33cf01145", account_id="023e105f4ecef8ad9ca31a8372d0c353", live_input_identifier="66be4bf738797e01e1fca35a7bdecdcd", ) ``` #### Response ```json {} ``` ## Domain Types ### Output - `class Output: …` - `enabled: Optional[bool]` When enabled, live video streamed to the associated live input will be sent to the output URL. When disabled, live video will not be sent to the output URL, even when streaming to the associated live input. Use this to control precisely when you start and stop simulcasting to specific destinations like YouTube and Twitch. - `stream_key: Optional[str]` The streamKey used to authenticate against an output's target. - `uid: Optional[str]` A unique identifier for the output. - `url: Optional[str]` The URL an output uses to restream.