Skip to main content
POST
Ingest File

Overview

Parses a file and either saves it to knowledge (deep, the default) so the assistant can recall it later, or returns its text without saving anything (quick). Supported formats: txt, md, html, pdf, docx, pptx, eml, csv and xlsx. Send the file inline as base64 (up to about 24 MB), or upload it first and pass its uri.
Changes data, so it needs a key that isn’t read-only.
Operation name: ingest.file.

Authorization

string
required
Your Composer API key

Headers

string
required
Must be set to application/json

Body

string
required
The original file name. Used to detect the format.
Example
string
The object_uri from Upload a File. Send this or content_b64.
Example
string
The file, base64-encoded. Send this or uri.
string
deep (default) saves it to knowledge. quick returns the text and saves nothing.
Example
string
The assistant this file is for (deep mode).
Example
string
The knowledge collection to save into (deep mode). Default semantic.
string
A title for the document.
Example
integer
Deep mode: also return up to this many characters of the text as excerpt, to pass straight to Chat as an attachment.
Example
integer
Quick mode: the most characters of text to return. Default 48,000.
string
Deep mode: the id of the person the file is about. Defaults to the caller.
object
Extra details stored with the document (deep mode).
Example Request

Response

array
Deep mode: the documents saved, each with document_id and kind.
integer
How many characters were parsed.
string
Deep mode with excerpt_chars: the start of the text.
boolean
True when the excerpt is shorter than the full text.
string
Quick mode: the extracted text.
boolean
Quick mode: true when content was cut to max_chars.
Example Success Response

Example cURL

cURL

Error Codes