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

# Exa Answer

Generate an answer to a question using Exa search results, with optional citations and source text. This is a passthrough to Exa's Answer API, exposed through the Novita gateway with a platform route prefix.

To authenticate with your Novita API key, get one from the [Novita dashboard](https://novita.ai/settings/key-management). Base URL: `https://api.novita.ai`.

## Quickstart

```bash theme={"system"}
curl -X POST 'https://api.novita.ai/v3/exa/answer' \
  -H 'Authorization: Bearer <api_key>' \
  -H 'Content-Type: application/json' \
  -d '{
    "query": "How tall is the Burj Khalifa?"
  }'
```

Running the quickstart above returns the following. The request returned 8 citations; three are shown here.

```json theme={"system"}
{
  "requestId": "50bd53d7599d1415761aaefea608f113",
  "answer": "The Burj Khalifa has a roof height of 828 meters (2,717 feet) [1][2][3]. When measured to the tip of its antenna, the total height is 829.8 meters (2,722 to 2,723 feet) [1][2][4].",
  "citations": [
    {
      "id": "https://en.wikipedia.org/wiki/Burj_Khalifa",
      "title": "Burj Khalifa - Wikipedia",
      "url": "https://en.wikipedia.org/wiki/Burj_Khalifa",
      "publishedDate": "2026-05-31T00:00:00.000Z"
    },
    {
      "id": "https://www.skyscrapercenter.com/building/burj-khalifa/3",
      "title": "Burj Khalifa - The Skyscraper Center",
      "url": "https://www.skyscrapercenter.com/building/burj-khalifa/3"
    },
    {
      "id": "https://www.britannica.com/topic/Burj-Khalifa",
      "title": "Burj Khalifa | Height, Architect, Top Floor, & Facts | Britannica",
      "url": "https://www.britannica.com/topic/Burj-Khalifa"
    }
  ]
}
```

## Request Headers

All endpoints require platform API authentication.

<ParamField header="Content-Type" type="string" required={true}>
  Use `application/json`.
</ParamField>

<ParamField header="Authorization" type="string" required={true} default="Bearer YOUR_API_KEY">
  Platform API key, formatted as `Bearer YOUR_API_KEY`.
</ParamField>

## Request Body

<ParamField body="query" type="string" required={true}>
  Natural-language question or instruction. Minimum length is 1.
</ParamField>

<ParamField body="text" type="boolean" required={false}>
  Whether to return source page text. Default is `false`.
</ParamField>

<ParamField body="outputSchema" type="object" required={false}>
  JSON Schema Draft 7 object for structured answer output.

  <Expandable title="outputSchema properties">
    <ParamField body="type" type="string" required={false}>
      JSON Schema root type, commonly `object`.
    </ParamField>

    <ParamField body="properties" type="object" required={false}>
      Field definitions for the structured answer.
    </ParamField>

    <ParamField body="required" type="string[]" required={false}>
      Required property names.
    </ParamField>

    <ParamField body="description" type="string" required={false}>
      Description of the structured output to guide generation.
    </ParamField>

    <ParamField body="additionalProperties" type="boolean | object" required={false}>
      Whether undeclared fields are allowed, or a schema for additional fields.
    </ParamField>
  </Expandable>
</ParamField>

## Examples

### Basic answer

```bash theme={"system"}
curl -X POST 'https://api.novita.ai/v3/exa/answer' \
  -H 'Authorization: Bearer <api_key>' \
  -H 'Content-Type: application/json' \
  -d '{
    "query": "What year was the Eiffel Tower completed?",
    "text": true
  }'
```

### Structured answer

```bash theme={"system"}
curl -X POST 'https://api.novita.ai/v3/exa/answer' \
  -H 'Authorization: Bearer <api_key>' \
  -H 'Content-Type: application/json' \
  -d '{
    "query": "How tall is Mount Everest and where is it located?",
    "outputSchema": {
      "type": "object",
      "properties": {
        "heightMeters": {"type": "number"},
        "country": {"type": "string"}
      },
      "required": ["heightMeters"]
    }
  }'
```

### Answer with source text

Set `text: true` to return the full source text alongside each citation, useful when you want to display or re-verify the evidence.

```bash theme={"system"}
curl -X POST 'https://api.novita.ai/v3/exa/answer' \
  -H 'Authorization: Bearer <api_key>' \
  -H 'Content-Type: application/json' \
  -d '{
    "query": "What are the main causes of coral bleaching?",
    "text": true
  }'
```

### List-shaped structured answer

An `outputSchema` can return an array when you expect several items rather than a single fact.

```bash theme={"system"}
curl -X POST 'https://api.novita.ai/v3/exa/answer' \
  -H 'Authorization: Bearer <api_key>' \
  -H 'Content-Type: application/json' \
  -d '{
    "query": "Which countries border Switzerland?",
    "outputSchema": {
      "type": "object",
      "properties": {
        "countries": {
          "type": "array",
          "items": {"type": "string"}
        }
      },
      "required": ["countries"]
    }
  }'
```

## Response

<ResponseField name="requestId" type="string" required={false}>
  Unique request identifier.
</ResponseField>

<ResponseField name="answer" type="string | object" required={false}>
  Generated answer. It can be structured according to the `outputSchema` provided in the request.
</ResponseField>

<ResponseField name="citations" type="object[]" required={false}>
  Search results used to generate the answer.

  <Expandable title="citation properties">
    <ResponseField name="title" type="string" required={false}>
      Source title.
    </ResponseField>

    <ResponseField name="url" type="string" required={false}>
      Source URL.
    </ResponseField>

    <ResponseField name="publishedDate" type="string" required={false}>
      Published date when available.
    </ResponseField>

    <ResponseField name="author" type="string" required={false}>
      Author when available.
    </ResponseField>

    <ResponseField name="id" type="string" required={false}>
      Exa document ID.
    </ResponseField>

    <ResponseField name="text" type="string" required={false}>
      Source text when requested.
    </ResponseField>
  </Expandable>
</ResponseField>

## Errors

Errors are returned as a JSON envelope with `code`, `reason`, `message`, and `metadata`. The platform validates and authenticates the request before forwarding it to Exa, so some errors originate at the platform and others are surfaced from upstream.

| Status | `reason`               | Meaning                                                                      |
| ------ | ---------------------- | ---------------------------------------------------------------------------- |
| `400`  | `MISSING_API_KEY`      | The `Authorization` header is absent.                                        |
| `400`  | `INVALID_REQUEST_BODY` | The body failed validation, such as a missing or malformed `query`.          |
| `403`  | `INVALID_API_KEY`      | The API key is invalid or not authorized.                                    |
| `404`  | `PATH_NOT_FOUND`       | The route does not exist.                                                    |
| `429`  | `RATE_LIMIT_EXCEEDED`  | Too many requests. Slow down and retry with backoff.                         |
| `500`  | `TASK_FAILED`          | Internal or upstream provider failure. Transient failures are safe to retry. |
| `503`  | `SERVICE_UNAVAILABLE`  | The service is temporarily overloaded or down. Retry with backoff.           |

For validation failures, `message` is a JSON-encoded string carrying the detailed `error` and `tag`. The examples below show that inner detail decoded for readability.

<ResponseExample>
  ```json 200 theme={"system"}
  {
    "requestId": "string",
    "answer": "string",
    "citations": [
      {
        "id": "string",
        "title": "string",
        "url": "string",
        "publishedDate": "string",
        "author": "string",
        "text": "string"
      }
    ]
  }
  ```

  ```json 400 theme={"system"}
  {
    "code": 400,
    "reason": "INVALID_REQUEST_BODY",
    "message": "Invalid request body | Validation error: expected string, received undefined at \"query\"",
    "metadata": {
      "trace_id": "0748a32faccde3d924752336fd5c1a31"
    }
  }
  ```

  ```json 403 theme={"system"}
  {
    "code": 403,
    "reason": "INVALID_API_KEY",
    "message": "invalid api-key",
    "metadata": {}
  }
  ```

  ```json 404 theme={"system"}
  {
    "code": 404,
    "reason": "PATH_NOT_FOUND",
    "message": "path not found for model",
    "metadata": {
      "trace_id": "3c3433f0cb475a04f9a4969b8c6ed903"
    }
  }
  ```

  ```json 429 theme={"system"}
  {
    "code": 429,
    "reason": "RATE_LIMIT_EXCEEDED",
    "message": "rate limit exceeded, please retry later",
    "metadata": {
      "trace_id": "5f2a9c7e41b8d0a36e9f4c2b7d81a0e5"
    }
  }
  ```

  ```json 500 theme={"system"}
  {
    "code": 500,
    "reason": "TASK_FAILED",
    "message": "upstream provider temporarily unavailable, please retry",
    "metadata": {
      "trace_id": "8846379c692d7218173460afe95640f1"
    }
  }
  ```

  ```json 503 theme={"system"}
  {
    "code": 503,
    "reason": "SERVICE_UNAVAILABLE",
    "message": "service temporarily unavailable",
    "metadata": {
      "trace_id": "b7e3f1a9d24c05e8f63a1b9c7e05d2f4"
    }
  }
  ```
</ResponseExample>

## Notes

* All request bodies are JSON.
* Extra Exa parameters not listed here may be passed through.
* Response shapes can vary depending on request options.
* This document intentionally omits billing-related fields.

## References

For more details, see the [Exa Answer API reference](https://exa.ai/docs/reference/answer).
