API ReferenceKnowledge base documents

Bulk upload documents with real-time progress

POST
/api/knowledge-bases/{id}/documents/bulk-upload

Uploads multiple documents to a Knowledge Base using Server-Sent Events (SSE) to provide real-time progress updates during the process.

The endpoint processes documents in batches and provides:

  • Initial validation
  • Text preparation
  • Embedding generation
  • Database insertion
  • Final results

Path Parameters

id*string

Unique ID of the Knowledge Base

Request Body

application/json

documents*array<>

List of documents to upload

Items1 <= items

Response Body

text/event-stream

application/json

application/json

application/json

curl -X POST "https://app.docutray.com/api/knowledge-bases/string/documents/bulk-upload" \  -H "Content-Type: application/json" \  -d '{    "documents": [      {        "documentId": "manual-001",        "content": {          "title": "Installation Manual",          "text": "Steps to install the system...",          "category": "manual"        },        "metadata": {          "author": "Tech Team",          "version": "2.0"        }      },      {        "documentId": "faq-001",        "content": {          "title": "Frequently Asked Questions",          "text": "How to configure...?",          "category": "faq"        }      }    ]  }'

"data: {\"type\":\"connected\",\"message\":\"Connected to bulk upload stream\",\"timestamp\":\"2023-01-01T12:00:00.000Z\"}\n"

{
  "error": "Invalid request data",
  "details": [
    {}
  ]
}
{
  "error": "Unauthorized"
}
Empty
Empty
Empty
{
  "error": "Internal server error"
}