# Ask a PDF a question

An answer from the document only, with page citations. Every quote is checked against the page text; `verified: false` marks one that couldn't be found. Price: 2 credits for up to 10 pages read, +1 per further 10.

`POST /v1/ai/ask`

## Request

```bash title="curl"
curl -X POST https://api.fynepdf.com/v1/ai/ask \
  -H "Authorization: Bearer $FYNEPDF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"file_id":"file_01jc8x4m2k9q7r3t5vwy6z","question":"What is the notice period in this contract?"}'
```

```js title="Node"
import FynePDF from "fynepdf";

const fyne = new FynePDF(); // reads FYNEPDF_API_KEY
const answer = await fyne.ai.ask({
  file_id: "file_01jc8x4m2k9q7r3t5vwy6z",
  question: "What is the notice period in this contract?"
});
```

```python title="Python"
from fynepdf import FynePDF

fyne = FynePDF()  # reads FYNEPDF_API_KEY
answer = fyne.ai.ask(
    file_id="file_01jc8x4m2k9q7r3t5vwy6z",
    question="What is the notice period in this contract?",
)
```

## Body

| Parameter | Type | Required | What it does |
|---|---|---|---|
| `file_id` | string | yes |  |
| `question` | string | yes |  |

## Response

The answer.

| Field | Type | Required | What it does |
|---|---|---|---|
| `object` | "answer" | yes |  |
| `answer` | string | yes |  |
| `found` | boolean | yes |  |
| `citations` | array of object | yes |  |
| `pages_read` | array of integer | yes |  |
| `credits` | integer | yes |  |
| `test` | boolean |  |  |

## Errors

Errors are [problem details](https://fynepdf.com/developers/docs/errors) (RFC 9457) with a `code` you can branch on and a `request_id` for support.


---

Open this page in a browser: https://fynepdf.com/developers/docs/api/ask-pdf

More: [All tools](https://fynepdf.com/tools) · [AI agents](https://fynepdf.com/ai/agents) · [llms.txt](https://fynepdf.com/llms.txt) · [Sitemap](https://fynepdf.com/sitemap.xml)
