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

# Create Document

`POST /documents`

## 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`
- Auth: none declared

入库文档：同步建 Document 并返回计划块数；切片/嵌入在后台异步完成（稍后可检索）。

## Request body

- IngestIn
  - `title` string, required
  - `content` string, required
  - `content_type` string
  - `source` string, nullable

## 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)
