{"openapi":"3.1.0","info":{"title":"Stream Monitor","version":"1.0.0"},"paths":{"/health":{"get":{"tags":["meta"],"summary":"Health","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/streams/":{"get":{"tags":["streams"],"summary":"List Streams","description":"List monitoring sessions, optionally filtered by event_id, user_id,\nplatform, status, channel and/or connected_account_id.\n\nchannel/connected_account_id disambiguate a user with two accounts live\non the same platform at once -- without them, both accounts' sessions\nare returned.","operationId":"list_streams_api_streams__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"event_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Event Id"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"platform","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Platform"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"channel","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel"}},{"name":"connected_account_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Connected Account Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response List Streams Api Streams  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/streams/start":{"post":{"tags":["streams"],"summary":"Start Stream","description":"Create a monitoring session and dispatch Celery tasks.\n\nIdempotent per (user_id, event_id, platform, channel): if an active\nsession already exists for that combination, returns the existing\nsession_id without spawning duplicate tasks. Makes the endpoint safe for\nreconciliation loops to call every minute. Channel is included so a user\nwith two accounts live on the same platform gets two independent\nsessions instead of the second being folded into the first's.","operationId":"start_stream_api_streams_start_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartSessionRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartSessionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/streams/{session_id}/stop":{"post":{"tags":["streams"],"summary":"Stop Stream","description":"Signal session shutdown via the shared stop helper.\n\nMarks session complete in MySQL, sets the Redis stop flag (chat/viewer/monitor\ntasks exit cleanly on their next stop_check), and notifies web-app so it\ncan revert payment state (e.g. un-pause YouTube ads).","operationId":"stop_stream_api_streams__session_id__stop_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Stop Stream Api Streams  Session Id  Stop Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/streams/{session_id}/viewer-count":{"get":{"tags":["streams"],"summary":"Get Viewer Count","description":"Return viewer count snapshots for a session, sorted by timestamp.","operationId":"get_viewer_count_api_streams__session_id__viewer_count_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response Get Viewer Count Api Streams  Session Id  Viewer Count Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/streams/{session_id}":{"get":{"tags":["streams"],"summary":"Get Stream","description":"Return current session status and statistics.","operationId":"get_stream_api_streams__session_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Stream Api Streams  Session Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/twitch":{"put":{"tags":["auth"],"summary":"Update Twitch Token","description":"Store a new Twitch OAuth token in Redis.\n\nAll subsequent stream captures will use this token. Call this whenever\nthe Turbo account token is refreshed.","operationId":"update_twitch_token_api_auth_twitch_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TwitchTokenRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Update Twitch Token Api Auth Twitch Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/youtube/live-status":{"get":{"tags":["youtube"],"summary":"Live Status","description":"Quota-free live-status check for a YouTube channel, combined with a\nsingle cheap (1-unit, API-key-only) videos.list lookup for the\nliveChatId once we know a broadcast is active. Intended for web-app's\nyoutube:poll-live-status command to call instead of the old per-user\nOAuth liveBroadcasts.list call -- this needs no OAuth token at all,\njust the public channel id.","operationId":"live_status_api_youtube_live_status_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"channel","in":"query","required":true,"schema":{"type":"string","title":"Channel"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Live Status Api Youtube Live Status Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tiktok/live-status":{"post":{"tags":["tiktok"],"summary":"Live Status","description":"Batch live-status check for TikTok usernames (unofficial TikTokLive).\n\nOne failing username never fails the batch: it reports is_live=false plus\nan \"error\" key. Results are cached briefly in Redis.","operationId":"live_status_api_tiktok_live_status_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LiveStatusRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Live Status Api Tiktok Live Status Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}}},"components":{"schemas":{"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"LiveStatusRequest":{"properties":{"usernames":{"items":{"type":"string"},"type":"array","maxItems":100,"title":"Usernames"}},"type":"object","title":"LiveStatusRequest"},"StartSessionRequest":{"properties":{"user_id":{"type":"string","title":"User Id"},"platform":{"type":"string","title":"Platform"},"channel":{"type":"string","title":"Channel"},"event_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Event Id"},"connected_account_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Connected Account Id"},"metadata":{"additionalProperties":true,"type":"object","title":"Metadata"}},"type":"object","required":["user_id","platform","channel"],"title":"StartSessionRequest"},"StartSessionResponse":{"properties":{"session_id":{"type":"string","title":"Session Id"},"status":{"type":"string","title":"Status"}},"type":"object","required":["session_id","status"],"title":"StartSessionResponse"},"TwitchTokenRequest":{"properties":{"token":{"type":"string","title":"Token"}},"type":"object","required":["token"],"title":"TwitchTokenRequest"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}}}}