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) uye vlm (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

FieldTypeKutaura
filefileInodiwa. Iyo imwecheteyo i
tierstringcpu (default, fast/printed) kana vlm (premium AI: handwriting, layout, math).
languagestringauto (yakajairika) kana kodhi yechitauro (en, ch, ja, ar, …).
toolstringZviri nyore chirongwa slug (eg. summarize-pdf, ask-pdf) kuti zvisati zvaitika-frame chat yebasa iri.

Maitiro & miganhu

ChinyorwaChii chinonzi
400Hapana faira, mhando isina kutsigirwa, kana faira iri hombe.
401Kunonoka kana kusavapo API token.
402Pasina mapeji, zuva nezuva / mwedzi nemwedzi yemahara muganho wakasvika, kana pasina mari. used/cap.
404Job UUID hachisi kuwanikwa.
409Kurodha 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

Create a free account and open your account account page, yako token inoratidzwa kwauri nekudzvanya kwekopi.

Yeah, mafaera e5 mapeji kana mashoma anodzosera iyo yakazara mhinduro muPOST mhinduro, saka hapana polling inodiwa kune akawanda mapikicha uye maPDFs afupi.

Anopfuura 100, kusanganisira Latin, CJK, Arabic, Cyrillic uye Indian scripts. Usa language=auto kuongorora, kana kutevedzera kodzero yakafanana.

Uploads zvinogadziriswa chete kuti vabvunze mibvunzo yako uye kubvisa otomatiki. Hatina kutengesa, kugovera, kana kudzidzisa pazvinyorwa zvako.

Kushandiswa kunoongororwa nepeji rimwe nerimwe nemari yeaccount yako: kufona pasina zita kunowana zuva nezuva rezuva, maaccounts emahara ane mwedzi wega wega, uye mapurojekiti akabhadharwa anoshandisa mari yakatengeswa neyakakwira peji uye priority.

Iwe unogona kutumira PNG, JPG, WEBP, GIF, BMP, TIFF, uye multi-page PDF. Zvibodzwa kurodha pasi se txt, md, docx, pdf (searchable), csv, kana json kuburikidza download endpoint's format parameter.

400 i file yakaipa, isiri kutsigirwa, kana file iri hombe; 401 i file yakaipa kana isina kuvimbika; 402 i off pages; 404 i job UUID isiri kuzivikanwa; uye 409 i download requested before the job finished.

A job object with status, tier, language, page_count, and mean_confidence, plus the full text and markdown. The pages array breaks each page into blocks with their text, bounding box (bbox), and per-block confidence.

Usashandisa cpu (yakajairika) yezvimwe zvinyorwa zvakadhindwa zvakachena. Usashandisa vlm, iyo premium AI injini, yezvinyorwa zvakanyorwa nepenzura, zvinyorwa zvakaoma kana zvine ma Column akawanda, math, uye kushandura, uko kunonyatsonaka.

Pass chirongwa ne slug (semuenzaniso summarize-pdf kana kubvunza-pdf) kuti pre-frame chat yebasa iri, saka mubatsiri ari tuned kuti kudzokorora kana kubvunza mibvunzo nezve chinyorwa.

Files of 5 pages or less return inline in the POST response. Larger files come back immediately as pending or processing, and you poll GET /api/v1/ocr/<uuid>/ kusvika status yaitwa kana kukundikana. Yakabhadharwa michina inowedzera peji.

API i REST yakajeka pamusoro pe HTTPS, saka inoshanda kubva kune chero rurimi neHTTP mutengi, ona Python, Node.js, uye cURL mifananidzo pamusoro. Hapana SDK yekuisa; maminetsi mashoma estandard HTTP code ndeaya chete aunoda.