BrainAPI
BrainAPI
Build

For the complete BrainAPI documentation index, see llms.txt. A markdown version of any docs page is available by appending .md to its URL. Docs MCP: /docs/mcp.

Saving files

How to save files to the memory store

Ingesting files is useful when you have information stored in documents and you don't want to implement a pipeline yourself to extract textual information from them. You just need to send the files to the ingestion API and the system will take care of going through a complete OCR process to extract the textual information from the files.

POST /ingest/file returns 202 Accepted with { "message": "File ingestion accepted", "task_id": "…" }. Poll with ingestion tasks.

For agents

  • POST /ingest/file as multipart form (file + brain fields), auth with BrainPAT
  • One file per request; accepted: pdf, doc/docx, xls/xlsx, txt, csv, json, jpg, png
  • 202 + task_id → poll GET /tasks/{id}; 404 ≠ pending

The accepted file types are: PDF (.pdf), DOC (.doc), DOCX (.docx), XLS (.xls), XLSX (.xlsx), TXT (.txt), CSV (.csv), JSON (.json), JPG (.jpg), and PNG (.png).

Usage

The file ingestion API is available via the REST API, Python SDK, and TypeScript SDK. It accepts one file at a time and will process it one page at a time.

The Typescript SDK provides the ingestFile function to ingest a file.

const result = await brain.ingestFile({  file: "path/to/file.pdf",  brain_id: "example01",});

After 202, poll GET /tasks/ with the returned task id until the job finishes. A missing task returns 404. See Ingestion tasks.

Edit on GitHub

Last updated on

On this page