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..."
}'
const response = await fetch('https://api.example.com/api/knowledge/documents', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
projectId: 'proj_123',
fileName: 'product-guide.pdf',
fileType: 'pdf',
sourceType: 'upload',
content: 'Complete product documentation content...'
})
});
const data = await response.json();
import requests
response = requests.post(
'https://api.example.com/api/knowledge/documents',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'projectId': 'proj_123',
'fileName': 'product-guide.pdf',
'fileType': 'pdf',
'sourceType': 'upload',
'content': 'Complete product documentation content...'
}
)
data = response.json()
{
"status": "completed",
"message": "Document indexed successfully",
"documentId": "doc_abc123xyz"
}
{
"status": "processing",
"message": "Document is being indexed",
"documentId": "doc_abc123xyz"
}
{
"status": "failed",
"message": "Failed to index document: invalid content format",
"documentId": null
}
Documents
Create and Index Document
Creates a new document and indexes it in the vector store
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..."
}'
const response = await fetch('https://api.example.com/api/knowledge/documents', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
projectId: 'proj_123',
fileName: 'product-guide.pdf',
fileType: 'pdf',
sourceType: 'upload',
content: 'Complete product documentation content...'
})
});
const data = await response.json();
import requests
response = requests.post(
'https://api.example.com/api/knowledge/documents',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'projectId': 'proj_123',
'fileName': 'product-guide.pdf',
'fileType': 'pdf',
'sourceType': 'upload',
'content': 'Complete product documentation content...'
}
)
data = response.json()
{
"status": "completed",
"message": "Document indexed successfully",
"documentId": "doc_abc123xyz"
}
{
"status": "processing",
"message": "Document is being indexed",
"documentId": "doc_abc123xyz"
}
{
"status": "failed",
"message": "Failed to index document: invalid content format",
"documentId": null
}
Request Body
string
required
Project ID to associate the document with
string
required
Name of the file/document
string
required
Type of file (e.g.,
pdf, txt, md, docx)string
required
Source type of the document (e.g.,
upload, url, integration)string
required
Content of the document to be indexed
string
Optional file ID if document is linked to a file
Response
string
Processing status:
processing, completed, or failedstring
Status message or error details
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..."
}'
const response = await fetch('https://api.example.com/api/knowledge/documents', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
projectId: 'proj_123',
fileName: 'product-guide.pdf',
fileType: 'pdf',
sourceType: 'upload',
content: 'Complete product documentation content...'
})
});
const data = await response.json();
import requests
response = requests.post(
'https://api.example.com/api/knowledge/documents',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'projectId': 'proj_123',
'fileName': 'product-guide.pdf',
'fileType': 'pdf',
'sourceType': 'upload',
'content': 'Complete product documentation content...'
}
)
data = response.json()
{
"status": "completed",
"message": "Document indexed successfully",
"documentId": "doc_abc123xyz"
}
{
"status": "processing",
"message": "Document is being indexed",
"documentId": "doc_abc123xyz"
}
{
"status": "failed",
"message": "Failed to index document: invalid content format",
"documentId": null
}
⌘I

