> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stophy.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Question

> Ask one question about a page and get a short answer from its text, or no answer when the page does not say. $3 per 1,000 pages on top of $1.

`question` answers one question about the page, using only the text of the page.

## Ask a question

Get an API key in the [Quickstart](https://docs.stophy.dev/quickstart). Send `question` as an object. This request asks a documentation page for the name of its configuration file.

```bash cURL theme={null}
curl -X POST https://api.stophy.dev/v1/scrape \
  -H "Authorization: Bearer $STOPHY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://bun.com/docs/runtime/bunfig",
    "formats": [
      { "type": "question", "question": "What is the name of Bun'\''s configuration file?" }
    ]
  }'
```

```typescript TypeScript theme={null}
const response = await fetch("https://api.stophy.dev/v1/scrape", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.STOPHY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    url: "https://bun.com/docs/runtime/bunfig",
    formats: [
      { type: "question", question: "What is the name of Bun's configuration file?" },
    ],
  }),
});
const { data } = await response.json();
console.log(data.answer);
```

```python Python theme={null}
import os

import requests

response = requests.post(
    "https://api.stophy.dev/v1/scrape",
    headers={"Authorization": f"Bearer {os.environ['STOPHY_API_KEY']}"},
    json={
        "url": "https://bun.com/docs/runtime/bunfig",
        "formats": [
            {"type": "question", "question": "What is the name of Bun's configuration file?"},
        ],
    },
)
data = response.json()["data"]
print(data.get("answer"))
```

## Read the response

`data.answer` is a short answer of one to four plain sentences.

```json theme={null}
{
  "success": true,
  "data": {
    "answer": "Bun's configuration file is named bunfig.toml.",
    "metadata": {
      "title": "bunfig.toml | Bun Docs",
      "sourceURL": "https://bun.com/docs/runtime/bunfig",
      "statusCode": 200,
      "contentType": "text/html",
      "cacheState": "hit",
      "scrapeId": "72b01ca3-827d-4f0c-a2ca-15fc7b97fbf3",
      "costUsd": 0.004
    }
  },
  "id": "72b01ca3-827d-4f0c-a2ca-15fc7b97fbf3",
  "costUsd": 0.004,
  "requestId": "72b01ca3-827d-4f0c-a2ca-15fc7b97fbf3"
}
```

When the page does not state the answer, `answer` is left out of `data`, `data.warning` says `The page does not state an answer to the question.`, and the \$3 is not charged. Check that `answer` is there before you use it.

## Options

| Field | Type | Default | Effect |
| - | - | - | - |
| `type` | `string` | none | `"question"`. Required. |
| `question` | `string` | none | The question, such as `What is the refund window?`. Required, 1 to 10,000 characters. |

## Limits and errors

* Each request answers one question. To ask several, send several requests, or use [JSON](https://docs.stophy.dev/scrape/json.md) with one field per question.
* The answer is made from the first 50,000 characters of the page's Markdown.
* A call without `question` returns `400 invalidRequest`.

## Price

$4 per 1,000 pages: $1 for the page and $3 for the answer. A page that does not state the answer costs $1 per 1,000 pages.

## Related

* [Highlights](https://docs.stophy.dev/scrape/highlights.md) returns the passages themselves, with no model sentence in between.
* [JSON](https://docs.stophy.dev/scrape/json.md) fills several fields at once.
* [Summary](https://docs.stophy.dev/scrape/summary.md) summarizes the whole page.
* [Extract](https://docs.stophy.dev/extract/overview) pulls fields from pages and checks each one against the page.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.