Create a document
POST/v1/projects/:project_id/knowledge/collections/:collection_id/documents
Add a document to the collection, from inline text (content) or from an uploaded file (file, base64, plus content_type and filename) — exactly one of the two.
application/pdf, text/plain and text/markdown are extracted natively. Any other media type needs a converter (POST /v1/projects/{project_id}/knowledge/converters) registered for it in the project; without one the request is rejected with unsupported_content_type and no document is created.
Ingestion (extract → chunk → embed) runs in the background: the document comes back pending and becomes indexed or failed, which is announced by the knowledge.document_ingested / knowledge.ingest_failed webhook events.
Request
Responses
- 201
- 400
- 401
- 404
- 413
- 502
Document created.
The request was malformed or failed validation.
Missing or invalid credentials.
The resource does not exist (existence is not leaked).
The uploaded file exceeds the maximum size.
The upstream runtime could not complete the operation.