Skip to main content
POST
/
v1
/
projects
/
extract
/
{project_id}
/
{iteration_id}
from retab import Retab

client = Retab()

completion = client.projects.extract(
    project_id="proj_F0FE8DFqyouQdZXDTWRg0",
    iteration_id="iter_F0FE8DFqyouQdZXDTWRg0",
    document="invoice.jpeg"
)

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1744316542,
  "model": "gpt-4o-mini",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "{\"invoice_number\": \"INV-42\", \"total_amount\": 123.45}",
        "parsed": {
          "invoice_number": "INV-42", 
          "total_amount": 123.45
        }
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 1250,
    "completion_tokens": 35,
    "total_tokens": 1285
  },
  "likelihoods": {
    "invoice_number": 0.95,
    "total_amount": 0.87
  },
  "extraction_id": "ext_1234567890"
}
from retab import Retab

client = Retab()

completion = client.projects.extract(
    project_id="proj_F0FE8DFqyouQdZXDTWRg0",
    iteration_id="iter_F0FE8DFqyouQdZXDTWRg0",
    document="invoice.jpeg"
)

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1744316542,
  "model": "gpt-4o-mini",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "{\"invoice_number\": \"INV-42\", \"total_amount\": 123.45}",
        "parsed": {
          "invoice_number": "INV-42", 
          "total_amount": 123.45
        }
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 1250,
    "completion_tokens": 35,
    "total_tokens": 1285
  },
  "likelihoods": {
    "invoice_number": 0.95,
    "total_amount": 0.87
  },
  "extraction_id": "ext_1234567890"
}

Authorizations

Api-Key
string
header
required

Headers

Idempotency-Key
string | null

Path Parameters

project_id
string
required
iteration_id
string
required

Query Parameters

write_to_sheet
boolean
default:false

Body

multipart/form-data
document
file | null
documents
file[] | null
temperature
number | null
seed
integer | null
store
boolean
default:true
spreadsheet_id
string | null
worksheet_id
string | null
enriched_oauth_token
string | null

Response

Successful Response

id
string
required
choices
RetabParsedChoice · object[]
required
created
integer
required
model
string
required
object
string
required
Allowed value: "chat.completion"
service_tier
enum<string> | null
Available options:
auto,
default,
flex,
scale,
priority
system_fingerprint
string | null
usage
object | null
extraction_id
string | null
likelihoods
object | null

Object defining the uncertainties of the fields extracted when using consensus. Follows the same structure as the extraction object.

schema_validation_error
object | null
request_at
string<date-time> | null

Timestamp of the request

first_token_at
string<date-time> | null

Timestamp of the first token of the document. If non-streaming, set to last_token_at

last_token_at
string<date-time> | null

Timestamp of the last token of the document