---
title: "Upload File To Chat"
method: POST
path: "/api/context-agent/chats/{chat_id}/upload"
tags: ["context-agent"]
---

# Upload File To Chat

`POST /api/context-agent/chats/{chat_id}/upload`

## Request

- Base URL: `https://app.getdot.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://app.getdot.ai/api/context-agent/chats/{chat_id}/upload`
- Auth: one of:
  - API key in header `X-API-KEY`
  - API key in cookie `Authorization`
  - OAuth 2 (password, token URL `/api/auth/token`)

Upload a file to a chat session for Root to analyze.

Files are stored in data/{org_id}/model/uploads/{chat_id}/ and are
accessible to Root via the $UPLOADS_PATH environment variable.

Args:
    chat_id: Chat ID
    file: File to upload (max 100MB)

Returns:
    {
        "file_id": "abc12345",
        "original_name": "data.csv",
        "path": "abc12345_data.csv",
        "size": 1048576,
        "content_type": "text/csv"
    }

Errors:
    404: Chat not found
    413: File too large (>100MB)
    500: Failed to save file

## Path parameters

- `chat_id` string, required

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/getdot/apis/dot-api-2.md) · [All operations](https://skmtc.dev/getdot/apis/dot-api-2/llms.txt) · [OpenAPI document](https://skmtc.dev/getdot/apis/dot-api-2/revisions/d26fe7163a7f?raw)
