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

# Upload to Index

> Upload video files to a search index

## POST /api/v1/search/indexes/{index_id}/upload

Upload video files to an existing search index. Files are processed, transcribed, and indexed for semantic search. Each video is automatically segmented into searchable clips.

### Path Parameters

| Parameter | Type   | Required | Description                      |
| --------- | ------ | -------- | -------------------------------- |
| index\_id | string | Yes      | The ID of the index to upload to |

### Body Parameters

| Parameter | Type    | Required | Description                     |
| --------- | ------- | -------- | ------------------------------- |
| files     | File\[] | Yes      | Video files to upload and index |

### Response

| Field            | Description                              |
| ---------------- | ---------------------------------------- |
| index\_id        | ID of the index that was updated         |
| files\_processed | Number of files that were processed      |
| clips\_indexed   | Total number of searchable clips created |

### Example Request

```bash theme={null}
curl -X POST https://api.usenarrative.ai/api/v1/search/indexes/idx_abc123xyz/upload \
  -H "Content-Type: multipart/form-data" \
  -F "files=@highlight1.mp4" \
  -F "files=@highlight2.mp4" \
  -F "files=@highlight3.mp4"
```

### Example Response

```json theme={null}
{
  "index_id": "idx_abc123xyz",
  "files_processed": 3,
  "clips_indexed": 127
}
```

### Notes

* Processing time depends on total video duration
* Videos are transcribed and semantically indexed
* Each video is automatically segmented into clips based on content
* Clips are searchable immediately after processing completes
* Supported formats: mp4, mov, avi, mkv, webm


## OpenAPI

````yaml POST /api/v1/search/indexes/{index_id}/upload
openapi: 3.0.3
info:
  title: Search API
  description: Video clip indexing and natural language search API
  version: 1.0.0
servers:
  - url: https://api.usenarrative.ai
    description: Production
security: []
paths:
  /api/v1/search/indexes/{index_id}/upload:
    post:
      tags:
        - Items
      summary: Upload to Index
      description: >-
        Upload video files to an existing search index. Files are processed and
        indexed for semantic search.
      operationId: uploadToIndex
      parameters:
        - name: index_id
          in: path
          required: true
          description: The ID of the index to upload to
          schema:
            type: string
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/UploadToIndexRequest'
      responses:
        '200':
          description: Files uploaded and indexed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadToIndexResponse'
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Index not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    UploadToIndexRequest:
      type: object
      properties:
        files:
          type: array
          items:
            type: string
            format: binary
          description: Video files to upload and index
      required:
        - files
    UploadToIndexResponse:
      type: object
      properties:
        index_id:
          type: string
          description: ID of the index that was updated
          example: idx_abc123xyz
        files_processed:
          type: integer
          description: Number of files that were processed
          example: 5
        clips_indexed:
          type: integer
          description: Total number of searchable clips created
          example: 127
      required:
        - index_id
        - files_processed
        - clips_indexed
    Error:
      type: object
      properties:
        detail:
          type: string
          description: Error message
          example: Invalid request parameters

````