Search API

A search API is an interface that lets software send a query to a search index and receive ranked results as structured data, usually JSON. The index behind the API determines what can be found, and that index might cover the public Web, a single website, an organization’s internal documents, or one content type such as news, images, or products. AI agents and LLM applications call search APIs to look up information that falls outside of their model’s corpus of training data. This often means real-time information like news, available only on the Web. The same kind of interface also powers search boxes on a website, enterprise search tools, and brand, news, and price monitoring tools that run saved queries on a schedule.

In short: a search API turns a search index into something software can query (as opposed to something built for a human to query). The application can send a query with parameters, and get back ranked results it can parse, filter, or pass to a model to create an answer.

How a search API works

Every search API sits on top of an index, and the process looks much the same whatever that index contains:

  1. Build the index: The provider collects and indexes content ahead of time. A web search API crawls the public Web, a site search API ingests the pages of one site, and an enterprise search API connects to internal sources such as wikis, support tickets, and shared drives.
  2. Authenticate: The application calls an endpoint with an API key, which identifies the account and meters usage against a plan and its rate limits.
  3. Query with parameters: The request carries the query plus options such as result count, language, country, safe search, and freshness.
  4. Retrieve and rank: The search system finds matching documents in the index and orders them by relevance, using keyword matching, semantic search, or a combination of the two.
  5. Return structured results: Results come back as JSON, typically with a title, a URL or document ID, a text excerpt, and metadata (such as dates), all of which are then ready for the application to display or pass to a large language model (LLM).

Because the index is built before any request arrives, a search API looks up content the index has already collected and processed. An agent can therefore call a search API in the middle of a task without waiting for pages to be fetched at query time.

Types of search APIs by what they index

The scope of the index defines the type of search API, and each type answers a different kind of question:

  • Web search APIs query an index of the public Web with questions nobody can predict in advance, such as when an agent is tasked with researching a topic or checking a recent event.
  • Site search APIs query the content of one website or app, such as a documentation site or a store’s product catalog.
  • Enterprise search APIs query an organization’s internal content and apply access controls, so each user only sees the documents they’re permitted to open.
  • Vertical search APIs query one content type, such as news, images, videos, places, or products, and return fields specific to that type: a publish date for an article, dimensions for an image, or geographical coordinates for a place.

Many AI applications use more than one type of search API. An internal assistant might query an enterprise search API for a company’s travel policy plus a web search API for the visa rule that policy refers to, then pass both result sets to the same model.

What a search API returns to your application

Search APIs differ most in how much processing they do before results arrive, and that difference sets how much work is left for the application, especially when the results are headed for a model’s context window:

What the app or agent requests What the application still has to do Typical use Brave Search API option
Page content already extracted, cleaned, and trimmed to a token budget Nothing; data can be passed to the model as is Grounding an LLM or agent LLM Context
Ranked links with one short excerpt each Fetch and clean the full pages when the excerpt isn’t enough Results pages, choosing which sources to read Web Search
Ranked links with several excerpts per page Fetch full pages only when a task needs more depth than the excerpts give Giving a model short passages it can quote Web Search with extra_snippets
A written answer with citations Check the citations when accuracy is critical Answering users in sentences Answers

Fetching a page directly returns raw HTML, with navigation, footers, and scripts mixed in with the content, so an application that starts from plain ranked links (Web Search) usually needs an extraction step before a model can use the text. The Brave Search API covers every row in the table, and the extra_snippets parameter on Web Search adds up to five alternative excerpts per result.

Why result counts and token budgets measure different things

