RTLDocs API
RTLDocs exposes a small, typed extraction API. Send a document, get back structured JSON — every text run tagged with a script, a reading direction, and a confidence score, correctly ordered even for Arabic and Hebrew content embedded inside an otherwise left-to-right response.
Quickstart
POST a file as multipart form data to /v1/extract.
curl -X POST https://api.rtldocs.ai/v1/extract \ -H "Authorization: Bearer sk_live_***" \ -F "file=@invoice_ar.pdf"
Extracted values live under fields, as plain strings. The confidence score and direction tag live one level deeper, on each text run in pages[].runs[] — RTL values render correctly even inside this LTR JSON block.
Authentication
Every request needs a bearer token — an API key generated from your dashboard. Send it as an Authorization header on every request.
Authorization: Bearer sk_live_***
Missing or invalid keys get a 401 with an ErrorResponse body. Keys are scoped to your account's plan and monthly page quota.
POST /v1/extract
Accepts either multipart/form-data (upload a file, or pass a url field instead) or application/json (fetch a document from a public url — no upload). The two content types share the same option fields below; the JSON body only differs in that languages is an array of strings there instead of a comma-separated string, and url is required.
Request parameters
Response — ExtractResponse (200, sync)
Returned when mode=sync and format=json (the default). If format is txt or md, the body is the extracted text as a raw string instead.
PageResult & ProcessedTextRun
Each entry in pages is a PageResult:
Each entry in runs is a ProcessedTextRun — a span of text after script-aware postprocessing (bidi fixes, Unicode normalization, digit policy):
ConfidenceSummary
GET /v1/jobs/{job_id}
Poll this after a POST /v1/extract with mode=async returned a job_id.
Response — JobStatusResponse:
Errors
Errors are returned as JSON with a consistent shape:
A 402 from the shared daily pool carries extra fields alongside error — limit_tokens, used_tokens, and resets_at (ISO timestamp) — so you can show users when to retry instead of just a generic failure.