---
title: "Upload Documents"
method: POST
path: "/documents/upload"
---

# Upload Documents

`POST /documents/upload`

## Request

- Base URL: `https://api.projectindi.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.projectindi.com/documents/upload`
- Auth: none declared

Unified async upload - delegates to upload_pipeline().

Four usage scenarios:
1. **Conversation upload**: Provide conversation_id only (child_id inferred)
2. **Standalone upload**: Provide child_id only (no conversation link)
3. **Explicit override**: Provide both (rare edge case)
4. **Infer conversation**: Set infer_conversation=true with child_id (mobile chat)

REQUIREMENT: Must return 202 Accepted within 2 seconds
Document processing happens asynchronously via worker queue

Authentication: JWT required via Authorization header
RLS: Automatically enforced through user_client isolation

Args:
    files: List of files to upload (single or multiple)
    child_id: Optional UUID of child (inferred from conversation_id if not provided)
    conversation_id: Optional UUID linking to a conversation
    infer_conversation: Set to "true" to infer conversation_id from user's JWT
    idempotency_key: Optional key to prevent duplicate uploads on retry
    owned_by_note: Set to "true" when the files are being attached to a note,
        whose card draws them (see upload_pipeline)
    request: FastAPI request object for JWT authentication

Returns:
    202 Accepted response with document_ids array and tracking information

## Request body `multipart/form-data`

- BodyUploadDocumentsDocumentsUploadPost
  - `files` string[], required
  - `child_id` string, nullable
  - `conversation_id` string, nullable
  - `infer_conversation` string, nullable
  - `idempotency_key` string, nullable
  - `owned_by_note` string, nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/projectindi/apis/indi-agent-api-first-principles.md) - [All operations](https://skmtc.dev/projectindi/apis/indi-agent-api-first-principles/llms.txt) - [OpenAPI document](https://skmtc.dev/projectindi/apis/indi-agent-api-first-principles/revisions/25a7813e21fd?raw)
