> ## 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.

# Upload to Collection

> Upload videos, audio, or images to a collection

Upload videos, audio files, or images to a collection from URLs or local files.

<CodeGroup>
  ```python Python theme={null}
  import videodb

  conn = videodb.connect(api_key="your_api_key")
  coll = conn.get_collection()

  # Upload from URL
  video = coll.upload(url="https://example.com/video.mp4")

  # Upload from local file
  video = coll.upload(file_path="/path/to/video.mp4")

  # Upload with callback for async processing
  video = coll.upload(
      url="https://example.com/video.mp4",
      callback_url="https://your-server.com/webhook"
  )

  print(f"Video ID: {video.id}")
  print(f"Stream URL: {video.stream_url}")
  ```

  ```javascript Node.js theme={null}
  import { connect } from 'videodb';

  const conn = connect({ apiKey: 'your_api_key' });
  const coll = await conn.getCollection();

  // Upload from URL
  const video = await coll.uploadURL({
      url: 'https://example.com/video.mp4'
  });

  // Upload from local file
  const video = await coll.uploadFile({
      filePath: '/path/to/video.mp4'
  });

  // Upload with callback for async processing
  const video = await coll.uploadURL({
      url: 'https://example.com/video.mp4',
      callbackUrl: 'https://your-server.com/webhook'
  });

  console.log(`Video ID: ${video.id}`);
  console.log(`Stream URL: ${video.stream_url}`);
  ```
</CodeGroup>

<Note>
  * Supports video, audio, and image files
  * Use `media_type` parameter to specify type explicitly
  * Large files should use `callback_url` for async processing
</Note>

<CardGroup cols={2}>
  <Card title="Upload Guide" icon="upload" href="/pages/ingest/files-and-collections/upload-video">
    Supported formats and upload methods
  </Card>

  <Card title="Production Patterns" icon="code" href="/pages/ingest/files-and-collections/collection-patterns">
    Batch uploads, webhooks, and retry logic
  </Card>
</CardGroup>


## OpenAPI

````yaml POST /collection/{collection_id}/upload
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:
  /collection/{collection_id}/upload:
    post:
      summary: Upload media to collection
      parameters:
        - name: collection_id
          in: path
          required: true
          schema:
            type: string
            example: default
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - url
              properties:
                url:
                  type: string
                  example: https://example.com/video.mp4
                name:
                  type: string
                  example: My Video
                media_type:
                  type: string
                  enum:
                    - video
                    - audio
                    - image
                  example: video
                callback_url:
                  type: string
                  example: https://webhook.example.com/callback
      responses:
        '200':
          description: Upload initiated
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/AsyncResponse'
                  - type: object
                    properties:
                      success:
                        type: boolean
                        example: true
                      data:
                        $ref: '#/components/schemas/Video'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    AsyncResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        status:
          type: string
          enum:
            - processing
            - done
            - failed
          example: processing
        data:
          type: object
          properties:
            id:
              type: string
              example: job-123
            output_url:
              type: string
              example: https://api.videodb.io/async-response/job-123
    Video:
      type: object
      properties:
        id:
          type: string
          example: m-12345
        name:
          type: string
          example: video.mp4
        description:
          type: string
          example: Video description
        collection_id:
          type: string
          example: default
        length:
          type: number
          example: 120.5
        size:
          type: number
          example: 1048576
        stream_url:
          type: string
          example: https://stream.videodb.io/v/12345
        player_url:
          type: string
          example: https://console.videodb.io/player/12345
        thumbnail_url:
          type: string
          example: https://assets.videodb.io/thumb/12345.jpg
        created_at:
          type: string
          format: date-time
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-access-token
      description: API key for authentication (sk-xxx format)

````