Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.meibel.ai/llms.txt

Use this file to discover all available pages before exploring further.

File Uploads

The SDKs stream file uploads directly to the server in 64 KB chunks — files are never fully buffered in memory, so you can upload files of any size.

Endpoints

EndpointBehaviour
POST /datasources/uploadsReturns immediately after upload. The server processes the file asynchronously — track progress via SSE.
POST /datasources/uploads/processBlocks until the server finishes processing and returns the result in one response.
For files larger than 10 MB, use the async endpoint with progress streaming so your application stays responsive during server-side processing.

Basic Upload

from meibel import MeibelClient

client = MeibelClient(api_key="your-api-key")

# Upload a file
with open("document.pdf", "rb") as f:
    result = client.agents.sessions.send_chat_message_stream("session_id_value", file=f, filename="document.pdf")
    print(result)

Upload with Processing Progress

After uploading, the server processes the file (parsing, extraction, indexing). You can stream server-side processing progress in real time:
from meibel import MeibelClient

client = MeibelClient(api_key="your-api-key")

# Upload the file — streams directly to the server, never buffered in memory
with open("report.pdf", "rb") as f:
    upload = client.agents.sessions.send_chat_message_stream(file=f, file_name="report.pdf")

print(f"Upload started: {upload.upload_id}")

# Track server-side processing progress
for event in client.datasources.file_uploads.stream_upload_progress(upload.upload_id):
    if event.get("type") == "progress":
        pct = event["percent_complete"]
        print(f"Processing: {pct}%")
    elif event.get("type") == "complete":
        print("Processing complete!", event.get("result"))
    elif event.get("type") == "error":
        print("Error:", event.get("message"))

Upload with Synchronous Processing

For smaller files where you don’t need progress tracking, use the synchronous endpoint. The file is still streamed to the server, but the request blocks until processing completes and returns the result directly.
from meibel import MeibelClient

client = MeibelClient(api_key="your-api-key")

# Upload a file
with open("document.pdf", "rb") as f:
    result = client.datasources.file_uploads.upload_and_list_content(file=f, filename="document.pdf")
    print(result)

Supported File Types

The API accepts common document formats including PDF, DOCX, XLSX, CSV, TXT, and JSON files. Maximum file size is 100 MB.

Error Handling

Upload errors are returned as standard API errors. When using progress streaming, errors are delivered as events:
{
  "type": "error",
  "message": "Unsupported file format"
}