Protobox

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

See unified API →

Upload documents for asynchronous processing. Content is parsed, chunked, and embedded in the background.

Upload Modes

ModeEndpointDescription
FilePOST /upload/fileUpload PDF, DOCX, TXT, HTML, MD files
URLPOST /uploadFetch and parse a web page
TextPOST /uploadProcess raw text content

Upload File

Request
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

Request
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

Request
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"
    }
  }'
Response
{
  "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

filefilerequired

The file to upload. Supported: PDF, DOCX, TXT, HTML, MD.

titlestring

Document title. If not provided, extracted from filename or content.

folderIdstring

Folder ID to organize the document.

customMetadatastring

JSON string with custom metadata.

URL/Text Upload Parameters

sourceTypestringrequired

Source type: url or text.

urlstring

URL to fetch (required when sourceType is url).

contentstring

Text content (required when sourceType is text). Max 500,000 characters.

titlestring

Document title. Max 500 characters.

folderIdstring

Folder ID to organize the document.

chunkingOptionsobject

Custom chunking configuration.

chunkingOptions properties
chunkingOptions.chunkSizenumberdefault: 512

Target chunk size in tokens.

chunkingOptions.chunkOverlapnumberdefault: 50

Overlap between chunks in tokens.

customMetadataobject

Custom metadata to attach to the document.

Processing Pipeline

Upload file/URL/text Store original file Create processing task Return taskId Dequeue task Fetch file Parse content Chunk text Generate embeddings Store chunks Mark complete Poll task status Return progress/result Client API Queue Processor S3 MongoDB

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

TypeMIME TypeMax Size
PDFapplication/pdf10 MB
Texttext/plain10 MB
HTMLtext/html10 MB
Markdowntext/markdown10 MB
Wordapplication/vnd.openxmlformats-officedocument.wordprocessingml.document10 MB

Rate Limits

  • 20 uploads per minute per workspace
  • 10 concurrent processing tasks
  • Max file size: 10 MB (configurable per workspace)

On this page