Skip to main content
POST
/
v1
/
extractions
/
{extraction_id}
/
cancel
from retab import Retab

client = Retab()

extraction = client.extractions.create_extraction_cancel("extr_01G34H8J2K")
print(extraction.status)
{
  "id": "extr_01G34H8J2K",
  "status": "cancelled",
  "error": null
}
Cancel an in-flight background Extraction run (one created with background: true). Cancellation is idempotent: a run that has already reached a terminal state (completed, failed, or cancelled) is returned unchanged rather than erroring.
from retab import Retab

client = Retab()

extraction = client.extractions.create_extraction_cancel("extr_01G34H8J2K")
print(extraction.status)
{
  "id": "extr_01G34H8J2K",
  "status": "cancelled",
  "error": null
}

Authorizations

Api-Key
string
header
required

Path Parameters

extraction_id
string
required

Response

Successful Response

A stored extraction record from the Retab API.

id
string
required

Unique identifier of the extraction

file
FileRef · object
required

Information about the extracted file

model
string
required

Model used for the extraction

json_schema
Json Schema · object
required

JSON schema used for the extraction

output
Output · object
required

The extracted structured data

n_consensus
integer
default:1

Number of consensus votes used

image_resolution_dpi
integer
default:192

DPI used to render document images

instructions
string | null

Free-form instructions supplied with the extraction request.

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

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

consensus
ExtractionConsensus · object

Consensus metadata for multi-vote extraction runs

metadata
Metadata · object
usage
RetabUsage · object

Usage information for the extraction

created_at
string<date-time> | null