This endpoint does not use the OpenAI SDK. Call it directly with HTTPS.
Endpoint
- Method:
POST
- Path:
/classify/document
Request
- document: Required. Base64-encoded contents of the file. Prefer sending the original binary Base64 rather than JSON-stringifying large payloads.
- additional_labels: Optional. Array of extra labels to merge with the default set.
Supported document types
- PDFs (
application/pdf
) - Images (PNG, JPEG, WEBP, TIFF)
- Office documents (DOCX)
400
error.
Process flow
- Receive document upload as Base64
- Convert document pages to one or more images
- Send images and combined labels (default + additional) to Gemma 3 27B
- Parse model output and return matched labels
Response
Default labels
The following labels are included by default. You can extend or narrow this set usingadditional_labels
.
Examples
Set your API key first:cURL
TypeScript
Python
Errors
400 Bad Request
: Missing or invaliddocument
payload, unsupported type, or corrupted Base64401 Unauthorized
: Invalid or missing API key413 Payload Too Large
: File exceeds maximum size429 Too Many Requests
: Rate limit exceeded5xx
: Transient server issues
Notes & best practices
- Prefer Base64 over URLs for simpler, predictable ingestion
- Keep label lists concise and mutually exclusive when possible
- Merge defaults +
additional_labels
to extend coverage without losing core categories