Optimaite

Document Ingestion

3 min readUpdated May 26, 2026Auch auf Deutsch verfuegbar

The webhook ingestion endpoint lets you push documents into your Optimaite workspace from any external system -- scanners, email gateways, custom scripts, or third-party applications.

Endpoint

POST /webhooks/inbox/{tenant_id}

This endpoint is available on both the Law and Business backend services.

Authentication

Every request must include your workspace webhook token in the X-Optimaite-Token header:

X-Optimaite-Token: your-webhook-token

Each workspace has a unique token. You can find and rotate it from Workspace Settings > Webhooks in the Optimaite UI.

Keep your webhook token secure. Anyone with the token can upload documents to your workspace. If you believe it has been compromised, rotate it immediately from the settings page.

Request Format

The endpoint accepts multipart/form-data with the following fields:

FieldTypeRequiredDescription
fileFileYesThe document to upload. Supported formats: PDF, DOCX, DOC, PNG, JPG, TIFF
folder_idStringNoUUID of the folder to place the document in. If omitted, it goes to the inbox.
metadataString (JSON)NoOptional JSON object with custom metadata to attach to the document

Code Examples

curl
curl -X POST https://api.optimaite.eu/webhooks/inbox/YOUR_TENANT_ID \
  -H "X-Optimaite-Token: your-webhook-token" \
  -F "file=@contract.pdf"
Python
import requests

url = "https://api.optimaite.eu/webhooks/inbox/YOUR_TENANT_ID"
headers = {"X-Optimaite-Token": "your-webhook-token"}

with open("contract.pdf", "rb") as f:
    response = requests.post(
        url,
        headers=headers,
        files={"file": ("contract.pdf", f, "application/pdf")},
    )

print(response.status_code, response.json())
JavaScript
import { readFileSync } from "fs";

const formData = new FormData();
const fileBuffer = readFileSync("./contract.pdf");
formData.append("file", new Blob([fileBuffer]), "contract.pdf");

const response = await fetch(
  "https://api.optimaite.eu/webhooks/inbox/YOUR_TENANT_ID",
  {
    method: "POST",
    headers: { "X-Optimaite-Token": "your-webhook-token" },
    body: formData,
  }
);

console.log(response.status, await response.json());

Response

Success (200)

{
  "status": "ok",
  "document_id": "550e8400-e29b-41d4-a716-446655440000",
  "filename": "contract.pdf"
}

Error Responses

StatusMeaning
401Missing or invalid X-Optimaite-Token header
404Tenant ID not found
413File exceeds the maximum upload size
415Unsupported file format
422Missing file field or malformed request

Token Management

Navigate to Workspace Settings > Webhooks in the Optimaite app to view your webhook URL, current token, and rotate the token.

After rotating, the old token is immediately invalidated. Update your external systems before rotating to avoid downtime.

Next Steps

Was this helpful?