API ReferenceKnowledge base documents

Add document to Knowledge Base

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

Adds a new document to the Knowledge Base with automatic embedding generation.

Authorization

ApiKeyAuth
AuthorizationBearer <token>

Bearer token for API authentication

In: header

Path Parameters

id*string

Unique ID of the Knowledge Base

Request Body

application/json

documentId*string

Unique document ID

content*object

Document content in JSON format

metadata?object

Additional document metadata

generateEmbedding?boolean

Automatically generate embedding

Defaulttrue

Response Body

application/json

curl -X POST "https://app.docutray.com/api/knowledge-bases/string/documents" \  -H "Content-Type: application/json" \  -d '{    "documentId": "doc-001",    "content": {      "title": "User Manual",      "text": "This is the manual content...",      "category": "documentation"    }  }'
{
  "data": {
    "id": "string",
    "documentId": "string",
    "content": {},
    "metadata": {},
    "createdAt": "2019-08-24T14:15:22Z"
  }
}
Empty
Empty
Empty
Empty
Empty
Empty
Empty