# Answer a question

## Overview

Accepts a question and returns a written answer grounded in pages found on the web, together with the citations it was built from. The model choice trades latency against depth. Supplying a JSON Schema turns the prose answer into a structured object matching that schema, which makes the endpoint usable as a typed extraction step, and a system prompt constrains tone, length, or format.

The answer, plus the citations behind it with their titles, URLs, and publication dates.

## Input

These go in the `input` object of the run request.

| Field         | Type     | Required | Description                                                                                                                   |
| ------------- | -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------- |
| query         | string   | Yes      | The question to answer.                                                                                                      |
| model         | string   | No       | How much research to do before answering.<br>Allowed: exa, exa-pro, exa-research, exa-fast<br>Default: "exa"               |
| text          | boolean  | No       | Include the full page text of every citation.<br>Default: `false`                                                            |
| outputSchema  | object   | No       | A JSON Schema; the answer comes back as an object matching it instead of prose.                                              |
| systemPrompt  | string   | No       | Extra instructions for how to answer.                                                                                         |

Requests up to 1 MB.

## Example

Use your own API key and a saved idempotency key for each new job. Replace image or media placeholders with your own publicly reachable HTTPS URLs. Keep the same key and request body when recovering a timeout.

```bash
# Set once per job; reuse this key and the identical body after a timeout.
: "${AGENTSKY_IDEMPOTENCY_KEY:?Set a unique, saved key for this job}"
curl --fail-with-body https://gateway.agentsky.dev/v1/run \
  -H "authorization: Bearer $AGENTSKY_API_KEY" \
  -H "content-type: application/json" \
  -H "Idempotency-Key: $AGENTSKY_IDEMPOTENCY_KEY" \
  -d '{"provider":"exa","endpoint":"answer","input":{"query":"What is an API gateway for agents?","model":"exa"}}'
# If status is READY/RUNNING, poll GET /v1/runs/{runId} with the same API key.
```

## Pricing

$0.006 per call using your plan when signed in. Read the final customer charge from price.amount.value after the run finishes. A RUNNING response is not the final bill.
