Get documentation context
Retrieve intelligent, LLM-reranked documentation context for natural language queries. Returns the most relevant code snippets and documentation for your specific question. The text response lists them in relevance order across code and documentation; in JSON,
rank gives that order. A version in the library ID that is not indexed is not an error: a ready tag that matches the requested numbers is served (15 serves v15.1.8); otherwise the newest stable release of the requested line when it is newer than the request (v2.3.1 for 2.0.0; below 1.0, the same minor), or else the library’s current documentation. A prerelease tag serves only a request for that prerelease. The text response then starts with a version note when the served documentation is not the requested version, and the JSON response carries a version object. A version that is not indexed for a public GitHub library is queued for indexing in the background, so a later request for it can be answered. A branch or channel name that is not indexed (/owner/repo/canary), or a version with nothing ready to serve, still returns 404 version_not_found.1 min read
get/v2/context
Request example
Response
get/v2/context
Query parameters
Context7-compatible library ID — the URL path of the library on context7.com. Use
/owner/repo for GitHub repositories, or /<source>/<id> for other sources (websites, llms.txt, GitLab/Bitbucket, etc.). Optionally suffix with /<version> or @<version> to pin a specific version. See Library ID format.Length: 1–500Pattern: ^/[^/]+/[^/]+([/@][^/]+)?$
User's original question or task - used for intelligent relevance ranking
Length: 1–500
When
true, skip LLM reranking and return top vector-search results directly. Trades relevance quality for lower latency.Default: "false"
Options:
truefalseOptional programming language the caller writes in, such as
Python or TypeScript. A soft ranking preference: the SDK and code examples in that language rank first, and other documentation is still returned when nothing in that language matches. Only the first 40 characters are used.Responses
Documentation context
Present only when the library ID names a version that is not indexed. Says what was served instead, with the fields of each entry of the Search API's
version.libraries. The text response states the same in a leading version note when the status is unverified.