---
title: "Upload Document"
method: POST
path: "/documents/upload"
tags: ["rag"]
---

# Upload Document

`POST /documents/upload`

## Request

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

上传文件入库：支持 .txt/.md/.html/.pdf/.docx（按扩展名/MIME 选解析器）。

title 缺省用文件名；source 缺省用文件名。单文件大小上限见 `document_max_upload_mb`。
含图过多时先回 needs_vision_confirm，前端确认后带 confirm_vision=true 重传。

## Response `200`

Successful Response

- IngestOut
  - `document_id` string
  - `chunks` integer
  - `needs_vision_confirm` boolean
  - `figures` integer

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/agent4/apis/chatagent-platform.md) · [All operations](https://skmtc.dev/agent4/apis/chatagent-platform/llms.txt) · [OpenAPI document](https://skmtc.dev/agent4/apis/chatagent-platform/revisions/18e58f082ce3?raw)
