> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tenbyte.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create stream



## OpenAPI

````yaml https://raw.githubusercontent.com/vidinfra/open-api-docs/refs/heads/main/livestream-api.json post /streams
openapi: 3.0.1
info:
  title: Tenbyte Livestream API
  description: >-
    Live video and audio transcoding infrastructure as a service. Ingest via
    RTMP/SRT (push) or pull from upstream sources, transcode to adaptive
    bitrate, deliver via HLS/DASH.
  version: 1.0.0
servers:
  - url: https://api.tenbyte.io/v1/livestream
    description: Production server
security:
  - BearerAuth: []
  - apikey-header-X-API-Key: []
tags:
  - name: Health
  - name: Streams
  - name: Webhooks
paths:
  /streams:
    post:
      tags:
        - Streams
      summary: Create stream
      operationId: createStream
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StreamCreateRequest'
            examples:
              videoPush:
                value:
                  name: Live TV Channel
                  type: linear
                  mode: video
                  region: sg-edge-04
                  ingest:
                    kind: push
                    protocols:
                      - rtmp
                      - srt
                  output_protocols:
                    - hls
                    - dash
                  ladder:
                    video:
                      - name: 1080p
                        width: 1920
                        height: 1080
                        fps: 25
                        gop: 50
                        bitrate_kbps: 3000
                        max_bitrate_kbps: 3500
                        buf_size_kbps: 6000
                        codec: h264
                        preset: veryfast
                        profile: main
                        level: '4.0'
                        rate_control: cbr
                        crf: 21
                        bframes: 0
                        ref_frames: 1
                        rc_lookahead: 10
                        audio:
                          codec: aac
                          channels: 2
                          sample_rate_hz: 48000
                          audio_bitrate_kbps: 128
                      - name: 720p
                        width: 1280
                        height: 720
                        fps: 25
                        gop: 50
                        bitrate_kbps: 1500
                        max_bitrate_kbps: 2000
                        buf_size_kbps: 4000
                        codec: h264
                        preset: veryfast
                        profile: main
                        level: '4.0'
                        rate_control: cbr
                        crf: 23
                        bframes: 0
                        ref_frames: 1
                        rc_lookahead: 10
                        audio:
                          codec: aac
                          channels: 2
                          sample_rate_hz: 48000
                          audio_bitrate_kbps: 96
                      - name: 480p
                        width: 854
                        height: 480
                        fps: 25
                        gop: 50
                        bitrate_kbps: 700
                        max_bitrate_kbps: 900
                        buf_size_kbps: 1800
                        codec: h264
                        preset: veryfast
                        profile: main
                        level: '3.1'
                        rate_control: cbr
                        crf: 25
                        bframes: 0
                        ref_frames: 1
                        rc_lookahead: 10
                        audio:
                          codec: aac
                          channels: 2
                          sample_rate_hz: 48000
                          audio_bitrate_kbps: 64
                  packaging:
                    hls:
                      segment_format: mpegts
                      playlist_size: 6
                      preserved_segments: 6
                      low_latency: false
                    dash:
                      segment_format: fmp4
                      window_s: 60
                      min_buffer_s: 4
                summary: Video — push ingest (RTMP/SRT)
              videoPull:
                value:
                  name: Live TV Channel
                  type: linear
                  mode: video
                  region: sg-edge-04
                  ingest:
                    kind: pull
                    primary:
                      protocol: srt
                      url: >-
                        srt://ingest.upstream.tv:9000?streamid=ch4-main&latency=200
                    backup:
                      protocol: srt
                      url: srt://ingest-backup.upstream.tv:9000?streamid=ch4-bk
                  output_protocols:
                    - hls
                    - dash
                  ladder:
                    video:
                      - name: 1080p
                        width: 1920
                        height: 1080
                        fps: 25
                        gop: 50
                        bitrate_kbps: 3000
                        max_bitrate_kbps: 3500
                        buf_size_kbps: 6000
                        codec: h264
                        preset: veryfast
                        profile: main
                        level: '4.0'
                        rate_control: cbr
                        crf: 21
                        bframes: 0
                        ref_frames: 1
                        rc_lookahead: 10
                        audio:
                          codec: aac
                          channels: 2
                          sample_rate_hz: 48000
                          audio_bitrate_kbps: 128
                  packaging:
                    hls:
                      segment_format: mpegts
                      playlist_size: 6
                      preserved_segments: 6
                      low_latency: false
                    dash:
                      segment_format: fmp4
                      window_s: 60
                      min_buffer_s: 4
                summary: Video — pull ingest (SRT primary + backup)
              audioPush:
                value:
                  name: Radio Live Stream
                  type: linear
                  mode: audio
                  region: sg-edge-04
                  ingest:
                    kind: push
                    protocols:
                      - rtmp
                      - srt
                  output_protocols:
                    - hls
                  ladder:
                    audio:
                      - name: 256k
                        codec: aac
                        channels: 2
                        sample_rate_hz: 48000
                        bitrate_kbps: 256
                      - name: 128k
                        codec: aac
                        channels: 2
                        sample_rate_hz: 48000
                        bitrate_kbps: 128
                      - name: 64k
                        codec: aac
                        channels: 2
                        sample_rate_hz: 48000
                        bitrate_kbps: 64
                  packaging:
                    hls:
                      segment_format: mpegts
                      playlist_size: 6
                      preserved_segments: 6
                      low_latency: false
                summary: Audio — push ingest, HLS only
              audioPull:
                value:
                  name: Radio Live Stream
                  type: linear
                  mode: audio
                  region: sg-edge-04
                  ingest:
                    kind: pull
                    primary:
                      protocol: srt
                      url: >-
                        srt://ingest.upstream.tv:9000?streamid=radio-main&latency=200
                    backup:
                      protocol: srt
                      url: srt://ingest-backup.upstream.tv:9000?streamid=radio-bk
                  output_protocols:
                    - hls
                  ladder:
                    audio:
                      - name: 256k
                        codec: aac
                        channels: 2
                        sample_rate_hz: 48000
                        bitrate_kbps: 256
                      - name: 128k
                        codec: aac
                        channels: 2
                        sample_rate_hz: 48000
                        bitrate_kbps: 128
                      - name: 64k
                        codec: aac
                        channels: 2
                        sample_rate_hz: 48000
                        bitrate_kbps: 64
                  packaging:
                    hls:
                      segment_format: mpegts
                      playlist_size: 6
                      preserved_segments: 6
                      low_latency: false
                summary: Audio — pull ingest with backup, HLS only
              videoWithRecording:
                value:
                  name: National Evening News
                  type: linear
                  mode: video
                  region: bd-edge-01
                  ingest:
                    kind: push
                    protocols:
                      - rtmp
                  output_protocols:
                    - hls
                  ladder:
                    video:
                      - name: 720p
                        width: 1280
                        height: 720
                        fps: 30
                        gop: 60
                        bitrate_kbps: 2000
                        max_bitrate_kbps: 2500
                        buf_size_kbps: 4000
                        codec: h264
                        preset: veryfast
                        profile: main
                        level: '4.0'
                        rate_control: cbr
                        bframes: 0
                        ref_frames: 1
                        rc_lookahead: 10
                        audio:
                          codec: aac
                          channels: 2
                          sample_rate_hz: 48000
                          audio_bitrate_kbps: 128
                  packaging:
                    hls:
                      segment_format: mpegts
                      playlist_size: 6
                      preserved_segments: 6
                      low_latency: true
                  recording:
                    enabled: true
                    target: library
                    library_id: lib_m3n4o5
                    folder_id: fld_p6q7r8
                    prefix: news_evening
                  webhook_url: https://yourapp.com/webhooks/live
                  meta:
                    channel: news
                    priority: high
                summary: Video push + library recording + webhook + meta
        required: true
      responses:
        '201':
          description: Stream created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StreamSuccessResponse'
              examples:
                videoPushCreated:
                  summary: Video push stream created
                  value:
                    success: true
                    message: Created Successfully
                    data:
                      id: 0000cf2e-ae90-46bc-b119-f5f626258434
                      organization_id: 7f8c3a2e-1d4b-4e5a-9c6d-2b8e1f3a4d5c
                      name: Live TV Channel
                      type: linear
                      mode: video
                      status: idle
                      region: sg-edge-04
                      stream_key: 9f4c8a1e-2b6d-4e3f-8a7c-1d5b9e6f3a2c
                      ingest:
                        kind: push
                        protocols:
                          - rtmp
                          - srt
                        rtmp: rtmp://ingest.sg.vidinfra.com:1935/live
                        srt: >-
                          srt://ingest.sg.vidinfra.com:9710?streamid=#!::r=live/9f4c8a1e-2b6d-4e3f-8a7c-1d5b9e6f3a2c,m=publish
                      output_protocols:
                        - hls
                        - dash
                      ladder:
                        video:
                          - name: 1080p
                            width: 1920
                            height: 1080
                            fps: 25
                            gop: 50
                            bitrate_kbps: 3000
                            max_bitrate_kbps: 3500
                            buf_size_kbps: 6000
                            crf: 21
                            codec: h264
                            preset: veryfast
                            profile: main
                            level: '4.0'
                            rate_control: cbr
                            ref_frames: 1
                            rc_lookahead: 10
                            audio:
                              codec: aac
                              channels: 2
                              sample_rate_hz: 48000
                              audio_bitrate_kbps: 128
                          - name: 720p
                            width: 1280
                            height: 720
                            fps: 25
                            gop: 50
                            bitrate_kbps: 1500
                            max_bitrate_kbps: 2000
                            buf_size_kbps: 4000
                            crf: 23
                            codec: h264
                            preset: veryfast
                            profile: main
                            level: '4.0'
                            rate_control: cbr
                            ref_frames: 1
                            rc_lookahead: 10
                            audio:
                              codec: aac
                              channels: 2
                              sample_rate_hz: 48000
                              audio_bitrate_kbps: 96
                      packaging:
                        hls:
                          segment_format: mpegts
                          playlist_size: 6
                          preserved_segments: 6
                          low_latency: false
                        dash:
                          segment_format: fmp4
                          window_s: 60
                          min_buffer_s: 4
                      playback:
                        hls: >-
                          https://cdn.vidinfra.com/0000cf2e-ae90-46bc-b119-f5f626258434/master.m3u8
                        dash: >-
                          https://cdn.vidinfra.com/0000cf2e-ae90-46bc-b119-f5f626258434/manifest.mpd
                      meta: {}
                      created_at: '2026-04-26T10:15:30Z'
                      updated_at: '2026-04-26T10:15:30Z'
                videoPullCreated:
                  summary: Video pull stream created (primary + backup)
                  value:
                    success: true
                    message: Created Successfully
                    data:
                      id: 1a2b3c4d-5e6f-7890-abcd-ef0123456789
                      organization_id: 7f8c3a2e-1d4b-4e5a-9c6d-2b8e1f3a4d5c
                      name: Live TV Channel
                      type: linear
                      mode: video
                      status: idle
                      region: sg-edge-04
                      stream_key: 3c2b1a09-8d7e-6f5a-4b3c-2d1e0f9a8b7c
                      ingest:
                        kind: pull
                        primary:
                          protocol: srt
                          url: >-
                            srt://ingest.upstream.tv:9000?streamid=ch4-main&latency=200
                        backup:
                          protocol: srt
                          url: srt://ingest-backup.upstream.tv:9000?streamid=ch4-bk
                      output_protocols:
                        - hls
                        - dash
                      ladder:
                        video:
                          - name: 1080p
                            width: 1920
                            height: 1080
                            fps: 25
                            gop: 50
                            bitrate_kbps: 3000
                            max_bitrate_kbps: 3500
                            buf_size_kbps: 6000
                            crf: 21
                            codec: h264
                            preset: veryfast
                            profile: main
                            level: '4.0'
                            rate_control: cbr
                            ref_frames: 1
                            rc_lookahead: 10
                            audio:
                              codec: aac
                              channels: 2
                              sample_rate_hz: 48000
                              audio_bitrate_kbps: 128
                      packaging:
                        hls:
                          segment_format: mpegts
                          playlist_size: 6
                          preserved_segments: 6
                          low_latency: false
                        dash:
                          segment_format: fmp4
                          window_s: 60
                          min_buffer_s: 4
                      playback:
                        hls: >-
                          https://cdn.vidinfra.com/1a2b3c4d-5e6f-7890-abcd-ef0123456789/master.m3u8
                        dash: >-
                          https://cdn.vidinfra.com/1a2b3c4d-5e6f-7890-abcd-ef0123456789/manifest.mpd
                      meta: {}
                      created_at: '2026-04-26T10:20:00Z'
                      updated_at: '2026-04-26T10:20:00Z'
                audioCreated:
                  summary: Audio stream created (push, HLS only)
                  value:
                    success: true
                    message: Created Successfully
                    data:
                      id: 8b7a6c5d-4e3f-2a1b-9c8d-7e6f5a4b3c2d
                      organization_id: 7f8c3a2e-1d4b-4e5a-9c6d-2b8e1f3a4d5c
                      name: Radio Live Stream
                      type: linear
                      mode: audio
                      status: idle
                      region: sg-edge-04
                      stream_key: 5e4d3c2b-1a09-8d7e-6f5a-4b3c2d1e0f9a
                      ingest:
                        kind: push
                        protocols:
                          - rtmp
                          - srt
                        rtmp: rtmp://ingest.sg.vidinfra.com:1935/live
                        srt: >-
                          srt://ingest.sg.vidinfra.com:9710?streamid=#!::r=live/5e4d3c2b-1a09-8d7e-6f5a-4b3c2d1e0f9a,m=publish
                      output_protocols:
                        - hls
                      ladder:
                        audio:
                          - name: 256k
                            codec: aac
                            channels: 2
                            sample_rate_hz: 48000
                            bitrate_kbps: 256
                          - name: 128k
                            codec: aac
                            channels: 2
                            sample_rate_hz: 48000
                            bitrate_kbps: 128
                          - name: 64k
                            codec: aac
                            channels: 2
                            sample_rate_hz: 48000
                            bitrate_kbps: 64
                      packaging:
                        hls:
                          segment_format: mpegts
                          playlist_size: 6
                          preserved_segments: 6
                          low_latency: false
                      playback:
                        hls: >-
                          https://cdn.vidinfra.com/8b7a6c5d-4e3f-2a1b-9c8d-7e6f5a4b3c2d/master.m3u8
                      meta: {}
                      created_at: '2026-04-26T10:25:00Z'
                      updated_at: '2026-04-26T10:25:00Z'
                videoWithRecordingCreated:
                  summary: Video stream + library recording + webhook + meta
                  value:
                    success: true
                    message: Created Successfully
                    data:
                      id: 2f3e4d5c-6b7a-8910-1234-56789abcdef0
                      organization_id: 7f8c3a2e-1d4b-4e5a-9c6d-2b8e1f3a4d5c
                      name: National Evening News
                      type: linear
                      mode: video
                      status: idle
                      region: bd-edge-01
                      stream_key: a1b2c3d4-5e6f-7890-abcd-ef0987654321
                      ingest:
                        kind: push
                        protocols:
                          - rtmp
                        rtmp: rtmp://ingest.bd.vidinfra.com:1935/live
                        srt: >-
                          srt://ingest.bd.vidinfra.com:9710?streamid=#!::r=live/a1b2c3d4-5e6f-7890-abcd-ef0987654321,m=publish
                      output_protocols:
                        - hls
                      ladder:
                        video:
                          - name: 720p
                            width: 1280
                            height: 720
                            fps: 30
                            gop: 60
                            bitrate_kbps: 2000
                            max_bitrate_kbps: 2500
                            buf_size_kbps: 4000
                            codec: h264
                            preset: veryfast
                            profile: main
                            level: '4.0'
                            rate_control: cbr
                            ref_frames: 1
                            rc_lookahead: 10
                            audio:
                              codec: aac
                              channels: 2
                              sample_rate_hz: 48000
                              audio_bitrate_kbps: 128
                      packaging:
                        hls:
                          segment_format: mpegts
                          playlist_size: 6
                          preserved_segments: 6
                          low_latency: true
                      playback:
                        hls: >-
                          https://cdn.vidinfra.com/2f3e4d5c-6b7a-8910-1234-56789abcdef0/master.m3u8
                      recording:
                        enabled: true
                        target: library
                        library_id: lib_m3n4o5
                        folder_id: fld_p6q7r8
                        prefix: news_evening
                      webhook_url: https://yourapp.com/webhooks/live
                      meta:
                        channel: news
                        priority: high
                      created_at: '2026-04-26T10:30:00Z'
                      updated_at: '2026-04-26T10:30:00Z'
          headers: {}
        '400':
          $ref: '#/components/responses/BadRequest'
          description: Invalid request payload
        '401':
          $ref: '#/components/responses/Unauthorized'
          description: Missing or invalid authentication
        '422':
          $ref: '#/components/responses/ValidationError'
          description: Input validation failed
      deprecated: false
      security:
        - BearerAuth: []
        - apikey-header-X-API-Key: []
