> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nativeport.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nativeport.ai/_mcp/server.

# Exa

Fronts the neural-search API of [Exa](https://exa.ai). Its sibling endpoints all live on the one host `api.exa.ai` and are mounted under `/exa`:

```
POST /exa/<endpoint>   → https://api.exa.ai/<endpoint>
```

Only `POST` is mounted. All controls live in the JSON body, which is relayed without modification.

## Endpoints

Exactly these endpoints are admitted; anything else is refused with the gateway's own `404` and never reaches Exa.

| Endpoint      | Purpose                         |
| ------------- | ------------------------------- |
| `search`      | Neural / keyword web search     |
| `contents`    | Fetch contents for result URLs  |
| `findSimilar` | Find pages similar to a URL     |
| `answer`      | Generate an answer with sources |

The async `/research` API on Exa's side is **intentionally left unexposed**.

## Credential handling

Exa honors two credential channels — an `x-api-key` header and, alternatively, a bearer token in `Authorization`. The gateway supplies the former and deletes the latter, closing off both:

* **`x-api-key` is injected**; a client-supplied value is overwritten.
* **`Authorization` is removed** before the request goes upstream — which simultaneously shuts the second Exa auth channel; no key can be smuggled through `Authorization`.

## Examples

#### Search

```bash
curl -X POST "$GATEWAY/exa/search" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"query": "best neural search papers", "numResults": 5}'
```

#### Answer

```bash
curl -X POST "$GATEWAY/exa/answer" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"query": "What is a vector database?"}'
```

Responses arrive as Exa's JSON, untouched. Field-level request and response detail lives in [Exa's documentation](https://docs.exa.ai); the gateway modifies neither.