Ask

Ask questions about your parsed PDF documents and get answers. You can query multiple documents at once. Includes the full document context for precise answers.

POST https://pdf.ai/api/v2/ask

prompt one or more of your parsed documents (docIds) and get an answer based on their content.

Previously Parsed Documents

To use this endpoint the provided document IDs must have been previously parsed. See the Parse endpoint here.

Sample Requests

Here's how you can make requests to the endpoint using different programming languages.

curl -X POST https://pdf.ai/api/v2/ask \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "What is the main topic of this document?",
    "docIds": ["your-document-id-1", "your-document-id-2"]
  }'

Please replace placeholders like <YOUR_API_Key> with actual values.

Headers

Name
Type
Description

X-API-Key*

string

<API-Key>

Request Format

Content-Type: application/json

Request Parameters

Parameter
Type
Required
Description

prompt

string

Yes

The question or query you want to ask about the documents.

docIds

string[]

Yes

Array of document IDs to query. All documents must be already parsed.

Response format

Credit Usage

Credits are calculated based on the total number of pages across all documents queried

Component
Condition
Credit Calculation

Ask credits

Always charged

3 credits × total page count

Total Credit Formula

Total credits = Total page count * 3

Example

  • Document 1: 10 pages

  • Document 2: 5 pages

  • Total Credits Used: (10 + 5) × 3 = 45 credits

Last updated

Was this helpful?