Skip to navigation

Create Documents

Upload and process documents for use in collections and RAG.

Supports the following content strategies:

  • PDF documents (with OCR fallback for scanned pages)
  • Word documents (docx) and spreadsheets (xlsx)
  • Plain text files (txt)
  • CSV files
  • Git repositories
  • Web pages (url) and YouTube videos
  • Zip archives

Documents are processed asynchronously:

  1. Files are uploaded and validated
  2. Content is extracted and chunked
  3. Embeddings are generated
  4. Documents become available for collections

Returns a group ID to track processing status.

Because extraction happens after this endpoint has already responded, a file that turns out to hold no extractable content does not fail this request. It fails its own processing task, which is reported per-file by GET /org/{org_id}/project/{project_id}/document/create/status/{group_id}. That task reaches state REJECTED, and its info carries the same reason and message the synchronous upload endpoint returns in its 400, so the cause can be distinguished programmatically there.

A file can also fail for a reason that is ours rather than the file’s — the extraction service being unavailable, for instance. That task reaches FAILURE, and its info is a description of the error rather than a {reason, message} object, so branch on state before reading info.

Three states are terminal: SUCCESS, REJECTED and FAILURE. Neither REJECTED nor FAILURE is retried, and because completed counts only the tasks that succeeded it never reaches upload_count once any file has failed — poll until every task has reached one of the three rather than waiting on completed.

Treat a state of null as terminal too. It means we could not read that task back at all, and that does not resolve on a later poll.

Each item in the data array must include a strategy, one of: csv, docx, git, pdf, txt, url, xlsx, youtube, zip.

Descriptors are matched positionally to the uploaded files: the first data item corresponds to the first uploaded file, and so on. target is optional for a descriptor paired with an uploaded file. It is required only for descriptors with no corresponding uploaded file (for example, a url or youtube strategy that fetches content directly), where it must contain the source location to fetch.

A descriptor paired with an uploaded file does not name the document: title and description sent in the descriptor are ignored for uploaded files. The created document’s title is the uploaded filename and its description is null. Rename it afterwards with POST /document/{document_id}.

Authentication

AuthorizationBearer

API key or access token, sent as Authorization: Bearer <token>. The simplest option: create an API key in your dashboard under Settings, then paste it here.

OR
AuthorizationBearer

API key or access token, sent as Authorization: Bearer <token>. The simplest option: create an API key in your dashboard under Settings, then paste it here.

Path parameters

org_idstringRequiredformat: "uuid"
The unique identifier of the organization.
project_idstringRequiredformat: "uuid"
The unique identifier of the project.

Request

This endpoint expects a multipart form with multiple files.
datastringRequired
filesfilesOptional

Response

Documents accepted for processing
group_idstring
task_countinteger
taskslist of objects

Errors

400
Bad Request Error
403
Forbidden Error
422
Unprocessable Entity Error