Context Files¶
Context files are documents uploaded to enrich assistant responses through embeddings and contextual knowledge.
Overview¶
Context files allow you to:
- Upload documents (PDF, text, DOCX)
- Process them into embeddings
- Use them as context for assistant queries
Files are processed asynchronously after upload.
GET /api/v1/secure/contextfiles¶
List all context files for the authenticated company.
Authentication required¶
Bearer JWT
Request¶
Headers¶
Response¶
{
"error": false,
"message": "context files retrieved",
"files": [
{
"id": "string",
"filename": "string",
"uploaded_date": "string",
"metadata": {
"company_id": "string",
"status": "string",
"collection_id": "string",
"created_at": "string"
}
}
]
}
Field definitions¶
-
files
Array of context file records -
metadata.status
Processing status of the file
Possible values: pendingready-
failed -
metadata.collection_id
Identifier for the embedding collection
May be empty depending on processing stage
Example¶
PUT /api/v1/secure/contextfiles¶
Upload one or more context files.
Authentication required¶
Bearer JWT
Request¶
Headers¶
Form data¶
files(required)
One or more files
Supported file types¶
text/plainapplication/pdfapplication/vnd.openxmlformats-officedocument.wordprocessingml.document
Response¶
Notes¶
- Files are stored immediately and processed asynchronously
- Initial status is
pending - Unsupported file types will return an error
Example¶
curl -X PUT https://api.example.com/api/v1/secure/contextfiles \
-H 'Authorization: Bearer <jwt>' \
-F 'files=@document.pdf' \
-F 'files=@notes.txt'
Example error¶
DELETE /api/v1/secure/contextfiles/:fileId¶
Delete a context file and its associated embeddings.
Authentication required¶
Bearer JWT
Request¶
Headers¶
Path params¶
fileId(required)
ID of the file to delete
Response¶
Validation rules¶
fileIdmust be valid- If the file is still processing (
pending), deletion may fail - Files recently uploaded may be locked during processing
Example¶
curl -X DELETE https://api.example.com/api/v1/secure/contextfiles/<fileId> \
-H 'Authorization: Bearer <jwt>'
Example error¶
Lifecycle¶
- Upload file
- File enters
pendingstate - Background processing generates embeddings
- Status becomes
readyorfailed
Best practices¶
- Wait until file status is
readybefore relying on it in assistant queries - Upload only supported file types
- Handle asynchronous processing in your UI or integration
- Avoid deleting files immediately after upload