Memory & RAG
Upload Document
Extract text from a document (PDF, DOCX, XLSX, scanned images…) with built-in OCR and ingest it into a memory collection in a single request
POST
Upload a document to have it extracted, chunked, and ingested into a memory collection in a single request. 60db’s document extraction engine handles 91+ file formats and includes built-in OCR for scanned PDFs and images, so you can send the raw file and let the server do the rest.
The browser just posts the file and 60db handles format detection, OCR, chunking, and ingestion.
Response headers on success:
Statuses:
Supported formats (partial list — 91 total):
- Documents: PDF, DOCX, DOC, ODT, RTF, TXT, MD, HTML, EPUB
- Spreadsheets: XLSX, XLS, CSV, ODS
- Presentations: PPTX, PPT, ODP
- Email: EML, MSG, PST, MBOX
- Images (OCR): PNG, JPG, JPEG, TIFF, BMP, GIF
- Code & structured: JSON, XML, YAML, LaTeX, Markdown variants
- Archives: ZIP, TAR, GZIP, 7Z (extracted recursively)
Request
Headers
string
required
Bearer token with your API key
string
multipart/form-data
Body (multipart/form-data)
file
required
The document to extract. Max 200 MB per file.
string
Collection ID to store the extracted chunks in. Defaults to the caller’s personal collection.
string
default:"knowledge"
Memory type for the ingested chunks. One of:
user, knowledge, hive.
For document uploads, knowledge is almost always the right choice.string
Display title for the document. Defaults to the uploaded filename.
When the document produces multiple chunks, each chunk is labeled
"{title} (part N/M)".integer
default:"1500"
Maximum characters per chunk. Larger chunks preserve more context but are less precise for recall.
Minimum 200, maximum 8000.
integer
default:"200"
Characters of overlap between adjacent chunks. Helps preserve sentences that span chunk boundaries.
Must be less than
chunk_size.Response
boolean
true on success.object
Examples
Pipeline
When you POST a file, 60db runs it through this pipeline:- Validate — file present, type allowed, under 200 MB, collection accessible.
- Extract — the document extraction engine detects the format (PDF, DOCX, image, etc.) and returns plain text plus metadata (
mime_type,page_count,tables,quality_score). OCR is applied automatically for scanned PDFs and images. - Chunk — split the extracted text into overlapping segments of
chunk_sizecharacters withchunk_overlapcharacter overlap. - Register collection — ensure the target collection is ready (idempotent, cached).
- Ingest — stream all chunks into the memory layer in a single batch.
- Return — the response includes one
{id, status, message}entry per chunk. Processing continues asynchronously.
Tuning
Billing
Document upload is two-stage billing — you pay for the extraction and for the resulting ingest.
The two charges are separate rows in
transaction_log (MEMORY_EXTRACT and MEMORY_INGEST) so you can distinguish extraction cost from storage cost in your reporting.
Example — uploading a 2 MB PDF that extracts to 50,000 characters of text:
Special failure case — if extraction succeeds but your wallet can’t cover the post-extraction ingest charge, the extract fee is automatically refunded and the response is
402 INSUFFICIENT_CREDITS with details.extract_fee_refunded populated. You pay nothing for the failed attempt.
See Pricing & Billing for the full policy.
Error responses
Checking ingestion status
The endpoint returns immediately once chunks are queued — full embedding/indexing happens asynchronously. PollGET /memory/:id/status with any of the returned chunk IDs to check progress:
pending → processing → ready (or failed).
Size limits
- Per file: 200 MB
- Chunks per document: 100 (use a larger
chunk_sizeto fit bigger files) - Chunk text length: 100,000 characters
- Supported languages for OCR: 100+ languages including English, Spanish, French, German, Chinese, Japanese, Arabic, Hindi, and more
- Rate limit: Same as
POST /memory/ingest/batch(30 uploads/min per workspace on default plans)