Skip to main content
POST
Classify a document into one of the provided categories and persist the result as a Classification resource that can later be retrieved via GET /v1/classifications/{classification_id} or listed via GET /v1/classifications.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Public create-classification request body.

document
MIMEData · object
required

The document to classify

categories
Category · object[]
required

The categories to classify the document into

Minimum array length: 1
model
string
default:retab-small

The model to use for classification

first_n_pages
integer | null

Only use the first N pages of the document for classification. Useful for large documents where classification can be determined from early pages.

instructions
string | null

Free-form instructions appended to the system prompt to steer the classification.

n_consensus
integer
default:1

Number of classification runs to use for consensus voting. Uses deterministic single-pass when set to 1.

bust_cache
boolean
default:false

If true, skip the LLM cache and force a fresh completion

background
boolean
default:false

If true, run asynchronously: returns immediately with status 'queued' and an empty output. Poll GET /v1//{id} until status is terminal. Mutually exclusive with stream.

Response

Successful Response

A classification result: the categories a document was scored against and the chosen output decision.

id
string
required

Unique identifier of the classification

file
FileRef · object
required

Information about the classified file

model
string
required

Model used for classification

categories
Category · object[]
required

Categories the document was classified against

n_consensus
integer
default:1

Number of consensus votes used

instructions
string | null

Free-form instructions supplied with the classification request.

output
ClassificationDecision · object

The classification result with reasoning. A degenerate empty decision until status == 'completed'; gate reads on status.

status
enum<string>
default:pending

Lifecycle status. The synchronous path returns 'completed'. Background runs progress pending -> queued -> in_progress -> completed | failed | cancelled.

Available options:
pending,
queued,
in_progress,
completed,
failed,
cancelled
error
PrimitiveError · object | null

Error details when a background run fails; null otherwise. Always present so consumers can read it without an existence check.

consensus
ClassificationConsensus · object | null

Consensus metadata for multi-vote classification runs

usage
RetabUsage · object | null

Usage information for the classification

created_at
string<date-time> | null