✳ainav.

tutorials

Wiring Exa or Tavily: search requests, responses, and citations

When you need a search API inside an agent or an app, this article walks the official Exa and Tavily request, response, and citation fields, with example payloads aligned to official field names and official credit figures from 10 November 2026. It is not another AI search chat review, and no live API calls were made.

Wiring Exa or Tavily: search requests, responses, and citations

If the job is “give me an answer box I can chat with,” a search API is the wrong shape. That everyday research job is already covered in Perplexity vs You.com vs ChatGPT for AI Search: Which Fits Everyday Research?. This article is for a different deliverable: you are wiring “bring back web results with URLs I can cite” into an agent or an application.

Exa and Tavily both expose official search APIs for that job. They are not ranked here, and they are not treated as interchangeable endpoints with different logos. The useful work is to read the request, the response, and where a citation actually lives in the payload, then pick the official endpoint that matches the next step — search, answer-with-citations, contents, extract, map, or crawl.

How this article was written

Official Exa and Tavily documentation, including pricing, credits, and the Search API references, were opened first-hand on 10 November 2026 (Asia/Shanghai) and rechecked on 1 December 2026 (Asia/Shanghai). No API keys were created, and no live requests were sent. Every JSON block below is an example assembled from official field names. Placeholder keys are used on purpose. Prices, credits, and rate limits below are the official figures from the 1 December 2026 recheck, except where a page is dated as opened only on 10 November 2026. This article does not teach bypassing login walls or scraping sites the APIs are not licensed to fetch.

When a search API is the right shape

Use a search API when your application already owns the prompt, the model call, and the UI, and you need a structured list of results you can store, filter, or pass on as grounding. Typical fits, from official product surfaces:

  • An agent that must return URLs alongside an answer.
  • A backend that needs page text or extracts after a search, through the vendor’s contents or extract endpoints, not through an unofficial scraper.
  • A workflow that will log request_id / requestId, token or credit usage, and the citations it showed a user.

Stay with a chat search product when a person just needs to ask a question in a browser. Do not add Exa or Tavily as a second chat box “so the stack has a search API.” The API earns its keep only if you will handle the request and the citation fields yourself.

The shared contract, then the fields that differ

Both official Search endpoints are HTTP APIs: you send a query, you get back a list of results that include a title, a URL, and some form of text. The differences that matter in code are the field names, the optional answer object, and how cost is reported.

Exa’s documented base URL is https://api.exa.ai. The Search reference describes current search types auto (default), lite, deep-lite, and deep. Older type names instant, fast, and deep-reasoning are documented as legacy. A default search returns 10 results; additional results above 10 are billed separately on the official pricing page. The response includes requestId, a results array, costDollars, searchTime, warnings, and notices. Official guidance on those last two fields is specific: log warnings and do not send them to a model; do pass notices through to a model. Each result can include title, url, publishedDate, author, id, and optional text, highlights, or summary depending on the request. The /answer endpoint is a different contract: it returns an answer plus citations. A /contents call is the official way to fetch page content for results you already have.

Tavily’s documented base URL is https://api.tavily.com/. A Search request includes query, optional search_depth, and max_results (official default 10, maximum 20). You can set include_answer and include_raw_content. The response includes a results array of title, url, content, score, and optional raw_content and published_date, plus a top-level request_id and usage.credits. If you asked for an answer, a top-level answer is returned. Official extract, map, and crawl endpoints sit next to search: extract pulls content from URLs, map walks a site’s pages, and crawl is documented as map plus extract.

Example request and response shapes

The payloads below are examples for illustration, copied in spirit from official field lists. They are not recorded responses from a live call.

Example Exa Search request:

POST https://api.exa.ai/search
Content-Type: application/json
x-api-key: YOUR_EXA_API_KEY

Official Exa docs also accept Authorization: Bearer YOUR_EXA_API_KEY as an alternative to the x-api-key header shown above.

{
  "query": "example: official documentation for citation-aware search APIs",
  "type": "auto",
  "numResults": 10
}

Example Exa Search response (trimmed, not a live payload):

{
  "requestId": "example-request-id",
  "results": [
    {
      "id": "example-id",
      "title": "Example documentation title",
      "url": "https://example.com/docs/search",
      "publishedDate": "2023-11-07T05:31:56Z",
      "author": "Example Author",
      "text": "Example snippet returned when text is requested."
    }
  ],
  "costDollars": { "total": 0.0 },
  "searchTime": 123,
  "warnings": [],
  "notices": []
}

The publishedDate and searchTime values follow the official Search docs example shape (publishedDate as a date-time string; searchTime as a number). They are not timestamps from a live call. Official docs describe costDollars.total as the estimated total dollar cost for the completed request, and state that this response value is not an invoice record. Optional costDollars subfields such as search, summary, and contents exist on the official schema when those costs apply.

If you used /answer instead, the citation list you would show a user is the official citations array, not a URL you guessed from the prose. If you already have result IDs and need page text, /contents is the documented next call.

Example Tavily Search request:

POST https://api.tavily.com/search
Content-Type: application/json
Authorization: Bearer YOUR_TAVILY_API_KEY
{
  "query": "example: official documentation for citation-aware search APIs",
  "search_depth": "basic",
  "max_results": 10,
  "include_answer": true,
  "include_usage": true
}