A search API can cap its output by result count, tokens, or both. These limits aren’t interchangeable, because results vary in length and a fixed number of results doesn’t mean a fixed amount of text. Sizing a prompt by result count alone can overfill a model’s context window or leave it with less text than it needs. Here is how each limit works:

  • A result count caps how many items come back, with no fixed length for each item. In the Brave Search API, Web Search returns up to 20 results per request through count, and extra_snippets adds up to five excerpts per result, so a single call can return at most 120 pieces of text within web.results. The Web Search API reference publishes no character length for description or extra_snippets, so users can measure their length on their own queries before sizing a prompt.
  • A token budget caps the amount of text itself. Brave’s LLM Context endpoint accepts maximum_number_of_tokens and maximum_number_of_tokens_per_url, which makes its output size predictable for a model’s context window. The tokenization entry explains how text maps to tokens.

Result-count limits also vary by endpoint and by provider. For example, Brave’s Web Search endpoint caps a request at 20 results and News Search at 50. Search API users should check their provider’s reference docs before sizing requests or planning pagination.

Search API vs. SERP API vs. scraper

There are three basic kinds of API that enable web search for an app or agent, and all three return search-like data to code. But these options get their data from different places, which changes how stable the data feed is and what terms apply:

Question Search API SERP API Scraper
Where do results come from? The provider’s own index, or one it licenses Another engine’s results page, captured on request Whatever pages the scraper’s code visits
What does the application receive? Ranked results in a documented JSON format One engine’s rankings, parsed from HTML into JSON The contents of each visited page
How stable is it? Stable, because the provider controls and versions the response format instead of depending on a web page’s layout Can break whenever the source engine changes its results page Can break whenever the target site changes its layout
What terms apply? Whatever terms appear in the contract with the search API provider Depends on extracting another engine’s pages, which many engines restrict in their terms of service Varies by site and jurisdiction, and is often restricted by terms of service
What is it best for? Finding pages on a topic, grounding a model Tracking rankings on one specific engine Reading a page the application has already chosen

Brave runs its own independent web index, so the Brave Search API serves every result from Brave’s own index, with no fallback to Google or Bing. SERP APIs and scrapers also carry terms-of-service and legal risk.

Where search APIs are used

  • AI agents and tool calling: An agent calls a search API as a tool when it needs facts beyond its training data, often several times per task as it refines the question. See tool calling and agentic search to learn more.
  • RAG and web grounding: A search API supplies the retrieval step that retrieval-augmented generation (RAG) and web grounding depend on, so a model can answer based on a review of current sources and cite them.
  • Site and in-app search: Products offer search over their own content without operating a search engine themselves.
  • Enterprise search: Internal assistants query company documents through a search API that respects each user’s permissions. An internal assistant can also add web results to that internal data, for example, by answering from a wiki of sales decks and adding current data on a competitor’s pricing from the Web.

The index behind a search API sets the ceiling on what an application can find, so choosing a provider is as much about the coverage, freshness, and independence of its index as about the interface on top.

The Brave Search API is a web search API backed by Brave’s own independent index, with endpoints for web, news, images, videos, and places, plus LLM Context for model-ready content and Answers for cited answers. Goggles can allow a developer to boost, downrank, or discard sources at query time, and the freshness parameter limits results to the past day, week, month, or year, or to a custom date range. Pricing is per request, and the API includes up to $20 in free calls every month, with current rates on the pricing page. Getting an API key is as easy as creating a Brave Search API account.

Web search API, programmable search engine, search engine results page (SERP), scraper, web grounding, retrieval-augmented generation (RAG), large language model (LLM), context window, tokenization, semantic search API, independent web index, knowledge cutoff, rate limiting, latency.

Brave logo

Almost there…

Please continue the installation of Brave in the .

Please continue the installation of Brave in the .

You’re just 60 seconds away from the best privacy online

  1. Download Brave
  2. Run the installer
  3. Import settings
  1. step 1
    Download Brave

    Open the installer from Chrome's downloads (it should be in the upper right corner of this window).

  2. step 2
    Run the installer

    If you're prompted to, click “Yes” in the User Access Control dialog.

  3. step 3
    Import settings

    Wait for the installation to finish, then import your browser settings from Chrome.

If your download didn’t start automatically, click .

Need help?