---
title: "Index File"
method: POST
path: "/v2/collections/{collection_name}/index/file"
tags: ["indexing"]
---

# Index File

`POST /v2/collections/{collection_name}/index/file`

Index uploaded files into a collection.

Upload one or more files directly via multipart form-data. Supports PDF, DOCX,
XLSX, CSV, TXT, images, and other document types. Files are processed through
the same pipeline as cloud storage indexing.

Headers:
- Authorization: Bearer {api_key} - Captain API key for authentication
- X-Organization-ID: Organization UUID
- Idempotency-Key: UUID for request deduplication (optional)

Args:
    collection_name: Name of the collection (path parameter)
    files: One or more files to upload and index
    processing_type: "advanced" or "basic" (default: "basic")
    custom_metadata: JSON string of custom metadata (optional)

Returns:
    { job_id, status: "pending" }

## Path parameters

- `collection_name` string, required

## Headers

- `authorization` string, nullable

## Response `200`

Successful Response

- IndexJobResponse
  - `job_id` string, required
  - `status` string
  - `custom_metadata` object, nullable — The custom_metadata Captain accepted for this job, echoed back as validated. Null when none was supplied.

## Other responses

- `400` — overwrite_existing and skip_existing cannot both be true

---

[API](https://skmtc.dev/runcaptain/apis/api-reference.md) · [All operations](https://skmtc.dev/runcaptain/apis/api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/runcaptain/api-reference/revisions/fe4649e3f4aa/schema)
