Skip to content

Quickstart

Extraction is asynchronous on both tiers. Submitting returns job ids and a pending status; the result arrives once the job reaches a terminal state. The clients wrap that loop for you, so nothing rides on a single long-lived HTTP request and a large file cannot trip a request timeout.

Python
from pathlib import Path
from xberg_io_sdk import XbergClient
with XbergClient(api_key="kz_...") as client:
job = client.extract_and_wait(file=Path("invoice.pdf"))
if job.result is not None:
print(job.result.content)

It is a convenience over two calls you can make yourself:

  1. SubmitPOST /v1/extract returns job_ids and status: "pending", with 202.
  2. PollGET /v1/jobs/{id} until the status is terminal (completed, partial_success, failed or cancelled).
  3. ReadGET /v1/jobs/{id}/result returns the extracted documents.

Two timeouts are in play and they are deliberately separate: a per-request timeout of 30 seconds, and a wait timeout of 5 minutes covering the whole poll loop. Polling starts at one second and can back off exponentially. Raise the wait timeout for large documents rather than the request timeout — the request is only ever a short status read.

If the job ends failed or cancelled, the wait raises rather than returning a job you would have to inspect.