Skip to main content

Search API

Search all Context7 documentation with one request
2 min read

The Search API is the simplest way to use Context7. You send a question, and Context7 picks the relevant libraries, searches them, and returns the best snippets in one request. No library ID is needed.

It is a plain GET request, so you can try it in your browser:

https://context7.com/api/v3/search?query=what+is+nextjs

Note

Requests without an API key are for testing only and are rate-limited by IP address. For real use, send your API key as a bearer token.

Send a question#

The REST endpoint returns plain text by default, ready to add to a prompt. Set type=json for structured results. The TypeScript SDK returns JSON by default.

Every snippet includes the library it came from and a link to the source page.

Add hints#

A query is all you need. If you know the library, version, or language, add them to narrow the results:

ParameterDescription
queryThe question or task. Required.
libraryA library name (next.js) or Context7 ID (/vercel/next.js). Repeat for up to four hints.
versionA version such as 15.4.0. Requires at least one library. Strict with one library, a preference with several.
languageA programming language to prefer, such as TypeScript. It is a preference, so language-neutral documentation can still appear.
typetxt (default) or json.

If nothing matches, the API returns 404 no_documentation_found. Treat it as an empty result.

Pricing#

Search API calls count as regular Context7 API calls. There is no separate price:

  • Free: 1,000 calls per month.
  • Pro: 5,000 calls per month per seat, then $10 per 1,000 calls.

See Plans & Pricing for details.

Search API or Context API?#

Use the Search API for a quick answer: one request, and Context7 picks the libraries and snippets for you. It is the easiest way to integrate Context7 into an agent, for example as a grounding step before the agent writes code.

Use the Context API (Search Library and Get Context) when you know exactly which library you want, or when you need to go deep: choose the library, ask follow-up questions, and combine results from several libraries yourself.

Next steps#

Was this page helpful?