# Streams ## Add `streams.add(strnamespace, StreamAddParams**kwargs) -> StreamAddResponse` **post** `/v1/streams/{namespace}` Monitor the livestream at the given stream URL. This method returns immediately. ### Parameters - `namespace: str` The namespace to ingest stream data into - `id: str` - `stream_url: str` ### Returns - `class StreamAddResponse: …` Stream ingestion request accepted for asynchronous processing. - `request_id: str` - `status: Literal["accepted"]` - `"accepted"` ### Example ```python import os from safetykit import Safetykit client = Safetykit( api_key=os.environ.get("SAFETYKIT_API_KEY"), # This is the default and can be omitted ) response = client.streams.add( namespace="namespace", id="YOUR_STREAM_ID", stream_url="https://cdn.example.com/20948D23.m3u8", ) print(response.request_id) ``` ## Add Parts `streams.add_parts(strnamespace, StreamAddPartsParams**kwargs) -> StreamAddPartsResponse` **post** `/v1/streams/{namespace}/parts` Append a list of parts to a stream by the stream identifier. The stream does not need to be created beforehand. This method returns immediately; parts are processed asynchronously. ### Parameters - `namespace: str` The namespace to ingest stream data into - `id: str` - `data: Iterable[Data]` - `class DataAudioURL: …` - `timestamp: str` - `type: Literal["audio_url"]` - `"audio_url"` - `url: str` - `class DataFrameImageURL: …` - `timestamp: str` - `type: Literal["frame_image_url"]` - `"frame_image_url"` - `url: str` - `class DataChatMessage: …` - `sender_display_name: str` - `sender_id: str` - `text: str` - `timestamp: str` - `type: Literal["chat_message"]` - `"chat_message"` - `class DataTranscript: …` - `text: str` - `timestamp: str` - `type: Literal["transcript"]` - `"transcript"` - `speaker: Optional[str]` ### Returns - `class StreamAddPartsResponse: …` Stream ingestion request accepted for asynchronous processing. - `request_id: str` - `status: Literal["accepted"]` - `"accepted"` ### Example ```python import os from safetykit import Safetykit client = Safetykit( api_key=os.environ.get("SAFETYKIT_API_KEY"), # This is the default and can be omitted ) response = client.streams.add_parts( namespace="namespace", id="YOUR_STREAM_ID", data=[{ "type": "audio_url", "timestamp": "2026-03-10T18:54:20+00:00", "url": "https://example.com/234039.mp3", }], ) print(response.request_id) ```