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

# Index videos in a collection

> Add videos to a collection for indexing. The videos will be indexed and made searchable. Indexing status or embedding of the video can be retrieved from [get media endpoint](/api-reference/index-or-embed-videos/get-processing-status-embedding-and-metadata-of-video) 
 The videos must be http(s) url to raw video files (e.g. mp4, mov, avi) and not web pages or cloud storage services URIs.  The videos url must be http(s) url to raw video files (e.g. mp4, mov, avi); Youtube web pages or cloud storage services URIs would not work.



## OpenAPI

````yaml post /media/
openapi: 3.1.0
info:
  title: tl;dw
  version: 0.0.1
  x-logo:
    url: https://app.trytldw.ai/static/images/sidebar_logo.svg
    backgroundColor: transparent
    altText: tl;dw Logo
  contact:
    name: tl;dw Support
    url: https://app.trytldw.ai/support
  termsOfService: https://app.trytldw.ai/terms
  x-apisguru-categories:
    - video
    - ai
servers:
  - url: https://api.trytldw.ai/v1
security: []
tags:
  - name: Collection
    description: Collection
  - name: Video
    description: Media
  - name: Account
    description: Account
paths:
  /media/:
    post:
      tags:
        - Index or Embed Videos
      summary: Index videos in a collection
      description: >-
        Add videos to a collection for indexing. The videos will be indexed and
        made searchable. Indexing status or embedding of the video can be
        retrieved from [get media
        endpoint](/api-reference/index-or-embed-videos/get-processing-status-embedding-and-metadata-of-video) 
         The videos must be http(s) url to raw video files (e.g. mp4, mov, avi) and not web pages or cloud storage services URIs.  The videos url must be http(s) url to raw video files (e.g. mp4, mov, avi); Youtube web pages or cloud storage services URIs would not work.
      operationId: create_media_media__post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IndexMediaRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IndexMediaResponse'
        '402':
          description: Insufficient balance
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Collection not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    IndexMediaRequest:
      properties:
        collection_id:
          type: string
          title: Collection Id
          description: The ID of the collection to add the video to
          examples:
            - c1a2b3c4-1a2b-3c4d-5e6f-7g8h9i0j1k2l
        media_list:
          items:
            $ref: '#/components/schemas/NewMediaItem'
          type: array
          title: Media List
          description: List of videos to add. Maximum 10 media can be added per request
          examples:
            - external_id: video_1
              title: My Video1
              url: https//example.com/video1.mp4
            - external_id: video_2
              title: My Video2
              url: https//example.com/video2.mp4
      type: object
      required:
        - collection_id
        - media_list
      title: IndexMediaRequest
    IndexMediaResponse:
      properties:
        media_list:
          items:
            $ref: '#/components/schemas/MediaStub'
          type: array
          title: Media List
      type: object
      required:
        - media_list
      title: IndexMediaResponse
    ErrorResponse:
      properties:
        detail:
          type: string
          title: Detail
      type: object
      required:
        - detail
      title: ErrorResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    NewMediaItem:
      properties:
        url:
          type: string
          title: Url
          description: >-
            The http or https URL to the raw video file. URL link to web page
            containing the video (e.g. Youtube Link), cloud storage services uri
            (e.g. uri starts with gs://) are not supported.
          examples:
            - https://example.com/video.mp4
        external_id:
          anyOf:
            - type: string
            - type: 'null'
          title: External Id
          description: User-defined media identifier
          examples:
            - video_12345
        title:
          anyOf:
            - type: string
            - type: 'null'
          title: Title
          description: The title of the media displayed in the search results
          examples:
            - My Video
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: >-
            User-defined media metadata, including ownership, geo location, etc.
            Key names can NOT start with underscore
          examples:
            - location:
                lat: 1
                lon: 2
              owner_id: user_123
      type: object
      required:
        - url
      title: NewMediaItem
    MediaStub:
      properties:
        id:
          type: string
          title: Id
          description: >-
            The ID of the video. Use this ID to retrieve task status, metadata
            and embedding of video
          examples:
            - c1a2b3c4-1a2b-3c4d-5e6f-7g8h9i0j1k2l
        external_id:
          anyOf:
            - type: string
            - type: 'null'
          title: External Id
          examples:
            - video_12345
        status:
          $ref: '#/components/schemas/MediaStatus'
          description: The status of the video understanding (e.g. indexing, embedding) job
      type: object
      required:
        - id
        - external_id
        - status
      title: MediaStub
    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
    MediaStatus:
      type: string
      enum:
        - PENDING
        - PROCESSING
        - COMPLETED
        - FAILED
      title: MediaStatus
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````