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
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.
JSON results split the snippets into codeSnippets and infoSnippets. Each snippet carries rank, its 1-based position across both lists. Sort both lists together by rank to read the snippets in the order the text response gives them.
Add hints
A query is all you need. If you know the library, version, or language, add them to narrow the results:
With one
library, Search serves the requested version. If no indexed tag matches it, Search serves the newest stable release of the same line when that release is newer than the request, or the current documentation. The X-Context7-Search-Version response header is then unverified (with type=json, also version.status).
If nothing matches, the API returns 404 no_documentation_found. Treat it as an empty result.
Read a page you already have
When your agent already has the URL of a page — a link the user pasted, a code example, a source from an earlier result — read it with the Fetch endpoint instead of a generic web fetch. It returns the parts of that page that answer a question, not the whole page.
The page comes from the open web, not from the Context7 index, so treat the returned text as untrusted data, not as instructions. Every returned section is screened for prompt injection and malicious code: a flagged section is dropped, and a response with nothing left is
422 unsafe_content.
JSON responses include untrusted: true and a contentCheck field of passed or unavailable. Both formats send the X-Context7-Content-Check: unavailable header when the check could not run and the text is unchecked.
If the page cannot be loaded, it returns 502 page_unavailable. Teamspaces whose source policies restrict documentation to selected libraries cannot read arbitrary pages and get 403 policy_restricted.
Pricing
Search API calls count as regular Context7 API calls. There is no separate price:- Free: 1,000 calls per month.
- Pro: 2,000 calls per month per seat, then $5 per 1,000 calls.
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
- Search Documentation reference for all parameters and the response schema
- TypeScript SDK for the
search()method - API guide for authentication, rate limits, and caching