openapi: 3.1.0 info: title: go2rtc version: 1.9.13 license: { name: MIT,url: https://opensource.org/licenses/MIT } contact: { url: https://github.com/AlexxIT/go2rtc } description: | Ultimate camera streaming application with support RTSP, RTMP, HTTP-FLV, WebRTC, MSE, HLS, MP4, MJPEG, HomeKit, FFmpeg, etc. servers: - url: http://localhost:1984 tags: - name: Application description: "[Module: API](https://github.com/AlexxIT/go2rtc#module-api)" - name: Config description: "[Configuration](https://github.com/AlexxIT/go2rtc#configuration)" - name: Streams list description: "[Module: Streams](https://github.com/AlexxIT/go2rtc#module-streams)" - name: Consume stream - name: HLS - name: Snapshot - name: Produce stream - name: WebSocket description: "WebSocket API endpoint: `/api/ws` (see `api/README.md`)" - name: Discovery - name: HomeKit - name: ONVIF - name: RTSPtoWebRTC - name: WebTorrent description: "[Module: WebTorrent](https://github.com/AlexxIT/go2rtc#module-webtorrent)" - name: FFmpeg - name: Debug components: parameters: stream_src_path: name: src in: path description: Source stream name required: true schema: { type: string } example: camera1 stream_dst_path: name: dst in: path description: Destination stream name required: true schema: { type: string } example: camera1 stream_src_query: name: src in: query description: Source stream name required: true schema: { type: string } example: camera1 hls_session_id_path: name: id in: path description: HLS session ID (passed as query param `id`) required: true schema: { type: string } example: DvmHdd9w mp4_filter: name: mp4 in: query description: MP4 codecs filter required: false schema: type: string enum: [ "", flac, all ] example: flac video_filter: name: video in: query description: Video codecs filter schema: type: string enum: [ "", all, h264, h265, mjpeg ] example: h264,h265 audio_filter: name: audio in: query description: Audio codecs filter schema: type: string enum: [ "", all, aac, opus, pcm, pcmu, pcma ] example: aac responses: discovery: description: "" content: application/json: example: { streams: [ { "name": "Camera 1","url": "..." } ] } webtorrent: description: "" content: application/json: example: { share: AKDypPy4zz, pwd: H0Km1HLTTP } paths: /api: get: summary: Get application info tags: [ Application ] responses: "200": description: "" content: application/json: schema: type: object properties: config_path: { type: string, example: "/config/go2rtc.yaml" } host: { type: string, example: "192.168.1.123:1984" } rtsp: type: object properties: listen: { type: string, example: ":8554" } default_query: { type: string, example: "video&audio" } version: { type: string, example: "1.9.12" } /api/exit: post: summary: Close application tags: [ Application ] parameters: - name: code in: query description: Application exit code required: false schema: { type: integer } example: 100 responses: default: description: "" /api/restart: post: summary: Restart daemon description: Restarts the daemon. tags: [ Application ] responses: default: description: "" /api/log: get: summary: Get in-memory logs buffer description: | Returns current log output from the in-memory circular buffer. tags: [ Application ] responses: "200": description: OK content: application/jsonlines: example: | {"level":"info","version":"1.9.13","platform":"linux/amd64","revision":"dfe4755","time":1766841087331,"message":"go2rtc"} delete: summary: Clear in-memory logs buffer tags: [ Application ] responses: "200": description: "" content: text/plain: { example: "" } /api/config: get: summary: Get main config file content tags: [ Config ] responses: "200": description: "" content: application/yaml: { example: "streams:..." } "404": description: Config file not found post: summary: Rewrite main config file tags: [ Config ] requestBody: content: "*/*": { example: "streams:..." } responses: default: description: "" patch: summary: Merge changes to main config file tags: [ Config ] requestBody: content: "*/*": { example: "streams:..." } responses: default: description: "" /api/streams: get: summary: Get all streams info tags: [ Streams list ] responses: "200": description: "" content: application/json: schema: type: object additionalProperties: type: object properties: producers: type: array consumers: type: array put: summary: Create new stream tags: [ Streams list ] parameters: - name: src in: query description: Stream source (URI) required: true schema: { type: string } example: "rtsp://rtsp:12345678@192.168.1.123/av_stream/ch0" - name: name in: query description: Stream name required: false schema: { type: string } example: camera1 responses: default: description: "" patch: summary: Update stream source tags: [ Streams list ] parameters: - name: src in: query description: Stream source (URI) required: true schema: { type: string } example: "rtsp://rtsp:12345678@192.168.1.123/av_stream/ch0" - name: name in: query description: Stream name required: true schema: { type: string } example: camera1 responses: default: description: "" delete: summary: Delete stream tags: [ Streams list ] parameters: - name: src in: query description: Stream name required: true schema: { type: string } example: camera1 responses: default: description: "" post: summary: Send stream from source to destination description: "[Stream to camera](https://github.com/AlexxIT/go2rtc#stream-to-camera)" tags: [ Streams list ] parameters: - name: src in: query description: Stream source (URI) required: true schema: { type: string } example: "ffmpeg:http://example.com/song.mp3#audio=pcma#input=file" - name: dst in: query description: Destination stream name required: true schema: { type: string } example: camera1 responses: default: description: "" /api/streams.dot: get: summary: Get streams graph in Graphviz DOT format tags: [ Streams list ] parameters: - name: src in: query description: Stream name filter. Repeat `src` to include multiple streams. required: false schema: { type: string } example: camera1 responses: "200": description: OK content: text/vnd.graphviz: example: "digraph { ... }" /api/preload: get: summary: Get all preloaded streams tags: [ Streams list ] responses: "200": description: "" content: application/json: schema: type: object additionalProperties: type: object properties: consumer: type: object query: type: string example: "video&audio" put: summary: Preload new stream tags: [ Streams list ] parameters: - name: src in: query description: Stream source (name) required: true schema: { type: string } example: "camera1" - name: video in: query description: Video codecs filter required: false schema: { type: string } example: all,h264,h265,... - name: audio in: query description: Audio codecs filter required: false schema: { type: string } example: all,aac,opus,... - name: microphone in: query description: Microphone codecs filter required: false schema: { type: string } example: all,aac,opus,... responses: default: description: "" delete: summary: Delete preloaded stream tags: [ Streams list ] parameters: - name: src in: query description: Stream source (name) required: true schema: { type: string } example: "camera1" responses: default: description: "" /api/schemes: get: summary: Get supported source URL schemes tags: [ Streams list ] responses: "200": description: OK content: application/json: schema: type: array items: { type: string } example: [ rtsp, rtmp, webrtc, ffmpeg, hass ] /api/streams?src={src}: get: summary: Get stream info in JSON format tags: [ Consume stream ] parameters: - $ref: "#/components/parameters/stream_src_path" responses: "200": description: "" content: application/json: schema: type: object additionalProperties: type: object properties: producers: type: array items: { type: object } consumers: type: array items: { type: object } /api/webrtc?src={src}: post: summary: Get stream in WebRTC format (WHEP) description: "[Module: WebRTC](https://github.com/AlexxIT/go2rtc#module-webrtc)" tags: [ Consume stream ] parameters: - $ref: "#/components/parameters/stream_src_path" requestBody: description: | Support: - JSON format (`Content-Type: application/json`) - WHEP standard (`Content-Type: application/sdp`) - raw SDP (`Content-Type: anything`) required: true content: application/json: { example: { type: offer, sdp: "v=0..." } } "application/sdp": { example: "v=0..." } "*/*": { example: "v=0..." } responses: "200": description: "Response on JSON or raw SDP" content: application/json: { example: { type: answer, sdp: "v=0..." } } application/sdp: { example: "v=0..." } "201": description: "Response on `Content-Type: application/sdp`" content: application/sdp: { example: "v=0..." } /api/stream.mp4?src={src}: get: summary: Get stream in MP4 format (HTTP progressive) description: "[Module: MP4](https://github.com/AlexxIT/go2rtc#module-mp4)" tags: [ Consume stream ] parameters: - $ref: "#/components/parameters/stream_src_path" - name: duration in: query description: Limit the length of the stream in seconds required: false schema: { type: string } example: 15 - name: filename in: query description: Download as a file with this name required: false schema: { type: string } example: camera1.mp4 - name: rotate in: query description: "Rotate video (degrees). Supported values: 90, 180, 270." required: false schema: { type: integer, enum: [ 90, 180, 270 ] } - name: scale in: query description: Scale video in format `width:height` required: false schema: { type: string, example: "1280:720" } - $ref: "#/components/parameters/mp4_filter" - $ref: "#/components/parameters/video_filter" - $ref: "#/components/parameters/audio_filter" responses: 200: description: "" content: { video/mp4: { example: "" } } /api/stream.m3u8?src={src}: get: summary: Get stream in HLS format description: "[Module: HLS](https://github.com/AlexxIT/go2rtc#module-hls)" tags: [ Consume stream, HLS ] parameters: - $ref: "#/components/parameters/stream_src_path" - $ref: "#/components/parameters/mp4_filter" - $ref: "#/components/parameters/video_filter" - $ref: "#/components/parameters/audio_filter" responses: 200: description: "" content: { application/vnd.apple.mpegurl: { example: "" } } /api/hls/playlist.m3u8?id={id}: get: summary: Get HLS media playlist for an active session tags: [ HLS ] parameters: - $ref: "#/components/parameters/hls_session_id_path" responses: "200": description: OK content: application/vnd.apple.mpegurl: { example: "" } "404": description: Session not found /api/hls/segment.ts?id={id}: get: summary: Get HLS MPEG-TS segment for an active session tags: [ HLS ] parameters: - $ref: "#/components/parameters/hls_session_id_path" responses: "200": description: OK content: video/mp2t: { example: "" } "404": description: Segment or session not found /api/hls/init.mp4?id={id}: get: summary: Get HLS fMP4 init segment for an active session tags: [ HLS ] parameters: - $ref: "#/components/parameters/hls_session_id_path" responses: "200": description: OK content: video/mp4: { example: "" } "404": description: Segment or session not found /api/hls/segment.m4s?id={id}: get: summary: Get HLS fMP4 media segment for an active session tags: [ HLS ] parameters: - $ref: "#/components/parameters/hls_session_id_path" responses: "200": description: OK content: video/iso.segment: { example: "" } "404": description: Segment or session not found /api/stream.mjpeg?src={src}: get: summary: Get stream in MJPEG format description: "[Module: MJPEG](https://github.com/AlexxIT/go2rtc#module-mjpeg)" tags: [ Consume stream ] parameters: - $ref: "#/components/parameters/stream_src_path" responses: 200: description: "" content: { multipart/x-mixed-replace: { example: "" } } /api/stream.ascii?src={src}: get: summary: Get stream in ASCII-art format (ANSI escape codes) description: "[Module: MJPEG](https://github.com/AlexxIT/go2rtc#module-mjpeg)" tags: [ Consume stream ] parameters: - $ref: "#/components/parameters/stream_src_path" - name: color in: query description: Foreground mode (`8`, `256`, `rgb` or ANSI SGR code) required: false schema: { type: string } - name: back in: query description: Background mode (`8`, `256`, `rgb` or ANSI SGR code) required: false schema: { type: string } - name: text in: query description: Charset preset (empty/default, `block`) or custom characters required: false schema: { type: string } responses: "200": description: OK content: text/plain: { example: "" } "404": description: Stream not found /api/stream.y4m?src={src}: get: summary: Get stream in YUV4MPEG2 format (y4m) tags: [ Consume stream ] parameters: - $ref: "#/components/parameters/stream_src_path" responses: "200": description: OK content: application/octet-stream: { example: "" } "404": description: Stream not found /api/stream.ts?src={src}: get: summary: Get stream in MPEG-TS format tags: [ Consume stream ] parameters: - $ref: "#/components/parameters/stream_src_path" responses: "200": description: OK content: video/mp2t: { example: "" } "404": description: Stream not found /api/stream.aac?src={src}: get: summary: Get stream audio in AAC (ADTS) format tags: [ Consume stream ] parameters: - $ref: "#/components/parameters/stream_src_path" responses: "200": description: OK content: audio/aac: { example: "" } "404": description: Stream not found /api/stream.flv?src={src}: get: summary: Get stream in FLV format tags: [ Consume stream ] parameters: - $ref: "#/components/parameters/stream_src_path" responses: "200": description: OK content: video/x-flv: { example: "" } "404": description: Stream not found /api/frame.jpeg?src={src}: get: summary: Get snapshot in JPEG format description: "[Module: MJPEG](https://github.com/AlexxIT/go2rtc#module-mjpeg)" tags: [ Snapshot ] parameters: - $ref: "#/components/parameters/stream_src_path" - name: name in: query description: Optional stream name to create/update if `src` is a URL required: false schema: { type: string } - name: width in: query description: "Scale output width (alias: `w`)" required: false schema: { type: integer, minimum: 1 } - name: height in: query description: "Scale output height (alias: `h`)" required: false schema: { type: integer, minimum: 1 } - name: rotate in: query description: "Rotate output (degrees). Supported values: 90, 180, 270." required: false schema: { type: integer, enum: [ 90, 180, 270 ] } - name: hardware in: query description: "Hardware acceleration engine for FFmpeg snapshot transcoding (alias: `hw`)" required: false schema: { type: string } responses: "200": description: "" content: image/jpeg: { example: "" } /api/frame.mp4?src={src}: get: summary: Get snapshot in MP4 format description: "[Module: MP4](https://github.com/AlexxIT/go2rtc#module-mp4)" tags: [ Snapshot ] parameters: - $ref: "#/components/parameters/stream_src_path" - name: filename in: query description: Download as a file with this name required: false schema: { type: string } example: camera1.mp4 responses: 200: description: "" content: video/mp4: { example: "" } /api/webrtc?dst={dst}: post: summary: Post stream in WebRTC format (WHIP) description: "[Incoming: WebRTC/WHIP](https://github.com/AlexxIT/go2rtc#incoming-webrtcwhip)" tags: [ Produce stream ] parameters: - $ref: "#/components/parameters/stream_dst_path" responses: "201": description: Created headers: Location: description: Resource URL for session schema: { type: string } content: application/sdp: { example: "v=0..." } "404": description: Stream not found /api/stream?dst={dst}: post: summary: Post stream in auto-detected format description: | Incoming source with automatic format detection. Use for pushing a stream into an existing `dst` stream. tags: [ Produce stream ] parameters: - $ref: "#/components/parameters/stream_dst_path" responses: default: description: "" /api/stream.flv?dst={dst}: post: summary: Post stream in FLV format description: "[Incoming sources](https://github.com/AlexxIT/go2rtc#incoming-sources)" tags: [ Produce stream ] parameters: - $ref: "#/components/parameters/stream_dst_path" responses: default: description: "" /api/stream.ts?dst={dst}: post: summary: Post stream in MPEG-TS format description: "[Incoming sources](https://github.com/AlexxIT/go2rtc#incoming-sources)" tags: [ Produce stream ] parameters: - $ref: "#/components/parameters/stream_dst_path" responses: default: description: "" /api/stream.mjpeg?dst={dst}: post: summary: Post stream in MJPEG format description: "[Incoming sources](https://github.com/AlexxIT/go2rtc#incoming-sources)" tags: [ Produce stream ] parameters: - $ref: "#/components/parameters/stream_dst_path" responses: default: description: "" /api/ffmpeg: post: summary: Play file/live/TTS into a stream via FFmpeg description: | Helper endpoint for "stream to camera" scenarios. Exactly one of `file`, `live`, `text` should be provided. tags: [ FFmpeg ] parameters: - name: dst in: query description: Destination stream name required: true schema: { type: string } example: camera1 - name: file in: query description: Input URL to treat as file (`#input=file`) required: false schema: { type: string } example: "http://example.com/song.mp3" - name: live in: query description: Live input URL required: false schema: { type: string } example: "http://example.com/live.mp3" - name: text in: query description: Text-to-speech phrase required: false schema: { type: string } example: "Hello" - name: voice in: query description: Optional TTS voice (engine-dependent) required: false schema: { type: string } responses: "200": description: OK "400": description: Invalid parameters "404": description: Stream not found /api/dvrip: get: summary: DVRIP cameras discovery description: "[Source: DVRIP](https://github.com/AlexxIT/go2rtc#source-dvrip)" tags: [ Discovery ] responses: "200": { $ref: "#/components/responses/discovery" } /api/ffmpeg/devices: get: summary: FFmpeg USB devices discovery description: "[Source: FFmpeg Device](https://github.com/AlexxIT/go2rtc#source-ffmpeg-device)" tags: [ Discovery ] responses: "200": { $ref: "#/components/responses/discovery" } /api/ffmpeg/hardware: get: summary: FFmpeg hardware transcoding discovery description: "[Hardware acceleration](https://github.com/AlexxIT/go2rtc/wiki/Hardware-acceleration)" tags: [ Discovery ] responses: "200": { $ref: "#/components/responses/discovery" } /api/v4l2: get: summary: V4L2 video devices discovery (Linux) tags: [ Discovery ] responses: "200": { $ref: "#/components/responses/discovery" } /api/alsa: get: summary: ALSA audio devices discovery (Linux) tags: [ Discovery ] responses: "200": { $ref: "#/components/responses/discovery" } /api/gopro: get: summary: GoPro cameras discovery tags: [ Discovery ] responses: "200": { $ref: "#/components/responses/discovery" } /api/ring: get: summary: Ring cameras discovery description: | Provide either `email`/`password` (and optional `code` for 2FA) or `refresh_token`. If 2FA is required, returns a JSON prompt instead of sources. tags: [ Discovery ] parameters: - name: email in: query required: false schema: { type: string } - name: password in: query required: false schema: { type: string } - name: code in: query required: false schema: { type: string } - name: refresh_token in: query required: false schema: { type: string } responses: "200": description: OK content: application/json: { example: "" } /api/tuya: get: summary: Tuya cameras discovery tags: [ Discovery ] parameters: - name: region in: query description: Tuya API host (region) required: true schema: { type: string } example: "openapi.tuyaus.com" - name: email in: query required: true schema: { type: string } - name: password in: query required: true schema: { type: string } responses: "200": { $ref: "#/components/responses/discovery" } "400": description: Invalid parameters "404": description: No cameras found /api/hass: get: summary: Home Assistant cameras discovery description: "[Source: Hass](https://github.com/AlexxIT/go2rtc#source-hass)" tags: [ Discovery ] responses: "200": { $ref: "#/components/responses/discovery" } "404": { description: No Hass config } /api/discovery/homekit: get: summary: HomeKit cameras discovery description: "[Source: HomeKit](https://github.com/AlexxIT/go2rtc#source-homekit)" tags: [ Discovery ] responses: "200": { $ref: "#/components/responses/discovery" } /api/nest: get: summary: Nest cameras discovery tags: [ Discovery ] parameters: - name: client_id in: query required: true schema: { type: string } - name: client_secret in: query required: true schema: { type: string } - name: refresh_token in: query required: true schema: { type: string } - name: project_id in: query required: true schema: { type: string } responses: "200": { $ref: "#/components/responses/discovery" } /api/onvif: get: summary: ONVIF cameras discovery description: "[Source: ONVIF](https://github.com/AlexxIT/go2rtc#source-onvif)" tags: [ Discovery ] parameters: - name: src in: query description: Optional ONVIF device URL to enumerate profiles required: false schema: { type: string } example: "onvif://user:pass@192.168.1.50:80" responses: "200": { $ref: "#/components/responses/discovery" } /api/roborock: get: summary: Roborock vacuums discovery (requires prior auth) description: "[Source: Roborock](https://github.com/AlexxIT/go2rtc#source-roborock)" tags: [ Discovery ] responses: "200": { $ref: "#/components/responses/discovery" } "404": description: No auth post: summary: Roborock login and discovery tags: [ Discovery ] requestBody: required: true content: multipart/form-data: schema: type: object properties: username: { type: string } password: { type: string } required: [ username, password ] responses: "200": { $ref: "#/components/responses/discovery" } /api/homekit: get: summary: Get HomeKit servers state tags: [ HomeKit ] parameters: - name: id in: query description: Optional stream name (server ID) required: false schema: { type: string } responses: "200": description: OK content: application/json: { example: "" } "404": description: Server not found post: summary: Pair HomeKit camera and create/update stream tags: [ HomeKit ] parameters: - name: id in: query description: Stream name to create/update required: true schema: { type: string } - name: src in: query description: HomeKit URL (without pin) required: true schema: { type: string } - name: pin in: query description: HomeKit PIN required: true schema: { type: string } responses: "200": description: OK delete: summary: Unpair HomeKit camera and delete stream tags: [ HomeKit ] parameters: - name: id in: query description: Stream name / server ID required: true schema: { type: string } responses: "200": description: OK "404": description: Stream not found /api/homekit/accessories: get: summary: Get HomeKit accessories JSON for a stream tags: [ HomeKit ] parameters: - name: id in: query description: Stream name required: true schema: { type: string } responses: "200": description: OK content: application/json: { example: { } } "404": description: Stream not found /pair-setup: post: summary: HomeKit Pair Setup (HAP) description: HomeKit Accessory Protocol endpoint (TLV8). tags: [ HomeKit ] requestBody: required: true content: application/pairing+tlv8: { example: "" } responses: "200": description: OK content: application/pairing+tlv8: { example: "" } /pair-verify: post: summary: HomeKit Pair Verify (HAP) description: HomeKit Accessory Protocol endpoint (TLV8). tags: [ HomeKit ] requestBody: required: true content: application/pairing+tlv8: { example: "" } responses: "200": description: OK content: application/pairing+tlv8: { example: "" } /onvif/: get: summary: ONVIF server implementation description: Simple realisation of the ONVIF protocol. Accepts any suburl requests tags: [ ONVIF ] responses: default: description: "" /stream/: get: summary: RTSPtoWebRTC server implementation description: Simple API for support [RTSPtoWebRTC](https://www.home-assistant.io/integrations/rtsp_to_webrtc/) integration tags: [ RTSPtoWebRTC ] responses: default: description: "" /api/ws: get: summary: WebSocket endpoint description: | Upgrade to WebSocket and exchange JSON messages: - Request: `{ "type": "...", "value": ... }` - Response: `{ "type": "...", "value": ... }` Supported message types depend on enabled modules (see `api/README.md`). tags: [ WebSocket ] parameters: - name: src in: query description: Stream name (consumer) required: false schema: { type: string } - name: dst in: query description: Stream name (producer) required: false schema: { type: string } responses: "101": { description: Switching Protocols } /api/webtorrent?src={src}: get: summary: Get WebTorrent share info tags: [ WebTorrent ] parameters: - $ref: "#/components/parameters/stream_src_path" responses: 200: { $ref: "#/components/responses/webtorrent" } post: summary: Add WebTorrent share tags: [ WebTorrent ] parameters: - $ref: "#/components/parameters/stream_src_path" responses: 200: { $ref: "#/components/responses/webtorrent" } delete: summary: Delete WebTorrent share tags: [ WebTorrent ] parameters: - $ref: "#/components/parameters/stream_src_path" responses: default: { description: "" } /api/webtorrent: get: summary: Get all WebTorrent shares info tags: [ WebTorrent ] responses: 200: { $ref: "#/components/responses/discovery" } /api/stack: get: summary: Show list unknown goroutines tags: [ Debug ] responses: 200: description: "" content: { text/plain: { example: "" } }