PDF.chat API
Upload a PDF and chat with it from your own app — ask questions and get answers cited to the page, in 100+ languages. Metered per page, no surprises.
Incamake
The PDF.chat API is a small REST interface. First you POST A Inyandiko Kuri na Kubona Inyuma A Na: i Umwandiko na A - Ipaji: (Umwandiko, Akazu,). POST na Kubona in i Inyandiko, i Ipaji: Kuva:. Bya 5 Amapaji Cyangwa Gusubiramo Inzira% s; Gusubiramo Na: A pending Imimerere done.
- URL:
https://pdf.chat - Inyandiko zisanzwe Umwandiko na Ishusho
- Chat out: Na: Ipaji:; i Urutonde Impera Akadomo
- Umwandiko Inyuma:
txt,md,docx,pdf,csv,json - Amashanyarazi
cpu(Byoroheje, Byacapwe Inyandiko navlm(, Imigaragarire, Imigaragarire, Imibare)
Igaragazambere ry'Inyandiko
Na: API (Gushaka ku Aderesi Ipaji) Nka A Umutwe:
Authorization: Bearer YOUR_API_TOKEN
Gushyiraho ?api_token=… Nka A Ikibazo: Igenamiterere. ni Ipaji: Konti:.
a Inyandiko
POST /api/v1/ocr/, Ifishi% S: Itangira.
curl -X POST https://pdf.chat/api/v1/ocr/ \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-F "file=@invoice.pdf" \
-F "tier=vlm" \
-F "language=auto"
i. - Ipaji: Idosiye ni done Na: i Umwandiko; Idosiye Inyuma pending/processing, i Imimerere Impera Akadomo.
{
"uuid": "9f2c1b7e4a...",
"status": "done",
"tier": "vlm",
"language": "auto",
"page_count": 1,
"mean_confidence": 0.98,
"text": "INVOICE\nAcme Corp\nTotal: 215.00 USD",
"markdown": "# INVOICE\n\n**Acme Corp** ...",
"pages": [ { "index": 0, "text": "...", "blocks": [ { "text": "...", "bbox": [x0,y0,x1,y1], "confidence": 0.98 } ] } ]
}
Igisubizo
GET /api/v1/ocr/<uuid>/, Kuri status ni done Cyangwa failed.
curl https://pdf.chat/api/v1/ocr/9f2c1b7e4a.../ \
-H "Authorization: Bearer YOUR_API_TOKEN"
a Imiterere
GET /api/v1/ocr/<uuid>/download/?format=md, Kohereza i Igisubizo. format ni Rimwe Bya txt, md, docx, pdf, csv, json.
curl -L "https://pdf.chat/api/v1/ocr/9f2c1b7e4a.../download/?format=docx" \
-H "Authorization: Bearer YOUR_API_TOKEN" -o result.docx
Chat with a document
Ask questions about a finished job. Answers are grounded only in the extracted text and cite the source page. Requires an account token, the chat feature is account-gated.
POST /api/v1/chat/<uuid>/, Ibiro {"message": "your question"}.
curl -X POST https://pdf.chat/api/v1/chat/9f2c1b7e4a.../ \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "What is the invoice total and due date?"}'
i & Ubutumwa Na: na A Urutonde Bya Amapaji:
{"conversation": "a1b2…", "message": {
"role": "assistant",
"content": "The total is $42, due on March 3 (p. 1).",
"citations": [{"page": 1, "cited_text": "The invoice total is $42…", "document_id": "9f2c1b7e4a…"}]
}}
GET /api/v1/chat/<uuid>/history/, i Cyuzuye ya: A Ibikorwa:.
Urugero:
import requests, time
BASE = "https://pdf.chat/api/v1"
H = {"Authorization": "Bearer YOUR_API_TOKEN"}
# 1. Upload a PDF
with open("contract.pdf", "rb") as f:
job = requests.post(BASE + "/ocr/", headers=H, files={"file": f}).json()
# 2. Wait until it's ready to chat
while job["status"] in ("pending", "processing"):
time.sleep(2)
job = requests.get(f"{BASE}/ocr/{job['uuid']}/", headers=H).json()
# 3. Ask questions — every answer is cited to the page
ans = requests.post(f"{BASE}/chat/{job['uuid']}/", headers=H,
json={"message": "What is the termination notice period?"}).json()
print(ans["message"]["content"])
print(ans["message"]["citations"])
import fs from "fs";
const BASE = "https://pdf.chat/api/v1";
const H = { Authorization: "Bearer YOUR_API_TOKEN" };
// 1. Upload a PDF
const form = new FormData();
form.append("file", new Blob([fs.readFileSync("contract.pdf")]), "contract.pdf");
let job = await (await fetch(`${BASE}/ocr/`, { method: "POST", headers: H, body: form })).json();
// 2. Wait until it's ready to chat
while (["pending", "processing"].includes(job.status)) {
await new Promise(r => setTimeout(r, 2000));
job = await (await fetch(`${BASE}/ocr/${job.uuid}/`, { headers: H })).json();
}
// 3. Ask questions — every answer is cited to the page
const ans = await (await fetch(`${BASE}/chat/${job.uuid}/`, {
method: "POST", headers: { ...H, "Content-Type": "application/json" },
body: JSON.stringify({ message: "What is the termination notice period?" })
})).json();
console.log(ans.message.content, ans.message.citations);
# 1. Upload a PDF
curl -X POST https://pdf.chat/api/v1/ocr/ \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-F "file=@contract.pdf"
# 2. Ask questions (use the uuid from step 1) — answers cited to the page
curl -X POST https://pdf.chat/api/v1/chat/UUID/ \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "What is the termination notice period?"}'
Ibigenga
| Ubuso | Ubwoko bw'agakandisho | Isobanuramiterere |
|---|---|---|
file | file | Bya ngombwa Ishusho Cyangwa Kuri |
tier | string | cpu ( Mburabuzi, Bihuta / Cyangwa vlm (: Imigaragarire, Imigaragarire, Imibare). |
language | string | auto ( Mburabuzi) Cyangwa A Ururimi: Ikosa (en, ch, ja, ar,... |
tool | string | Ibikoresho (& eg; summarize-pdf, ask-pdf) to pre-frame the chat for that task. |
Amakosa na Imipaka
| Inyandikoporogaramu | Isobanuramiterere |
|---|---|
400 | IDOSIYE Ubwoko Cyangwa Idosiye |
401 | Cyangwa Sibyo |
402 | Bya Ipaji:, Ku munsi / Byarangiye Kigenga Impera:, Cyangwa Oya. used/cap. |
404 | OYA Byabonetse |
409 | Mbere i Ibikorwa:. |
Ipaji: (1 / Ipaji: ku i Bihuta, Birenzeho ku). - Idosiye Ipaji: na & Ongera Ikintu. Itangira....
Ibibazo bizwa kenshi
language=auto Kuri, Cyangwa A Inyandikoporogaramu.