Skip to main content
POST
/
api
/
knowledge
/
documents
curl -X POST https://api.example.com/api/knowledge/documents \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "projectId": "proj_123",
    "fileName": "product-guide.pdf",
    "fileType": "pdf",
    "sourceType": "upload",
    "content": "Complete product documentation content..."
  }'
{
  "status": "completed",
  "message": "Document indexed successfully",
  "documentId": "doc_abc123xyz"
}

Request Body

projectId
string
required
Project ID to associate the document with
fileName
string
required
Name of the file/document
fileType
string
required
Type of file (e.g., pdf, txt, md, docx)
sourceType
string
required
Source type of the document (e.g., upload, url, integration)
content
string
required
Content of the document to be indexed
fileId
string
Optional file ID if document is linked to a file

Response

status
string
Processing status: processing, completed, or failed
message
string
Status message or error details
documentId
string
Unique identifier for the created document
curl -X POST https://api.example.com/api/knowledge/documents \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "projectId": "proj_123",
    "fileName": "product-guide.pdf",
    "fileType": "pdf",
    "sourceType": "upload",
    "content": "Complete product documentation content..."
  }'
{
  "status": "completed",
  "message": "Document indexed successfully",
  "documentId": "doc_abc123xyz"
}