PDF.chat API
Upload a PDF uye chat pamwe nayo kubva yako app - kubvunza mibvunzo uye kuwana mazano akanyorwa papeji, mu 100 + mashoko. Metered per page, hapana kushamisika.
Kuongorora
The PDF.chat API ndeimwe shoma REST interface. First iwe POST a document to ingest it and get back a job with the document's text and a per-page breakdown (text, bounding boxes, confidence). POST Zvimwe zvinyorwa zvinoda kuiswa mubhuku rezvinyorwa. Zvinyorwa zve5 mapeji kana zvishoma zvinodzokera mumisoro; zvinyorwa zvakakura zvinodzokera pending status kuti iwe poll kusvika done.
- Chikamu che URL:
https://pdf.chat - Mapepa e: PDF, pamwe neWord, PowerPoint, tenzi, uye mapikicha (PNG, JPG, WEBP, GIF, BMP, TIFF)
- Chat kunze: mazano nepeji citations; transcripts kuburikidza ne history endpoint
- Kugadzirisa
txt,md,docx,pdf,csv,json - Kuverenga injini:
cpu(fast, yakadhindwa docs) uyevlm(premium AI, handwriting, zvakaoma layout, math)
Ku_zivana
Kuratidza neyako API token (wanani pawebsite yako) account page) seBearer header:
Authorization: Bearer YOUR_API_TOKEN
Unogonawo kutumira ?api_token=… Usage inoongororwa zvichienderana nemari yepapeji yeaccount yako.
Kutumira dokumendi
POST /api/v1/ocr/, multipart fomu upload.
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"
Remembers the job. For ≤5- page files it is already done nezita rezita; mazhinji mafile anodzokera pending/processing, poll iyo status endpoint.
{
"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 } ] } ]
}
Get a result
GET /api/v1/ocr/<uuid>/, poll until status i done kana failed.
curl https://pdf.chat/api/v1/ocr/9f2c1b7e4a.../ \
-H "Authorization: Bearer YOUR_API_TOKEN"
Dzvanya kuti utore format
GET /api/v1/ocr/<uuid>/download/?format=md, export the result. format imwechete 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 nechikumbiro chekutumira
Kubvunza mibvunzo nezvebasa rapera. Mashoko anobva chete mumitauro yakabuda uye anotaura nezvemumwe mutauro. Kuda account token, chat feature is account-gated.
POST /api/v1/chat/<uuid>/, JSON body {"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?"}'
Returns the assistant message with its answer and a list of cited pages:
{"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/, fetch the full conversation transcript for a job.
Code mifananidzo
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?"}'
Parameter
| Field | Type | Kutaura |
|---|---|---|
file | file | Inodiwa. Iyo imwecheteyo i |
tier | string | cpu (default, fast/printed) kana vlm (premium AI: handwriting, layout, math). |
language | string | auto (yakajairika) kana kodhi yechitauro (en, ch, ja, ar, …). |
tool | string | Zviri nyore chirongwa slug (eg. summarize-pdf, ask-pdf) kuti zvisati zvaitika-frame chat yebasa iri. |
Maitiro & miganhu
| Chinyorwa | Chii chinonzi |
|---|---|
400 | Hapana faira, mhando isina kutsigirwa, kana faira iri hombe. |
401 | Kunonoka kana kusavapo API token. |
402 | Pasina mapeji, zuva nezuva / mwedzi nemwedzi yemahara muganho wakasvika, kana pasina mari. used/cap. |
404 | Job UUID hachisi kuwanikwa. |
409 | Kurodha pasi kwakakumbira mushure mekupera basa. |
Kana iwe uchida kushandura mapeji ese, unogona kusarudza pakati pezviuru zvezvirongwa zvepamberi (1/page paFast Tier, more on Premium). pricing.
Zvimwe zvinobvunzwa zvakanyanya
language=auto kuongorora, kana kutevedzera kodzero yakafanana.