Skip to main content

documents.upload

Uploads one or more documents to a text namespace. Each document is embedded with the configured embedding provider and stored for semantic search. The upload runs asynchronously — poll client.documents.upload_job_status with the returned job_id.
The * means documents is keyword-only. Extra fields on each document (for example team, source) are stored as metadata for search filters (#team:ai in the query).
API: POST /namespaces/{namespace_name}/documents — see Upload documents

Parameters

string
required
Target text namespace.
array
required
Non-empty array of document objects.
string
required
Item id, unique within this namespace.
string
required
Document text to embed and store.
any
Optional additional keys on each document are saved as metadata (for example "team": "ai").

Examples

Poll with documents.upload_job_status.

Returns

string
"success" when the upload job was started.
string
Human-readable result description.
string
Id of the async upload job. Poll documents.upload_job_status with this value.
string
Namespace the documents are being uploaded to.
number
Number of documents accepted into the upload job.
number
Current total item count on the instance. Present on 409 item limit errors in MoorchehApiError.body.
number
Global item cap for this instance. Present on 409 item limit errors.
number
Number of new item ids in the request that would exceed the cap. Present on 409 item limit errors.
Example return value

Error Handling

Non-2xx responses raise MoorchehApiError. Use e.is_item_limit_exceeded for 409 quota errors.
  • At most 100,000 items total across all namespaces
  • 409 is returned before the job starts if new ids would exceed the cap
  • Re-uploading an existing id in the same namespace updates the item and does not consume extra quota