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

# Create RTStream

> Create a new real-time stream connection

Create a new real-time stream by connecting to an RTSP or YouTube stream URL. The stream begins processing immediately.

<Note>
  * `url` is required and must be a valid RTSP or YouTube stream URL
  * `sample_rate` controls the frame sampling rate (default: 30)
  * `media_types` specifies which media to capture: `video`, `audio`, or both
  * Set `store` to `true` to persist stream recordings
  * Enable `enable_transcript` for automatic speech transcription
</Note>

<CardGroup cols={2}>
  <Card title="RTSP Ingest Guide" icon="wifi" href="/pages/ingest/live-streams/rtsp-ingest">
    Learn about RTSP stream ingestion
  </Card>

  <Card title="Stream Lifecycle" icon="arrow-right" href="/pages/ingest/live-streams/stream-lifecycle">
    Understand stream states
  </Card>
</CardGroup>


## OpenAPI

````yaml POST /rtstream/
openapi: 3.0.3
info:
  title: VideoDB Server API
  description: >
    VideoDB Server API for video, audio, and image processing with AI
    capabilities.

    This API provides comprehensive video management, search, indexing, and
    AI-powered features.
  version: 1.0.0
  contact:
    name: VideoDB Support
    url: https://videodb.io
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: https://api.videodb.io
    description: Production server
  - url: https://staging-api.videodb.io
    description: Staging server
security:
  - ApiKeyAuth: []
tags:
  - name: Authentication
    description: User authentication and API key management
  - name: Collections
    description: Collection management operations
  - name: Videos
    description: Video upload, processing, and management
  - name: Audio
    description: Audio management operations
  - name: Images
    description: Image management operations
  - name: Search
    description: Content search and indexing
  - name: AI Generation
    description: AI-powered content generation
  - name: Billing
    description: Billing and usage management
  - name: RTStream
    description: Real-time streaming operations
  - name: Utilities
    description: Utility endpoints
  - name: Meeting
    description: Meeting recording and management
  - name: Capture
    description: Capture session management for recording streams
  - name: Editor
    description: Timeline editor operations
  - name: Transcode
    description: Media transcoding operations
  - name: Assets
    description: Cross-collection asset listing
paths:
  /rtstream/:
    post:
      tags:
        - RTStream
      summary: Create RTStream
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - url
              properties:
                url:
                  type: string
                  description: RTSP or YouTube stream URL
                  example: rtsp://example.com:8554/stream
                name:
                  type: string
                  example: My Stream
                collection_id:
                  type: string
                  default: default
                  example: default
                sample_rate:
                  type: integer
                  default: 30
                  example: 30
                media_types:
                  type: array
                  items:
                    type: string
                    enum:
                      - video
                      - audio
                  example:
                    - video
                    - audio
                store:
                  type: boolean
                  default: false
                  example: false
                enable_transcript:
                  type: boolean
                  default: true
                  example: true
                ws_connection_id:
                  type: string
                  example: conn-123
      responses:
        '201':
          description: RTStream created
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: '#/components/schemas/RTStream'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: Insufficient credits
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    RTStream:
      type: object
      properties:
        id:
          type: string
          example: rts-12345
        name:
          type: string
          example: My Stream
        status:
          type: string
          enum:
            - connected
            - stopped
          example: connected
        sample_rate:
          type: integer
          example: 30
        media_types:
          type: array
          items:
            type: string
            enum:
              - video
              - audio
          example:
            - video
            - audio
        collection_id:
          type: string
          example: default
        store:
          type: boolean
          example: false
        created_at:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        success:
          type: boolean
          example: false
        message:
          type: string
          example: Error message
        error_code:
          type: string
          example: ERROR_CODE
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-access-token
      description: API key for authentication (sk-xxx format)

````