Example Tavily Search response (trimmed, not a live payload):

{
  "query": "example: official documentation for citation-aware search APIs",
  "answer": "Example short answer, only present when include_answer is true.",
  "results": [
    {
      "title": "Example documentation title",
      "url": "https://example.com/docs/search",
      "content": "Example result content.",
      "score": 0.0
    }
  ],
  "request_id": "example-request-id",
  "usage": { "credits": 1 }
}

Official Search docs also note that include_usage defaults to false, so the example request sets it to true in order to show usage; published_date is only returned when include_published_date is true or when topic is news, and is omitted from the example for that reason. The documented REST authentication scheme is a Bearer token (Authorization: Bearer YOUR_TAVILY_API_KEY). Official SDK samples use placeholder keys such as tvly-YOUR_API_KEY.

Citation-wise, each Tavily result’s url is the source you can show next to a snippet. The optional answer is a model-written string; it is not a substitute for keeping the results URLs. Official Python and JavaScript SDKs exist for both products; use their current docs and never commit a real key.

Which official endpoint for which next step

Next step in your appExa (official)Tavily (official)
Get a ranked list of URLs and snippetsPOST /search, types auto, lite, deep-lite, or deepPOST /search, with search_depth and max_results (default 10, max 20)
Return a short answer plus sources/answer returns answer and citationsSet include_answer on Search; keep results[].url as the source list
Fetch page text for URLs you already have/contents (priced per page per content type on the official pricing page)Extract endpoint; failed URLs are not charged, per official credits docs
Walk or ingest a siteFollow current Exa docs for site or crawl-style features rather than inventing a path hereMap (pages) and Crawl (documented as map + extract)
Handle cost and failures in productionOfficial billing on 1 December 2026: Starter (free) is 10 QPS; Developer (pay as you go) is 25 QPS, and can rise to 50 QPS for 90 days after the team adds $1,000 in credits within any 30-day window; Growth is 50 QPS. HTTP 402 when credits are exhausted; HTTP 429 on rate limit. Log warnings; pass notices to the modelInspect usage.credits. Credit cost depends on search depth and on extract/map tiers

Official credits and list prices, rechecked on 1 December 2026

Exa now documents four plans. Starter (free) includes $10 of credits every month for the first team, reset on the first of the month with no rollover, plus a one-time $10 onboarding bonus, at 10 QPS. Developer (pay as you go) is prepaid credits with no subscription or minimum spend, at 25 QPS, and up to 50 QPS for 90 days if the team adds $1,000 in credits within any 30-day window (the threshold counts credits purchased, not spent; requalifying resets the 90 days). Growth is billed annually and paid upfront as prepaid credits, at 50 QPS, and official pages list Zero Data Retention as a Growth feature. Enterprise is custom volume pricing and optional postpaid invoicing, and officially includes everything in Growth. Do not treat “pay-as-you-go with no subscription” as the complete plan map; that wording is official for Developer only. A default retention or training period for Starter or ordinary Developer was not extracted as a complete first-hand policy in this pass, so no such figure is invented here.

Official pricing examples, still current on 1 December 2026, include /search at $4 per 1,000 requests for lite or legacy instant, and $7 per 1,000 for auto or legacy fast; additional results $1 per 1,000 above the default 10; /answer $5 per 1,000; /contents $1 per 1,000 pages per content type. Re-read the live pricing table before you budget; this article does not invent ranks or other rows that were not taken from that page.

Tavily is also credit-based. Official docs describe a Researcher plan at 1,000 credits per month with no card (the free tier on the credits table), a Project plan at $30 for 4,000 credits, and pay-as-you-go at $0.008 per credit. The same table also lists higher monthly plans (Bootstrap, Startup, Growth); confirm the current grid if you are buying beyond Researcher. The official Search API reference, rechecked on 1 December 2026, still costs 1 credit for basic, fast, or ultra-fast, and 2 credits for advanced. The credits overview page on the same day only spells out basic and advanced; this article cites the Search API cost section for the complete official search-depth list. Extract is 1 or 2 credits per 5 successful URLs; map is 1 or 2 credits per 10 pages.

Data-use claims are kept to pages actually opened. Tavily’s official Privacy and Security help article, opened on 10 November 2026, states that Tavily is SOC 2 certified and describes GDPR and CCPA compliance at a high level. The official help article “Understanding the 'Allow Use of Query Data' Setting,” also opened first-hand on 10 November 2026, says the setting can be changed in account settings: when it is ON, Tavily may use query data to enhance services, improve performance, and provide better results; when it is OFF, query data will not be stored or used for improvements. Official Exa billing and pricing pages, rechecked on 1 December 2026, list Zero Data Retention as a feature of the Growth plan (and of Enterprise, which includes everything in Growth), not merely a vague dashboard-upgrade or Enterprise-only option.

What this article does not claim

There is no latency, recall, or “better citations” benchmark, because no live queries were run. Example JSON is labeled as example data. Official SDKs should be copied from current docs, not from memory. And a search API is not a license to fetch pages the vendor’s endpoints will not return.