Skip to main content

Search Context7 documentation

Search Context7 with a natural language query. Context7 finds the most relevant libraries, searches their documentation, and returns the best matching code and documentation snippets. Optionally provide libraries, a version, or a programming language to narrow the results.
1 min read
get/v3/search
Request example
Response
get/v3/search

Query parameters

querystringrequired#
User's original question or task - used for intelligent relevance ranking

Length: 1–500

typeenum<string>#
Response format type

Default: "txt"

Options:jsontxt
librarystring[]#
Optional library hints. Repeat for up to four values; each may be a fuzzy product name such as next.js or an exact Context7 ID such as /vercel/next.js.

Items: max 4

versionstring#
Optional version constraint. Requires at least one library value. It is strict when one library is provided and contextual when multiple libraries are provided.

Pattern: ^v?[0-9]+([._][0-9]+){0,2}([-+][a-zA-Z0-9.-]+)?$

languagestring#
Optional programming-language preference used for library selection, retrieval, and reranking. This is a soft preference and does not exclude language-neutral documentation.

Length: 1–40

Responses

Bounded documentation evidence from the selected libraries
codeSnippetsobject[]required#
Relevant code snippets
Show child attributes
codeTitlestringrequired#
Title of the code snippet
codeDescriptionstringrequired#
Description of what the code does
codeLanguagestringrequired#
Primary programming language
codeTokensintegerrequired#
Token count for the snippet
codeIdstringrequired#
URL to source location
pageTitlestringrequired#
Title of the documentation page
codeListobject[]required#
Code examples in different languages
Show child attributes
languagestringrequired#
Programming language
codestringrequired#
The actual code content
isDynamicboolean#
Whether this snippet was recovered from the dynamic source-code index instead of the primary docs index
sourceFilestring#
Repo-relative source file path for dynamic snippets
infoSnippetsobject[]required#
Relevant documentation snippets
Show child attributes
pageIdstring#
URL to source page
breadcrumbstring#
Navigation breadcrumb path
contentstringrequired#
The documentation content
contentTokensintegerrequired#
Token count for the content
rulesobject#
Optional library-specific rules and guidelines
Show child attributes
globalstring[]#
Global team rules
libraryOwnstring[]#
Rules defined by the library owner
libraryTeamstring[]#
Library-specific rules from the team
librariesobject[]#
Rules scoped to a specific returned library
Show child attributes
libraryIdstringrequired#
libraryOwnstring[]required#
libraryTeamstring[]required#

Was this page helpful?