Web Search

POST /v1/web-search

Search the web and get structured results with titles, URLs, and metadata. General search is served by Exa or Tavily. Set type to academic to search peer-reviewed papers instead, or pin X-Quantized-Provider to choose a provider yourself.

Headers

Header Required Description
Authorization Yes Bearer <api-key-or-jwt>
Content-Type Yes application/json
X-Quantized-Provider No Pin a provider by slug (exa, tavily or consensus), or one specific connection as <provider>/<connection>. The pin narrows the providers your license allows and never widens them. A malformed value or a disallowed provider returns 400.
X-Quantized-Metadata No A flat JSON object of scalar values, recorded with the request for your own attribution. Invalid JSON or nested values return 400. See Authentication.

Request body

Field Type Required Default Description
query string Yes — The search query
num_results integer No 5 Number of results to return (1–100)
type string No general general or academic
include_text boolean No false Return the page text on each result
max_characters integer No 4000 Cap on text length per result, in Unicode characters (100–100000)

type says what kind of source you want, so you don’t have to know which provider
serves it. academic searches Consensus (see Providers),
which indexes peer-reviewed papers.

type X-Quantized-Provider Searches
omitted or general none The general web (Exa or Tavily)
academic none Peer-reviewed papers (Consensus)
academic exa The general web — an explicit header always wins
omitted or general consensus Peer-reviewed papers — the header wins here too

type only picks a provider when you have not. It never overrides a header you sent,
and it never widens what your license is allowed to reach: if your license type is
pinned to a set of providers that excludes Consensus, type: "academic" returns a
400 rather than falling back to a general provider.

On a general search without X-Quantized-Provider, the router picks among the search
providers your license can reach, preferring your institution’s own provider keys, then
the providers marked as default for your institution, and picks randomly among ties.
Pin X-Quantized-Provider when you need a repeatable provider.

Any value other than general or academic is rejected with a 400 invalid_request
before a provider is chosen, so no credits are spent.

Getting page content

Set include_text: true when you need something an agent can actually read. Without
it you get metadata only, which is enough to rank or cite a result but not to answer a
question from it.

How much text you get back depends on the provider, because each behaves differently:

Provider Default With include_text: true
Exa No text. Exa returns none unless asked. Full page text, capped
Tavily A relevance snippet, roughly 500–1500 characters Full page text, capped. Falls back to the snippet when Tavily has no page text
Consensus (academic) The paper’s abstract The abstract. Consensus has no full-text option

Either way the text is truncated to max_characters. The default of 4000 keeps a
five-result search near 20KB; raise it if you are feeding a model with a large context
window, but note a single page can exceed 140,000 characters uncapped.

Requesting text does not cost extra. If you need the complete page rather than a
capped extract, use /v1/fetch with the URLs you got back.

Examples

cURL
Python
curl -X POST https://api.quantized.us/v1/web-search \
  -H "Authorization: Bearer sk-quantized-YOUR-KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "Python 3.13 new features",
    "num_results": 3
  }'
import httpx

response = httpx.post(
    "https://api.quantized.us/v1/web-search",
    headers={"Authorization": "Bearer sk-quantized-YOUR-KEY"},
    json={"query": "Python 3.13 new features", "num_results": 3},
    timeout=30,
)
data = response.json()
for result in data["results"]:
    print(f"{result['title']}: {result['url']}")
cURL
Python
curl -X POST https://api.quantized.us/v1/web-search \
  -H "Authorization: Bearer sk-quantized-YOUR-KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "does caffeine improve memory",
    "type": "academic",
    "num_results": 3
  }'
import httpx

response = httpx.post(
    "https://api.quantized.us/v1/web-search",
    headers={"Authorization": "Bearer sk-quantized-YOUR-KEY"},
    json={
        "query": "does caffeine improve memory",
        "type": "academic",
        "num_results": 3,
    },
    timeout=30,
)
for paper in response.json()["results"]:
    print(f"{paper['title']} ({paper['published_date']}) — {paper['id']}")

