PDF AI API
Base path: /api/v1/pdf_handler/ai/. Python: client.pdf.ai. API-key scope: ai_extract
(scopes).
Warning
Every submit spends credits
Each POST below runs a language model on your PDF and spends credits. The finished job
reports what it cost in credits_charged, and the ai section of the
rate card lists the base price of each AI feature. A caller without
enough credits gets 402.
Each submit takes the PDF as a multipart upload and answers 202 with a job_id. Poll the job
until its status is done or failed.
| Method | Path | Python | What the job returns |
|---|---|---|---|
POST | /ask/ | ai.ask(question, file_path=None, session_id=None) | An answer with page citations; reuse session_id for a follow-up question |
POST | /fill/ | ai.fill(path) | Suggested values for the PDF’s form fields |
POST | /detect-fields/ | ai.detect_fields(path, page=1) | Fillable fields detected on one scanned page |
POST | /suggest-comments/ | ai.suggest_comments(path) | Review comments |
POST | /check-numbers/ | ai.check_numbers(path) | Findings about figures and arithmetic |
POST | /classify/ | ai.classify(path) | A document class and a suggested filename |
POST | /edit/ | ai.edit(path, instruction="...") | Proposed find/replace edits for the instruction |
GET | /jobs/{job_id}/ | ai.job(job_id) | Poll: status, result, error, credits_charged |
Job status is one of queued, running, done or failed.
import time
from indox_client import Indox
with Indox() as client:
job = client.pdf.ai.ask("What is the total due?", file_path="invoice.pdf")
while (result := client.pdf.ai.job(job["job_id"]))["status"] in ("queued", "running"):
time.sleep(2)
print(result["result"], result["credits_charged"])The edit job proposes changes and does not modify your file.