components:
  schemas:
    StreamCreateRequest:
      type: object
      required:
        - name
        - type
        - mode
        - region
        - ingest
        - output_protocols
        - ladder
        - packaging
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 255
        type:
          $ref: '#/components/schemas/StreamType'
        mode:
          $ref: '#/components/schemas/StreamMode'
        region:
          type: string
          description: Region code, e.g. `sg-edge-04`, `bd-edge-01`.
        ingest:
          $ref: '#/components/schemas/IngestRequest'
        output_protocols:
          type: array
          minItems: 1
          maxItems: 2
          uniqueItems: true
          items:
            $ref: '#/components/schemas/OutputProtocol'
          description: '`dash` not allowed when `mode=audio`.'
        ladder:
          $ref: '#/components/schemas/LadderRequest'
        packaging:
          $ref: '#/components/schemas/PackagingRequest'
        recording:
          $ref: '#/components/schemas/RecordingRequest'
        webhook_url:
          type: string
          format: uri
        meta:
          type: object
          additionalProperties: true
          description: Custom key-value metadata
          properties: {}
    StreamSuccessResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
        data:
          $ref: '#/components/schemas/StreamResource'
    StreamType:
      type: string
      enum:
        - linear
        - event
      description: '`linear` (24/7) or `event` (up to 6h)'
    StreamMode:
      type: string
      enum:
        - video
        - audio
    IngestRequest:
      type: object
      required:
        - kind
      properties:
        kind:
          $ref: '#/components/schemas/IngestKind'
        protocols:
          type: array
          minItems: 1
          uniqueItems: true
          items:
            $ref: '#/components/schemas/IngestPushProtocol'
          description: >-
            Required when `kind=push`. Server emits the corresponding RTMP/SRT
            publish URLs.
        primary:
          allOf:
            - $ref: '#/components/schemas/IngestEndpointRequest'
          description: Required when `kind=pull`. Disallowed for `push`.
        backup:
          allOf:
            - $ref: '#/components/schemas/IngestEndpointRequest'
          description: >-
            Optional fallback endpoint. Allowed for both `push` (secondary
            publish target) and `pull` (failover source).
    OutputProtocol:
      type: string
      enum:
        - hls
        - dash
    LadderRequest:
      type: object
      description: |
        Provide `video[]` for `mode=video` (max 6 renditions) or `audio[]` for
        `mode=audio` (max 3 renditions). Mixing is rejected.
      properties:
        video:
          type: array
          minItems: 1
          maxItems: 6
          items:
            $ref: '#/components/schemas/VideoRenditionRequest'
        audio:
          type: array
          minItems: 1
          maxItems: 3
          items:
            $ref: '#/components/schemas/AudioRenditionRequest'
    PackagingRequest:
      type: object
      description: |
        Per-protocol settings. `hls` required when `output_protocols` includes
        `hls`. `dash` required when `output_protocols` includes `dash`. `dash`
        is not allowed for `mode=audio`.
      properties:
        hls:
          $ref: '#/components/schemas/HLSPackaging'
        dash:
          $ref: '#/components/schemas/DASHPackaging'
    RecordingRequest:
      type: object
      properties:
        enabled:
          type: boolean
          default: false
        target:
          $ref: '#/components/schemas/RecordingTarget'
        library_id:
          type: string
          description: Required when target = library
        folder_id:
          type: string
        prefix:
          type: string
        s3_config:
          $ref: '#/components/schemas/S3ConfigRequest'
    StreamResource:
      type: object
      properties:
        id:
          type: string
        organization_id:
          type: string
        name:
          type: string
        type:
          $ref: '#/components/schemas/StreamType'
        mode:
          $ref: '#/components/schemas/StreamMode'
        status:
          $ref: '#/components/schemas/StreamStatus'
        region:
          type: string
        stream_key:
          type: string
        ingest:
          $ref: '#/components/schemas/IngestResource'
        output_protocols:
          type: array
          items:
            $ref: '#/components/schemas/OutputProtocol'
        packaging:
          $ref: '#/components/schemas/PackagingResource'
        ladder:
          $ref: '#/components/schemas/LadderResource'
        playback:
          $ref: '#/components/schemas/PlaybackResource'
        recording:
          $ref: '#/components/schemas/RecordingResource'
        webhook_url:
          type: string
        meta:
          type: object
          additionalProperties: true
          properties: {}
        last_live_at:
          type: string
          format: date-time
          nullable: true
        last_ended_at:
          type: string
          format: date-time
          nullable: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        code:
          type: string
        message:
          type: string
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ErrorItem'
    IngestKind:
      type: string
      enum:
        - push
        - pull
    IngestPushProtocol:
      type: string
      enum:
        - rtmp
        - srt
    IngestEndpointRequest:
      type: object
      required:
        - protocol
        - url
      properties:
        protocol:
          $ref: '#/components/schemas/IngestPullProtocol'
        url:
          type: string
          format: uri
    VideoRenditionRequest:
      type: object
      required:
        - width
        - height
        - fps
        - gop
        - bitrate_kbps
        - codec
        - audio
      properties:
        name:
          type: string
        width:
          type: integer
          maximum: 2560
        height:
          type: integer
          enum:
            - 240
            - 360
            - 480
            - 720
            - 1080
            - 1440
        fps:
          type: integer
          enum:
            - 24
            - 25
            - 30
            - 60
        gop:
          type: integer
        bitrate_kbps:
          type: integer
        max_bitrate_kbps:
          type: integer
        buf_size_kbps:
          type: integer
        crf:
          type: integer
          minimum: 0
          maximum: 51
        codec:
          $ref: '#/components/schemas/VideoCodec'
        preset:
          type: string
        profile:
          type: string
        level:
          type: string
        rate_control:
          $ref: '#/components/schemas/RateControl'
        bframes:
          type: integer
        ref_frames:
          type: integer
        rc_lookahead:
          type: integer
        audio:
          $ref: '#/components/schemas/VideoRenditionAudio'
    AudioRenditionRequest:
      type: object
      required:
        - codec
        - channels
        - sample_rate_hz
        - bitrate_kbps
      properties:
        name:
          type: string
        codec:
          $ref: '#/components/schemas/AudioCodec'
        channels:
          type: integer
          enum:
            - 1
            - 2
            - 6
        sample_rate_hz:
          type: integer
          enum:
            - 22050
            - 32000
            - 44100
            - 48000
        bitrate_kbps:
          type: integer
          minimum: 64
          maximum: 256
    HLSPackaging:
      type: object
      required:
        - segment_format
      properties:
        segment_format:
          $ref: '#/components/schemas/HLSSegmentFormat'
        playlist_size:
          type: integer
        preserved_segments:
          type: integer
        low_latency:
          type: boolean
    DASHPackaging:
      type: object
      required:
        - segment_format
      properties:
        segment_format:
          $ref: '#/components/schemas/DASHSegmentFormat'
        window_s:
          type: integer
        min_buffer_s:
          type: integer
    RecordingTarget:
      type: string
      enum:
        - library
        - s3
    S3ConfigRequest:
      type: object
      required:
        - endpoint
        - bucket
        - region
        - access_key_id
        - secret_access_key
      properties:
        endpoint:
          type: string
          format: uri
        bucket:
          type: string
        region:
          type: string
        access_key_id:
          type: string
        secret_access_key:
          type: string
          format: password
        prefix:
          type: string
        storage_class:
          type: string
    StreamStatus:
      type: string
      enum:
        - idle
        - starting
        - live
        - reconnecting
        - stopping
        - errored
    IngestResource:
      type: object
      description: |
        For `kind=push` the server echoes accepted `protocols` and emits `rtmp`
        + `srt` publish URLs derived from the auto-generated stream key. For
        `kind=pull` the submitted `primary` and optional `backup` endpoints are
        echoed back.
      properties:
        kind:
          $ref: '#/components/schemas/IngestKind'
        protocols:
          type: array
          items:
            $ref: '#/components/schemas/IngestPushProtocol'
          description: Push only.
        rtmp:
          type: string
          description: >-
            Push only. RTMP publish base URL: `rtmp://host:1935/live`. Pair with
            `stream_key`.
        srt:
          type: string
          description: >-
            Push only. SRT publish URL with SRS streamid encoding (key
            embedded).
        primary:
          $ref: '#/components/schemas/IngestEndpointResource'
        backup:
          $ref: '#/components/schemas/IngestEndpointResource'
    PackagingResource:
      type: object
      description: Echoed per-protocol packaging settings.
      properties:
        hls:
          $ref: '#/components/schemas/HLSPackagingResource'
        dash:
          $ref: '#/components/schemas/DASHPackagingResource'
    LadderResource:
      type: object
      description: >-
        Echoed ladder. Either `video[]` or `audio[]` is populated based on
        `mode`.
      properties:
        video:
          type: array
          items:
            $ref: '#/components/schemas/VideoRenditionResource'
        audio:
          type: array
          items:
            $ref: '#/components/schemas/AudioRenditionResource'
    PlaybackResource:
      type: object
      properties:
        hls:
          type: string
          description: HLS master playlist URL (null when `hls` not in `output_protocols`)
          nullable: true
        dash:
          type: string
          description: DASH manifest URL (null when `dash` not in `output_protocols`)
          nullable: true
    RecordingResource:
      type: object
      description: Null when recording is disabled
      properties:
        enabled:
          type: boolean
        target:
          $ref: '#/components/schemas/RecordingTarget'
        library_id:
          type: string
          nullable: true
        folder_id:
          type: string
          nullable: true
        prefix:
          type: string
          nullable: true
        s3_config:
          type: object
          properties: {}
          nullable: true
      nullable: true
    ErrorItem:
      type: object
      properties:
        field:
          type: string
          nullable: true
        code:
          type: string
        message:
          type: string
        details:
          type: object
          properties: {}
          nullable: true
    IngestPullProtocol:
      type: string
      enum:
        - srt
        - rtsp
        - rtmp
        - udp
    VideoCodec:
      type: string
      enum:
        - h264
        - h265
    RateControl:
      type: string
      enum:
        - cbr
        - vbr
    VideoRenditionAudio:
      type: object
      required:
        - codec
        - channels
        - sample_rate_hz
        - audio_bitrate_kbps
      properties:
        codec:
          $ref: '#/components/schemas/AudioCodec'
        channels:
          type: integer
          enum:
            - 1
            - 2
            - 6
        sample_rate_hz:
          type: integer
          enum:
            - 22050
            - 32000
            - 44100
            - 48000
        audio_bitrate_kbps:
          type: integer
          minimum: 64
          maximum: 256
    AudioCodec:
      type: string
      enum:
        - aac
    HLSSegmentFormat:
      type: string
      enum:
        - mpegts
        - fmp4
    DASHSegmentFormat:
      type: string
      enum:
        - fmp4
    IngestEndpointResource:
      type: object
      properties:
        protocol:
          $ref: '#/components/schemas/IngestPullProtocol'
        url:
          type: string
          format: uri
    HLSPackagingResource:
      type: object
      properties:
        segment_format:
          $ref: '#/components/schemas/HLSSegmentFormat'
        playlist_size:
          type: integer
        preserved_segments:
          type: integer
        low_latency:
          type: boolean
    DASHPackagingResource:
      type: object
      properties:
        segment_format:
          $ref: '#/components/schemas/DASHSegmentFormat'
        window_s:
          type: integer
        min_buffer_s:
          type: integer
    VideoRenditionResource:
      type: object
      properties:
        name:
          type: string
        width:
          type: integer
        height:
          type: integer
        fps:
          type: integer
        gop:
          type: integer
        bitrate_kbps:
          type: integer
        max_bitrate_kbps:
          type: integer
        buf_size_kbps:
          type: integer
        crf:
          type: integer
          description: Optional. Present only when set in the request.
        codec:
          $ref: '#/components/schemas/VideoCodec'
        preset:
          type: string
        profile:
          type: string
        level:
          type: string
        rate_control:
          $ref: '#/components/schemas/RateControl'
        bframes:
          type: integer
        ref_frames:
          type: integer
        rc_lookahead:
          type: integer
        audio:
          $ref: '#/components/schemas/VideoRenditionAudioResource'
    AudioRenditionResource:
      type: object
      properties:
        name:
          type: string
        codec:
          $ref: '#/components/schemas/AudioCodec'
        channels:
          type: integer
        sample_rate_hz:
          type: integer
        bitrate_kbps:
          type: integer
    VideoRenditionAudioResource:
      type: object
      properties:
        codec:
          $ref: '#/components/schemas/AudioCodec'
        channels:
          type: integer
        sample_rate_hz:
          type: integer
        audio_bitrate_kbps:
          type: integer
  responses:
    BadRequest:
      description: Invalid request payload
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            BadRequest:
              summary: Success
              value:
                success: false
                code: BAD_REQUEST
                message: Invalid request payload.
                errors:
                  - code: invalid_json
                    message: Malformed JSON at offset 42
    Unauthorized:
      description: Missing or invalid authentication
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            Unauthorized:
              summary: Success
              value:
                success: false
                code: UNAUTHORIZED
                message: >-
                  Missing authorization. Provide Authorization header or
                  X-API-Key header.
    ValidationError:
      description: Input validation failed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            ValidationError:
              summary: Success
              value:
                success: false
                code: VALIDATION_ERROR
                message: Some fields failed validation.
                errors:
                  - field: name
                    code: validation_required
                    message: cannot be blank
                  - field: ingest.kind
                    code: validation_required
                    message: ingest.kind is required
                  - field: ladder
                    code: validation_ladder_video_required
                    message: ladder.video is required for video streams
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: RSA-signed JWT token
    apikey-header-X-API-Key:
      type: apiKey
      in: header
      name: X-API-Key
      description: HMAC-signed API key with prefix `tkb`

````