An academic search costs a flat 1 credit (1,000,000 micro-credits) per request, whatever
num_results is or how many papers come back.

The response shape is identical to a general search. url is the paper’s page on
consensus.app, id is its DOI when it has one, and text is the abstract:

{
  "results": [
    {
      "title": "How Does Caffeine Influence Memory?",
      "url": "https://consensus.app/papers/how-does-caffeine-influence-memory-.../",
      "id": "10.31234/osf.io/5rf6x",
      "published_date": "2021-05-13",
      "author": "Ruochong Zhang, C. Madan",
      "text": "Caffeine is a widely used nootropic drug...",
      "score": null
    }
  ],
  "usage": {
    "search_time": null,
    "credits_used": 1000000
  }
}

Response

{
  "results": [
    {
      "title": "What's New in Python 3.13",
      "url": "https://docs.python.org/3/whatsnew/3.13.html",
      "id": "https://docs.python.org/3/whatsnew/3.13.html",
      "published_date": "2025-01-15",
      "author": "Python Software Foundation",
      "text": "Python 3.13 is the latest stable release...",
      "score": 0.94
    },
    {
      "title": "Python 3.13 Release Notes",
      "url": "https://www.python.org/downloads/release/python-3130/",
      "id": "r2",
      "published_date": "2024-10-07",
      "author": null,
      "text": null,
      "score": null
    }
  ],
  "usage": {
    "search_time": 0.42,
    "credits_used": 80000
  }
}

Response fields

Field Type Description
results array List of search results
results[].title string Page title
results[].url string Page URL
results[].id string or null Result ID (provider-specific — a DOI on academic)
results[].published_date string or null Publication date. On academic this falls back to the publication year alone when the full date is unknown
results[].author string or null Author name. On academic, all authors joined with commas
results[].text string or null Page text, capped at max_characters. On academic, the paper’s abstract
results[].score float or null Provider relevance score. Always null on academic
usage.search_time float or null Search duration in seconds. Always null on academic — Consensus does not report one
usage.credits_used integer Micro-credits consumed
num_results is a ceiling, not a promise

Providers cap the result count, and an academic query may simply have fewer matches.
Read results.length rather than assuming you got num_results back.

Every field except title and url can be null, and which ones are populated depends
on the provider. Exa supplies published_date and author, and uses the URL as id;
Tavily supplies score and a snippet in text but never published_date or author
on a general search, and usually no id;
Consensus supplies the abstract in text but never score. Treat all of them as
optional rather than assuming a provider.

Errors

Status Code Condition
400 invalid_request Request body failed validation: a missing or invalid field, or an unrecognized field — for example a missing or empty query, num_results outside 1–100, max_characters outside 100–100000, or a type other than general or academic. param names the field
400 invalid_request Malformed X-Quantized-Provider header (param: "X-Quantized-Provider")
400 invalid_metadata_header Invalid X-Quantized-Metadata header
400 invalid_request The search provider rejected the request (the provider’s message is passed through)
400 no_provider_available No provider available for the request — including a pin your license doesn’t allow, or type: "academic" when your license cannot reach Consensus
401 missing_api_key, invalid_api_key, api_key_expired, license_inactive Missing, invalid, or expired API key, or an inactive license
402 budget_exhausted Your license is out of budget. metadata names the limit that blocked the request
403 policy_denied Your license’s policy does not allow this service or parameter value (param names the parameter)
403 content_policy_violation Request blocked by a guardrail
404 model_not_found The search provider reported the resource as not found
429 rate_limit_exceeded The search provider rate-limited the request. retry-after is set when the provider sent one
500 internal_error Unexpected error, or a budget configuration error
502 provider_error The provider returned a 5xx or an invalid response, or the connection dropped
503 provider_misconfigured Our credentials for the search provider are missing or were rejected, or our plan’s limit with the provider was reached
503 policy_unavailable Your license’s policy can’t be evaluated
504 upstream_timeout The provider timed out

Every error uses the standard error body. Branch on the status and code; see the Error reference for each.

A failed search is not billed.