Skip to main content
Schemas define the structured output you expect from Retab. They are standard JSON Schema objects used by extraction, processor, and workflow calls to validate the data returned from documents. Use POST /v1/schemas/generate when you want Retab to infer a schema from example documents.

Generate Schema

The schema generation endpoint accepts one or more documents and returns a JSON Schema inferred from those examples. You can pass optional instructions and model routing.

Request Fields

documents
MIMEData[]
required
Example documents used to infer the schema.
model
string
default:"retab-small"
Model or Retab router alias used for schema generation.
instructions
string
Extra guidance for fields, naming conventions, or domain-specific details.
stream
boolean
default:"false"
Whether to stream schema generation output.

Response Fields

object
string
Always "schema".
created_at
string
Timestamp for the generated schema response.
json_schema
object
The generated JSON Schema.
strict
boolean
Whether the schema should be treated as strict structured output.