apyhub
ARTIFICIAL INTELLIGENCE · DATA EXTRACTION

Talk to PDF API

Hosted on ApyHub

What it does

PDF Question Answering lets you send a PDF and ask a natural-language question about its contents. It returns an answer string based on the document you provide, so you can extract specific facts without building your own parser or retrieval pipeline.

Use POST /file when you have the PDF as an uploaded file. Send a binary file up to 10 MB and a query string up to 2000 characters. Use POST /url when the PDF is already hosted online; send a public .pdf URL in file_url plus the same query field. In both cases, the response includes an answer field with the model's answer.

This is a good fit for document search, internal knowledge assistants, contract review, and support workflows where users need a direct answer from a specific PDF. Ask for totals, dates, requirements, definitions, or other details from reports, manuals, policies, and forms.

PDF Question Answering is useful when you want a lightweight AI layer over documents without converting them into another format first. Send the file or URL, ask the question, and use the returned answer in your app or automation.

▣ ENDPOINT 01 / 02
POST
Ask a question about an uploaded PDF
http://localhost:8080/apyhub/ask-question-about-pdf/file
QUICKSTARTGUIDE

Quickstart

Upload a PDF and ask a question about its contents.

curl -X POST "http://localhost:8080/apyhub/ask-question-about-pdf/file" \
  -H "apy-token: $APY_TOKEN" \
  -F "file=@/path/to/document.pdf" \
  -F "query=What was the total revenue in Q3?"

What you'll get back

Returns a JSON object with an answer string field containing the model’s response.

{
  "answer": "The total revenue in Q3 was $1.2 million."
}
TRY ITLIVE · 200 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.
body*
PDF file to query. Maximum 10 MB. Must be a valid, non-password-protected PDF.
Natural-language question about the document content.

About this endpoint

What it does

Uploads a PDF and a natural-language question about that document, then returns the model’s answer. The request body includes the PDF file and the query text.

Request Body

ParameterTypeMandatoryDescription
fileStringYesPDF file to query. Maximum 10 MB. Must be a valid, non-password-protected PDF.
queryStringYesNatural-language question about the document content. Max length: 2000 characters.

Response

Returns a JSON object with an answer string field. The shape is based on the LLM response, but the response always includes answer.

ParameterTypeMandatoryDescription
answerStringNoThe model’s answer to the question.

Body

Name
Type
Description
bodyREQUIRED
object

Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.

▣ ENDPOINT 02 / 02
POST
Ask a question about a PDF at a URL
http://localhost:8080/apyhub/ask-question-about-pdf/url
QUICKSTARTGUIDE

Quickstart

Ask a question about a PDF by sending its public URL and your question.

curl -X POST "http://localhost:8080/apyhub/ask-question-about-pdf/url" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "file_url": "https://assets.apyhub.com/samples/sample.pdf",
    "query": "What is the minimum contrast ratio required for normal text?"
  }'

What you'll get back

Returns a JSON object with an answer string field containing the model's response to your question.

{
  "answer": "The minimum contrast ratio required for normal text is 4.5:1."
}
TRY ITLIVE · 200 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
Natural-language question about the document content.
Publicly accessible PDF URL. Must end in `.pdf`.

About this endpoint

What it does

Submits a public PDF URL and a natural-language question, then returns a text answer based on the document content.

Request Body

ParameterTypeMandatoryDescription
file_urlStringYesPublicly accessible PDF URL. Must be a URI and end in .pdf.
queryStringYesNatural-language question about the document content. Max length: 2000 characters.

Response

Returns a JSON object with an answer string field containing the answer to the submitted question.

ParameterTypeMandatoryDescription
answerStringNoThe answer to the question.

Body

Name
Type
Description
bodyREQUIRED
object
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.