Get documentation context
Changed onRetrieve 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.
Request
- Base URLhttps://context7.com/api
- URLhttps://context7.com/api/v2/context
- Auth
- none
- or HTTP bearer
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.
User's original question or task - used for intelligent relevance ranking
Response format type
When true, skip LLM reranking and return top vector-search results directly. Trades relevance quality for lower latency.
Optional 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.
Response
Documentation context
Example response
{
"codeSnippets": [
{
"rank": 1
}
],
"infoSnippets": [
{
"rank": 1
}
],
"version": {
"libraryId": "/vercel/next.js/v15.1.11",
"requested": "v15.0.0",
"served": "v15.1.11",
"status": "unverified"
}
}Changes
- info
added the optional property
to the response with the status
- info
- breaking
the
/response's property type changed fromobjectto no type for status - breaking
the
/response's property type changed fromobjectto no type for status - breaking
removed the required property
//from the response with the status - breaking
removed the required property
//from the response with the status - breaking
removed the required property
//from the response with the status - breaking
removed the required property
//from the response with the status - breaking
removed the required property
//from the response with the status - breaking
removed the required property
//from the response with the status - breaking
removed the required property
//from the response with the status - breaking
removed the required property
//from the response with the status - breaking
removed the required property
//from the response with the status - warning
removed the optional property
//from the response with the status - warning
removed the optional property
//from the response with the status - warning
removed the optional property
//from the response with the status - warning
removed the optional property
//from the response with the status - info
added
subschema #2to the/response propertyallOflist for the response status - info
added
subschema #2to the/response propertyallOflist for the response status
- breaking