Skip to main content
get/v2/context
Request example
Response
get/v2/context

Authorization

Authorizationstringheaderrequired#
Get your API key at context7.com/dashboard. Treat your API key like a password and store it securely. Every key can read the management API (/v2/teamspaces/*), except personal data: member and invitation emails, library requesters, visitor questions, Docs7 reader searches, conversations, feedback and feature requests, and the GitHub account behind a build. To read those or make changes there, the key must be created with Write access ticked; other keys get 403 write_access_required. A teamspace can limit API keys to owners and admins, or turn them off for OAuth only; a key that its teamspace's policy refuses gets 403 api_key_admins_only or api_keys_disabled.

Query parameters

libraryIdstringrequired#
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: ^/[^/]+/[^/]+([/@][^/]+)?$

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

Length: 1–500

typeenum<string>#
Response format type

Default: "txt"

Options:jsontxt
fastenum<string>#
When true, skip LLM reranking and return top vector-search results directly. Trades relevance quality for lower latency.

Default: "false"

Options:truefalse
languagestring#
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.
versionstring#
Optional version of the library the caller's project uses, such as 15.4.3. It wins over a version in libraryId. A value copied from a package file (^15.4.3, ~1.2, 15.x) keeps its first version. latest (any case) is the same as no version; any other value with no version (any) is a 400 validation_error with the message Invalid version, as on /v3/search. A version with indexed documentation is served as is. Otherwise a patch newer than every indexed version of its own minor gets that minor's newest version (v16.2.9 for 16.2.10); else the smallest indexed version above it in its major serves it (versions are tagged at the newest release of a group of releases whose docs barely differ, so that version covers the releases below it); for an old major newer than all its indexed versions, that major's newest version; else the current documentation. The response then names the version served (a Version note in text, the version field in JSON), except on a library whose versions Context7 maintains (one version per minor line), where a version of the requested minor counts as the requested version and gets no note.

Pattern: ^([Ll][Aa][Tt][Ee][Ss][Tt]|(.*[^A-Za-z0-9._])?[Vv]?[0-9].*)$

Responses

Documentation context
libraryIdstring#
ID of the library that served the response, with the requested version tag. It differs from the requested ID when the library has moved; a served version that differs from the requested one is reported in version.

Example:"/vercel/next.js"

codeSnippetsobject[]required#
Relevant code snippets
infoSnippetsobject[]required#
Relevant documentation snippets
rulesobject#
Optional library-specific rules and guidelines
versionobject#
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.
Example: