add_document
Asynchronously ingest a PDF or image, extract text per page, chunk it, and extract memorable facts with document provenance. Returns a task ID for polling progress.
Instructions
Ingest a PDF or image asynchronously: extract text per page (digital PDF via poppler; scanned pages and images via a local vision model), chunk, and extract memorable facts with document/page provenance.
Returns immediately with {"status": "queued", task_id, pages,
chunks_estimate, estimated_wait_s} — a large document takes many
minutes; poll memory_task_status(task_id) for chunks_done progress and
the final memory_ids. Re-submitting the same file returns
{"status": "already_ingested"} unless force=true. There is NO
synchronous fallback: if the queue is unavailable the call errors.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| force | No | Re-ingest even if this exact document (same bytes + scope) was already ingested. | |
| infer | No | If true (default), the LLM extracts facts from each chunk; if false, raw chunks are stored as-is. | |
| run_id | No | Run scope identifier. | |
| user_id | No | User scope identifier. Defaults to MEM0_USER_ID. | |
| agent_id | No | Agent scope identifier. | |
| filename | No | Display name stored as source_doc provenance. Defaults to the file's basename. | |
| metadata | No | Extra metadata stored on every memory extracted from this document. | |
| file_path | Yes | Absolute path on the server host (must live under MEM0_DOC_PATH_ALLOWLIST, default $HOME) of a PDF or an image (PNG/JPEG). Scanned PDFs and images need vision on (MEM0_ENABLE_VISION). | |
| enable_graph | No | Graph extraction per chunk. Defaults to FALSE for documents (expensive and noisy). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |