Ingest a file into a chunked document
Parses an already-uploaded file and creates one Document split into one or more embedded chunks. The source format is detected from the file's content type: PDFs are parsed page-by-page; text/plain and text/markdown files are read as a single source. How the source is chunked is controlled by chunk_strategy.
A file can only back one Document — a second call with the same file_id returns 409 FILE_ALREADY_INGESTED. To re-process an already-ingested file (e.g. with a different chunk_strategy), use POST /documents/{document_id}/ingest; to ingest the same source under a different path, upload a new copy of the file first.
Request
- Base URL: https://api.naturali.ai
- URL: https://api.naturali.ai/v1/projects/{project_id}/documents/ingest
- Auth: one of:
- HTTP bearer
- OAuth 2 (authorization code, authorization URL https://api.naturali.ai/authorize, token URL https://api.naturali.ai/token, scopes: mcp:access)
Query parameters
When omitted or false (default), processing runs in the background and 202 Accepted is returned immediately with status=pending. Pass true to block until processing completes and receive 201 Created with status=ready.
Request body
Example request
{
"file_id": "file_V1StGXR8Z5jdHi6B",
"path_prefix": "/docs/",
"tags": {
"team": "finance",
"env": "prod"
},
"chunk_size": 1000,
"chunk_overlap": 200,
"session_id": "sess_V1StGXR8Z5jdHi6B",
"actor_id": "actor_V1StGXR8Z5jdHi6B"
}Response
Ingestion completed synchronously (only when ?wait=true). The document is fully indexed and ready for search.
Example response
{
"id": "doc_V1StGXR8Z5jdHi6B",
"file_id": "file_V1StGXR8Z5jdHi6B",
"project_id": "proj_V1StGXR8Z5jdHi6B",
"path": "/reports/q1.txt",
"filename": "my-doc.txt",
"content_type": "application/pdf",
"size": 42,
"status": "ready",
"version": 1,
"content": "The quick brown fox jumps over the lazy dog.",
"chunk_strategy": "size",
"chunk_size": 800,
"chunk_overlap": 120,
"chunk_count": 10
}Changes
No recorded changes to this operation across all 1 revision of this API.