PDF.chat API
Fi PDF kan pamọ́, ki o si fi chat pamọ́ pẹlú rẹ̀ lati inú ohun elo rẹ̀ - beere àwọn ibeere, ki o si gba àwọn à
Àwọn Àkọ́gbègbè
PDF.chat API ní ojú-ìwé REST kékeré. Òjútó rẹ̀ POST Àkọsílẹ̀ láti fi pamọ́ sínú àti láti gba iṣẹ́ padà sínú àwọn àkọsílẹ̀ àti àwọn ojú-ìwé (àkọsílẹ̀, àwọn POST Àwọn ààyè lórí iṣẹ́ náà àti gba àwọn ààyè tí a dá nínú àkọsílẹ̀ náà, gbogbo wọn ní àwọn àkọsílẹ̀ ojú-ìwé tí wọn tì wa ní. Àwọn iṣẹ́ àwọn ojú-ìwé 5 àti àwọn tí kò ní ìbárá nínú àwọn iṣẹ́ nlà nígbà kan nípa pending ipo ti o bá fi àwọn àwọn ààyè pamọ́ done.
- URL Ìdáràn:
https://pdf.chat - Àwọn Àkọsílẹ̀ nínú: PDF, plus Word, PowerPoint, ọrọ, ati àwòrán (PNG, JPG, WEBP, GIF, BMP, TIFF)
- Chat out: Àwọn àwọn
- Àwọn àkọlé àwọn àkọlé
txt,md,docx,pdf,csv,json - Àwọn ìṣàmúlò-ètò ìṣàfihàn:
cpu(àkọ́lé àìpẹ́, àwọn àkọ́lé àìpíríǹtì) àtivlm(AI premium, kọ̀ọ̀kan, àwọn ààtò ìṣàfarawé, àwọn mátírika)
Àwọn Àmì-ìwé
Fi àwọn àmì-ìwé rẹ pamọ́ Àwọn àtòjọ-ètò API (wá o ní àwọn ààyè-iṣẹ́ rẹ Àwọn Àmì-ìwé Àwọn Àwọn Àkọ́lé) bí àwọn àkọlé àwọn àkọlé:
Authorization: Bearer YOUR_API_TOKEN
O lè fi pamọ́ ?api_token=… bí àwọn ààtò ìtàn. Àwọn ìlòjójútó ní pàtó láti gbọ́dọ̀ sí àwọn ojú-ìwé àwọn kọ́̀ǹpútà rẹ̀.
Fi àkọlé pamọ́
POST /api/v1/ocr/, Ìṣàfilọ́lẹ̀ àwọn fọọmu àwọn àwọn ààyè-iṣẹ́.
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"
Ń bọ́ iṣẹ́ padà. Fun àwọn fáìlì ojú-ìwé ≤5 o tí wa done pẹlú àkọ́lé; àwọn fáìlì nlà tí wọ́n sí pending/processing, wó àwọn ààtò ìtàn ìṣàfarawé.
{
"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 } ] } ]
}
Gba àwọn àwọn àkóónú
GET /api/v1/ocr/<uuid>/, àwọn ààyè-iṣẹ́ status ní done tabi failed.
curl https://pdf.chat/api/v1/ocr/9f2c1b7e4a.../ \
-H "Authorization: Bearer YOUR_API_TOKEN"
Àwọn ìṣàmúlò-ètò
GET /api/v1/ocr/<uuid>/download/?format=md, Ìjánu-ìtò format jẹ́ ọkan ninu 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>/, Àwọn ààyè-iṣẹ́ {"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?"}'
Fi àkọlé àwòrán pamọ́ sí àwọn àgbèwọlé rẹ̀ àti àtòjọ àwọn ojú-ìwé tí a kọ̀ ní:
{"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/, gba àwọn àkọ́lé àwọn àkọ́lé fún iṣẹ́ kan.
Àwọn ààtòjú àwọn ìṣàmúlò-ètò
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?"}'
Àwọn Àtòjọ-ẹ̀yàn
| Àwọn Ààyè | Àwọn Ìṣàmúlò-ètò | Àwọn Àkọ́lé |
|---|---|---|
file | file | Tí a fẹ́. Àwòrán tàbí PDF láti ṣe ìṣàmúlò-ètò. |
tier | string | cpu (òòró, ìṣàfarawé àwọn ààtòjútó) tàbí vlm (AI premium: ọwọ-itẹwe, oju-iwe, mathematics). |
language | string | auto (pílẹ̀dà) tàbí ìṣàmúlò-ètò ìtàn (en, ch, ja, ar,... |
tool | string | Àwọn àwọn àtòjọ-ẹ̀yàn àtòjọ-ẹ̀yàn (e.g. summarize-pdf, ask-pdf) lati fi fọọmu-ẹ̀yàn lọ́wọ́lọ́wọ́ chat fun iṣẹ́ náà. |
Àwọn Àṣìṣe & Àwọn Ìgbà Ìgbà
| Àwọn Àmì-ìwé | Ìtumọ̀ |
|---|---|
400 | Kò ní fáìlì, irúfẹ́ tí a kò bá jẹ́, tàbí fáìlì tí o jú ìwọ̀n lọ. |
401 | Àwọn àyọkà API tí kò wà tàbí àwọn àyọkà API tí kò bá jẹ́. |
402 | Òkù àwọn ojú-ìwé, àwọn ìpamọ́ àwọn ojú-ìwé ọjọ́/óṣù, àti àwọn used/cap. |
404 | Kò rí iṣẹ́ UUID. |
409 | Àkọ́lé àwòrán |
Àwọn ojú-ìwé ìṣàfarawé kọ̀ǹpútà (1/ ojú-ìwé nínú ìpelé ìsàlẹ̀-ilà, àwọn mìíràn nínú àwọn àwọn ìṣàmúlò-ilà. Àwọn àwọn ìṣàmúlò-ilà tí a fi pamọ́ ń fi àwọn ojú-ìwé àti àwọn ìṣàmúlò-ilà fáìlì kọ̀ǹpútà kọ̀ǹpútà pamọ́ pamọ́. Wò Ìṣàmúlò-ètò.
Àwọn Àtòjọ-ẹ̀yàn
language=auto lati ṣàfihàn, tàbí fi àkóónú kan lọ́wọ́lọ́wọ́.