Retab icon

Retab

Interact with Retab API

Actions2

Documents → Extract

AI-generated

Summary

Extract structured data from a document using the Retab API according to a provided JSON schema.

Inputs

  • binaryPropertyName (required) — Name of the binary property containing the document to process. Defaults to 'data'.
  • model (required) — AI model to use for extraction (e.g., 'gpt-4.1-nano').
  • json_schema (required) — JSON Schema defining the structure of the extracted data.
  • options.modality — Processing modality: 'text' (OCR-based) or 'native' (direct document parsing). Defaults to 'text'.
  • options.n_consensus — Number of consensus runs to improve extraction accuracy. Defaults to 1.
  • options.additional_messages — Additional chat messages to append after the document content for the model. Defaults to an empty array.

Output shape

For each input item returns an object with two properties:

  • json: the extraction result returned by the Retab API, matching the provided JSON schema. - binary`: the original binary data of the input document, passed through unchanged under the same property name.

Examples

Example 1: Extract invoice fields from a PDF.

Set binaryPropertyName to 'data', model to 'gpt-4.1-nano', provide a JSON schema for invoice fields, leave options at defaults.

Discussion