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

# Probe a Source Stream

> Inspect a source stream and list its video, audio, and data tracks before creating a live stream.

## Overview

A preflight check that connects to a source URL and reports the tracks it
carries, without creating anything. Use it to:

* Verify the source is reachable before scheduling a stream.
* Find the right audio track for `audio_selections[].source`.
* Check for data tracks such as SCTE-35 ad markers.

<Info>
  SRT sources are supported today; RTMP and HLS ingest are coming soon. Note
  the trailing slash in the path: `POST /stream/probe/`.
</Info>

## Example request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://client.camb.ai/apis/stream/probe/" \
    -H "x-api-key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "url": "srt://ingest.example.com:9000",
      "passphrase": "my-secret-passphrase",
      "stream_id": "live/primary"
    }'
  ```

  ```python Python theme={null}
  import requests

  payload = {
      "url": "srt://ingest.example.com:9000",
      # Only needed if the source is encrypted / requires a streamid:
      "passphrase": "my-secret-passphrase",
      "stream_id": "live/primary",
  }

  response = requests.post(
      "https://client.camb.ai/apis/stream/probe/",
      headers={"x-api-key": "YOUR_API_KEY"},
      json=payload,
  )

  response.raise_for_status()
  print(response.json())
  ```
</CodeGroup>

A reachable source returns its tracks:

<CodeGroup>
  ```json Response theme={null}
  {
    "video_streams": [
      {
        "index": 0,
        "codec_name": "h264",
        "width": 1920,
        "height": 1080,
        "frame_rate": "25/1"
      }
    ],
    "audio_streams": [
      {
        "index": 1,
        "codec_name": "aac",
        "sample_rate": 48000,
        "channels": 2,
        "channel_layout": "stereo",
        "tags": { "language": "eng" }
      }
    ],
    "data_streams": []
  }
  ```
</CodeGroup>

## From probe to create

Pick the audio track to process and reference it in your create payload's
`audio_selections`. Selectors count within a track type, so the first audio
track is `a:0` regardless of its overall index:

```json theme={null}
{
  "audio_selections": [
    { "id": "commentary", "source": "a:0", "source_language": 1 }
  ]
}
```

If you are unsure which track carries speech, start with `$first_audio`.

## Errors

* `422` - Validation error, or the source could not be reached.

## Related endpoints

* [Create a Stream](create-new-stream)
* [Get Stream Status](get-stream-status)


## OpenAPI

````yaml post /stream/probe/
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://client.camb.ai/apis
security: []
paths:
  /stream/probe/:
    post:
      tags:
        - Apis
        - Streaming
      summary: Probe Stream
      description: >-
        Inspect a source URL and list its video, audio, and data tracks before
        creating a stream. Note the trailing slash in the path.
      operationId: get_probe_stream_stream_probe_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetProbeStreamIn'
            example:
              url: srt://ingest.example.com:9000
      responses:
        '200':
          description: Tracks discovered in the source.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetProbeStreamOut'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    GetProbeStreamIn:
      properties:
        url:
          type: string
          title: Url
          description: Source stream URL to probe, e.g. `srt://example.com:9000`.
        passphrase:
          anyOf:
            - type: string
            - type: 'null'
          title: Passphrase
          description: >-
            Optional passphrase for authenticated streams (commonly used with
            SRT).
        stream_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Stream Id
          description: >-
            Optional SRT `streamid` the source requires. This is not the Camb.ai
            stream ID.
      type: object
      required:
        - url
      title: GetProbeStreamIn
    GetProbeStreamOut:
      properties:
        video_streams:
          items:
            $ref: '#/components/schemas/VideoStream'
          type: array
          title: Video Streams
          description: Video tracks discovered in the source stream.
        audio_streams:
          items:
            $ref: '#/components/schemas/AudioStream'
          type: array
          title: Audio Streams
          description: Audio tracks discovered in the source stream.
        data_streams:
          items:
            $ref: '#/components/schemas/DataStream'
          type: array
          title: Data Streams
          description: >-
            Data tracks discovered in the source stream (e.g., SCTE-35 ad
            markers).
      type: object
      title: GetProbeStreamOut
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    VideoStream:
      type: object
      title: VideoStream
      properties:
        index:
          type: integer
          title: Index
          description: Track index within the source.
        codec_name:
          type: string
          title: Codec Name
          description: Video codec, e.g. `h264`.
        width:
          anyOf:
            - type: integer
            - type: 'null'
          title: Width
        height:
          anyOf:
            - type: integer
            - type: 'null'
          title: Height
        frame_rate:
          anyOf:
            - type: string
            - type: 'null'
          title: Frame Rate
          description: Frame rate as a fraction, e.g. `25/1`.
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: ID
          description: >-
            MPEG-TS PID of the track (hex string), when the source is MPEG-TS.
            Usable in selectors like `i:301`.
    AudioStream:
      type: object
      title: AudioStream
      properties:
        index:
          type: integer
          title: Index
          description: Track index within the source.
        codec_name:
          type: string
          title: Codec Name
          description: Audio codec, e.g. `aac`.
        sample_rate:
          type: integer
          title: Sample Rate
          description: Sample rate in Hz, e.g. `48000`.
        channels:
          type: integer
          title: Channels
          description: Number of audio channels.
        channel_layout:
          anyOf:
            - type: string
            - type: 'null'
          title: Channel Layout
          description: Channel layout, e.g. `stereo`.
        tags:
          anyOf:
            - type: object
              additionalProperties: true
            - type: 'null'
          title: Tags
          description: >-
            Track metadata from the source, e.g. `{"language": "eng"}`. Useful
            for picking the right track.
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: ID
          description: >-
            MPEG-TS PID of the track (hex string), when the source is MPEG-TS.
            Usable in selectors like `i:301`.
    DataStream:
      type: object
      title: DataStream
      properties:
        index:
          type: integer
          title: Index
          description: Track index within the source.
        codec_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Codec Name
          description: Data codec, e.g. `scte_35`.
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: ID
          description: >-
            MPEG-TS PID of the track (hex string), when the source is MPEG-TS.
            Usable in selectors like `i:301`.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        The `x-api-key` is a custom header required for authenticating requests
        to our API. Include this header in your request with the appropriate API
        key value to securely access our endpoints. You can find your API key(s)
        in the 'API' section of our studio website.

````