Skip to main content
POST
/
answer
cURL
curl -X POST 'https://api.exa.ai/answer' \
  -H 'x-api-key: YOUR-EXA-API-KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "query": "What is the latest valuation of SpaceX?",
    "text": true
  }'
{
  "answer": "$350 billion.",
  "requestId": "b5947044c4b78efa9552a7c89b306d95",
  "citations": [
    {
      "title": "SpaceX valued at $350bn as company agrees to buy shares from ...",
      "url": "https://www.theguardian.com/science/2024/dec/11/spacex-valued-at-350bn-as-company-agrees-to-buy-shares-from-employees",
      "publishedDate": "2023-11-16T01:36:32.547Z",
      "author": "Humza Naveed",
      "id": "https://arxiv.org/abs/2307.06435",
      "image": "https://arxiv.org/pdf/2307.06435.pdf/page_1.png",
      "favicon": "https://arxiv.org/favicon.ico",
      "text": "SpaceX valued at $350bn as company agrees to buy shares from ..."
    }
  ],
  "costDollars": {
    "total": 0.007,
    "search": {
      "neural": 0.007
    }
  }
}

Documentation Index

Fetch the complete documentation index at: https://exa.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

Get your Exa API key

/answer supports structured output via the outputSchema parameter. Pass a JSON Schema object and the answer will be returned as structured JSON matching your schema instead of a plain string.

Authorizations

x-api-key
string
header
required

Pass your Exa API key in the x-api-key header. You can also authenticate with Authorization: Bearer .

Body

application/json
query
string
required

Natural-language question or instructions for the request.

Minimum string length: 1
Example:

"What is the latest valuation of SpaceX?"

stream
boolean
default:false

If true, the response is returned as a server-sent events (SSE) stream.

text
boolean
default:false

If true, returns full page text with default settings. If false, disables text return.

outputSchema
object

A JSON Schema Draft 7 specification for the desired answer structure. When provided, the answer is returned as a structured object matching the schema instead of a plain string.

Response

OK

answer
required

The generated answer based on search results. Returns a string by default, or a structured object matching the provided outputSchema.

Example:

"$350 billion."

requestId
string

Unique identifier for the request.

Example:

"b5947044c4b78efa9552a7c89b306d95"

citations
object[]

Search results used to generate the answer.

costDollars
object

Endpoint-dependent estimated dollar cost breakdown for the completed request. Billing is computed from usage counters rather than this response object.