Scalaris API Reference
Overview
The Scalaris API provides endpoints for document processing and thumbnail generation in the TKM AI Agency Platform. It handles document uploads, processing, and thumbnail management.
Endpoints
Process Document
POST /process_document
Processes an uploaded document and generates thumbnails.
Request Body (multipart/form-data)
Name | Type | Required | Description |
---|---|---|---|
file | File | Yes | The document file to process |
user_id | string | Yes | The user ID |
session_id | string | Yes | The session ID |
conversation_id | string | Yes | The conversation ID |
organization_id | string | No | The organization ID (defaults to "tkm_123456") |
Response
{
"success": true,
"data": {
"folder_structure": {
"folder_name": "string",
"category": "string",
"subcategory": "string"
},
"metadata": {
"pages": 0,
"size": "string",
"format": "string"
}
},
"normalized_response": "string",
"metadata": {
"additional": "data"
},
"thumbnail_path": "organization_id/user_id/thumbnails/filename"
}
Get Thumbnail
GET /thumbnail/{user_id}/{filename}
Retrieves a document thumbnail.
Path Parameters
Name | Type | Required | Description |
---|---|---|---|
user_id | string | Yes | The user ID |
filename | string | Yes | The thumbnail filename |
Response
- Content-Type: image/jpeg
- Body: Binary JPEG image data
Generate Thumbnail
POST /generate_thumbnail
Generates a thumbnail from the first page of a document.
Request Body (multipart/form-data)
Name | Type | Required | Description |
---|---|---|---|
file | File | Yes | The document file |
user_id | string | No | The user ID (defaults to "default_user") |
organization_id | string | No | The organization ID (defaults to "tkm_123456") |
Response
- Content-Type: image/jpeg
- Body: Binary JPEG image data
Error Responses
400 Bad Request
{
"detail": "Unsupported file type: application/xxx"
}
404 Not Found
{
"detail": "Thumbnail not found"
}
500 Internal Server Error
{
"detail": "Error message"
}
Integration Notes
Document Processing Features
- File type validation
- Thumbnail generation
- Metadata extraction
- Folder structure organization
File Management
- Temporary file handling
- Secure file cleanup
- Path organization
- Storage optimization
Thumbnail Features
- First page extraction
- High-quality rendering
- Caching support
- Format conversion
Integration with Other Agents
- Humile: Response normalization
- Niger: Storage management (optional)
- Atta: Conversation context