Upload Content (Deprecated)
Upload files, URLs, or text for async processing
Deprecated: These endpoints are deprecated. Use the unified POST /api/v1/knowledge endpoint instead:
- For files:
source="file"with multipart upload - For URLs:
source="url"with URL in request body - For text:
source="text"with content in request body
Upload documents for asynchronous processing. Content is parsed, chunked, and embedded in the background.
Upload Modes
| Mode | Endpoint | Description |
|---|---|---|
| File | POST /upload/file | Upload PDF, DOCX, TXT, HTML, MD files |
| URL | POST /upload | Fetch and parse a web page |
| Text | POST /upload | Process raw text content |
Upload File
curl -X POST "https://platform.protobox.ai/api/v1/knowledge/upload/file" \
-H "Authorization: Bearer <access_token>" \
-F "file=@./product-manual.pdf" \
-F "title=Product Manual v2" \
-F "folderId=folder_123" \
-F 'customMetadata={"version": "2.0", "author": "Product Team"}'const formData = new FormData();
formData.append('file', fileBlob, 'product-manual.pdf');
formData.append('title', 'Product Manual v2');
formData.append('folderId', 'folder_123');
formData.append('customMetadata', JSON.stringify({
version: '2.0',
author: 'Product Team'
}));
const response = await fetch('https://platform.protobox.ai/api/v1/knowledge/upload/file', {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + accessToken,
},
body: formData
});
const { data } = await response.json();
console.log('Task ID:', data.taskId);
console.log('Check status:', `GET /knowledge/tasks/${data.taskId}`);import requests
with open('./product-manual.pdf', 'rb') as f:
response = requests.post(
'https://platform.protobox.ai/api/v1/knowledge/upload/file',
headers={'Authorization': f'Bearer {access_token}'},
files={'file': ('product-manual.pdf', f, 'application/pdf')},
data={
'title': 'Product Manual v2',
'folderId': 'folder_123',
'customMetadata': '{"version": "2.0", "author": "Product Team"}'
}
)
task = response.json()['data']
print(f"Task ID: {task['taskId']}")Upload URL
curl -X POST "https://platform.protobox.ai/api/v1/knowledge/upload" \
-H "Authorization: Bearer <access_token>" \
-H "Content-Type: application/json" \
-d '{
"sourceType": "url",
"url": "https://help.example.com/returns",
"title": "Returns Help Article",
"customMetadata": {
"category": "help",
"tags": ["returns", "support"]
}
}'const response = await fetch('https://platform.protobox.ai/api/v1/knowledge/upload', {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + accessToken,
'Content-Type': 'application/json',
},
body: JSON.stringify({
sourceType: 'url',
url: 'https://help.example.com/returns',
title: 'Returns Help Article',
customMetadata: {
category: 'help',
tags: ['returns', 'support']
}
})
});
const { data } = await response.json();
console.log('Task ID:', data.taskId);Upload Text
curl -X POST "https://platform.protobox.ai/api/v1/knowledge/upload" \
-H "Authorization: Bearer <access_token>" \
-H "Content-Type: application/json" \
-d '{
"sourceType": "text",
"content": "# Product FAQ\n\n## How do I track my order?\n\nYou can track your order by logging into your account...",
"title": "Product FAQ",
"customMetadata": {
"category": "faq"
}
}'{
"success": true,
"data": {
"taskId": "695c71705a8b2ca8d9016052",
"documentId": "695c71705a8b2ca8d9016053",
"status": "pending",
"message": "Document queued for processing"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "File type not allowed",
"details": ["Allowed types: application/pdf, text/plain, text/html, text/markdown"]
}
}File Upload Parameters
filefilerequiredThe file to upload. Supported: PDF, DOCX, TXT, HTML, MD.
titlestringDocument title. If not provided, extracted from filename or content.
folderIdstringFolder ID to organize the document.
customMetadatastringJSON string with custom metadata.
URL/Text Upload Parameters
sourceTypestringrequiredSource type: url or text.
urlstringURL to fetch (required when sourceType is url).
contentstringText content (required when sourceType is text). Max 500,000 characters.
titlestringDocument title. Max 500 characters.
folderIdstringFolder ID to organize the document.
chunkingOptionsobjectCustom chunking configuration.
chunkingOptions properties
chunkingOptions.chunkSizenumberdefault: 512Target chunk size in tokens.
chunkingOptions.chunkOverlapnumberdefault: 50Overlap between chunks in tokens.
customMetadataobjectCustom metadata to attach to the document.
Processing Pipeline
Check Processing Status
After uploading, poll the task status:
curl -X GET "https://platform.protobox.ai/api/v1/knowledge/tasks/695c71705a8b2ca8d9016052" \
-H "Authorization: Bearer <access_token>"const response = await fetch(`https://platform.protobox.ai/api/v1/knowledge/tasks/${taskId}`, {
headers: {
'Authorization': `Bearer ${accessToken}`,
},
});
const data = await response.json();import requests
response = requests.get(
f'https://platform.protobox.ai/api/v1/knowledge/tasks/{task_id}',
headers={'Authorization': f'Bearer {access_token}'}
)
data = response.json(){
"success": true,
"data": {
"id": "695c71705a8b2ca8d9016052",
"status": "completed",
"progress": 100,
"documentId": "695c71705a8b2ca8d9016053",
"result": {
"chunkCount": 12,
"wordCount": 3500,
"characterCount": 21000,
"processingTimeMs": 4500
},
"createdAt": "2024-01-15T10:30:00Z",
"completedAt": "2024-01-15T10:30:05Z"
}
}Supported File Types
| Type | MIME Type | Max Size |
|---|---|---|
| application/pdf | 10 MB | |
| Text | text/plain | 10 MB |
| HTML | text/html | 10 MB |
| Markdown | text/markdown | 10 MB |
| Word | application/vnd.openxmlformats-officedocument.wordprocessingml.document | 10 MB |
Rate Limits
- 20 uploads per minute per workspace
- 10 concurrent processing tasks
- Max file size: 10 MB (configurable per workspace)