API Reference
Backoffice APIs
Scalaris

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)

NameTypeRequiredDescription
fileFileYesThe document file to process
user_idstringYesThe user ID
session_idstringYesThe session ID
conversation_idstringYesThe conversation ID
organization_idstringNoThe 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

NameTypeRequiredDescription
user_idstringYesThe user ID
filenamestringYesThe 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)

NameTypeRequiredDescription
fileFileYesThe document file
user_idstringNoThe user ID (defaults to "default_user")
organization_idstringNoThe 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