ForHosting KIT · Semantic Search & RAG

Chat with a PDF

A 200-page contract, manual or report is easier to interrogate than to read cover to cover. This endpoint turns a PDF into something you can ask a question and get back an answer grounded in that exact file, with the passage it came from attached.

● StablePer request + per query$0.003
Use it from WebAPIEmailApp soonTelegram soon

Run this on our servers with your account. Free tools run in your browser; this one bills your KIT balance per the price above.

Reading isn't always the point, finding is

Nobody opens a 90-page equipment manual because they enjoy reading it; they open it because a machine is making a noise and page 47 has the answer. rag.chat_pdf is built for that moment: point it at the document, ask the actual question, and skip the table of contents entirely. It works as well on a single contract as it does on a lengthy technical spec — the document defines the boundaries of what it will and won't answer.

The request and what you get back

POST /rag/chat-pdf with the PDF and a question, and the task runs asynchronously — a task_id comes back immediately, and the answer follows through a signed webhook call or a signed link that stays live for 24 hours. The response pairs the answer with the passage in the PDF it was drawn from, so the person reading it can jump straight to the relevant page instead of taking the answer on faith.

PDF was never meant to be searched this way

The format was designed in the early 1990s to make a document look identical on any printer or screen — a fixed, portable layout, not a structured, queryable text source. That's exactly why free-text search inside a long PDF is so often disappointing: it matches literal words, not meaning, and misses a passage that answers your question using different phrasing. Retrieval-based question answering sidesteps that by understanding what the question is really asking, not just which words appear on the page.

Where it fits in a document workflow

Teams that field the same handful of questions against the same document over and over — a policy, a manual, a signed agreement — stop re-reading it from scratch each time and instead ask it directly. Because pricing is a flat per-request fee plus a per-query rate and the task runs async, a support desk can wire this behind a chat widget without worrying that a spike in questions turns into an unpredictable bill or a blocked interface while an answer is generated.

Where the boundaries are

The answer only reflects what's actually written in the PDF you send — it won't invent a clause that isn't there or answer questions about a different document you didn't include. That constraint is deliberate: an answer confined to the source material is one you can trust enough to act on, which is the entire point of asking a document a question instead of guessing.

Employee handbook lookup

An HR team lets staff ask the employee handbook a direct question — like how much parental leave they're entitled to — instead of searching a long PDF manually.

Technical manual troubleshooting

A field technician asks an equipment manual what an error code means and gets the exact procedure from the relevant page.

Contract clause lookup

A procurement team asks a signed vendor contract whether a specific liability clause exists, without re-reading the whole document.

Research paper Q&A

A student asks a lengthy research paper to explain its methodology in plain terms, cited to the exact section it came from.

How do I chat with a PDF using the API?

POST the PDF file and your question to /rag/chat-pdf, and collect the cited answer by webhook or a signed link valid for 24 hours.

Is the chat with PDF API free?

No, there's no free tier or trial; it costs $0.003 per request plus $0.015 per query, and a failed task is never billed.

Does it work on scanned PDFs or only text PDFs?

It works on PDFs where the text content can be extracted; a heavily scanned image-only PDF should be processed with OCR first for reliable answers.

Can I ask multiple questions about the same PDF?

Yes, send a separate request per question; each one runs independently and returns its own cited answer.

How accurate are the answers?

Answers are grounded in the passages retrieved from your PDF and cited to them, so you can check any claim directly against the source page.

Can I chat with very long PDFs?

Yes, the endpoint retrieves the relevant passages from within the document regardless of its overall length before generating the answer.

Is this endpoint live?

Yes, /rag/chat-pdf is live and ready for production traffic.

Is my PDF stored after I get an answer?

No, uploaded PDFs and results are deleted after the retention window and never used for training.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/rag/chat-pdf

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, and soon from our app, email and Telegram.

curl -X POST https://api.kit.forhosting.com/rag/chat-pdf \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":"…"}'
{
  "input": "…"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "rag.chat_pdf",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.003
Per query$0.015

Published price — no tokens, no invented credits. A failed task is never charged.

max_chunks10000
max_tokens20000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.
422task_failedThe task failed after 3 retries. You are never charged for it.

Read the full KIT documentation →