Skip to main content
POST
/
classify
curl -X POST "https://prod.visionapi.unsiloed.ai/classify" \
  -H "api-key: your-api-key" \
  -F "pdf_file=@document.pdf" \
  -F 'categories=[{"name":"invoice"},{"name":"contract"},{"name":"receipt"}]'
{
  "job_id": "7e10f5cd-6d83-4b8e-9f80-ac103fd9b2f1",
  "status": "processing",
  "message": "Classification started",
  "quota_remaining": 450
}

Overview

The Classify Document endpoint analyzes documents and assigns them to predefined categories based on their content, structure, and visual characteristics. This endpoint uses job-based processing where files are uploaded to cloud storage and processed asynchronously.
The endpoint supports both single-page and multi-page classification with detailed confidence scoring for each page. Documents longer than 4 pages are classified from their first 4 pages. Files are uploaded to cloud storage and processed in the background.

Request

pdf_file
file
The document to classify: a PDF or an image (JPG, PNG, GIF, WebP, BMP, TIFF). Either pdf_file or file_url must be provided, but not both. Maximum file size: 500MB.
file_url
string
URL to a document to classify (PDF or image). Either pdf_file or file_url must be provided, but not both.
categories
string
required
JSON string containing an array of category objects with a required name (e.g., [{"name":"invoice"},{"name":"contract"}]). A description key is accepted for compatibility but is not used by classification; only the names guide the result.

Response

job_id
string
Unique identifier for the classification job
status
string
Current status of the job (“processing”)
message
string
Human-readable status message
quota_remaining
number
Remaining API quota after this request

Examples

curl -X POST "https://prod.visionapi.unsiloed.ai/classify" \
  -H "api-key: your-api-key" \
  -F "pdf_file=@document.pdf" \
  -F 'categories=[{"name":"invoice"},{"name":"contract"},{"name":"receipt"}]'
{
  "job_id": "7e10f5cd-6d83-4b8e-9f80-ac103fd9b2f1",
  "status": "processing",
  "message": "Classification started",
  "quota_remaining": 450
}

Job Status Checking

After starting a classification job, you can check its status using the job ID by making a GET request to /classify/{job_id}.

Job Status Values

  • queued: Job is waiting to be picked up for processing
  • processing: Job is currently being processed
  • completed: Job completed successfully with results available
  • failed: Job failed with error details

Authorizations

api-key
string
header
required

Body

multipart/form-data
categories
string
required

JSON string containing an array of category objects with a required name. Example: [{"name":"invoice"},{"name":"contract"},{"name":"receipt"}]. A "description" key is accepted for compatibility but is not used by classification.

pdf_file
file

The document to classify: a PDF or an image (JPG, PNG, GIF, WebP, BMP, TIFF). Provide either pdf_file or file_url, not both. Maximum file size: 500MB.

file_url
string

URL to a document to classify (PDF or image). Provide either pdf_file or file_url, not both.

Response

202 - application/json

Accepted - classification job started

job_id
string

Unique identifier for the classification job

status
string

Current job status (typically 'processing')

message
string

Status message about the job

quota_remaining
number

Remaining API quota after this request