Skip to main content
GET
Search documentation in one request

Authorizations

Authorization
string
header
required

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

query
string
required

The question or task to search documentation for. Long questions and pasted error output are accepted.

Required string length: 1 - 2000
type
enum<string>
default:txt

Response format type

Available options:
json,
txt
library
string[]

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. An exact ID that is not indexed, or has no documentation to serve, is searched by its product name instead. A version-like tag (/vercel/next.js@15) is resolved like the version parameter for that library, including when the ID is searched by its product name.

Maximum array length: 4
Required string length: 1 - 120
version
string

Optional version preference. latest (any case) is the same as no version. A value copied from a package file (^15.4.3, ~1.2, 15.x) keeps its first version; a value with no version (any) is a 400 Invalid version. Without a library value, the version applies when the question names one product; when it names several, the version is ignored. With one library, verified matching documentation is preferred; if unavailable, the smallest indexed stable release above the request in its major (v2.3.1 for 2.0.0; all of 0.x is one major), for an old major newer than all its indexed releases that major's newest one, or else current documentation is returned, and the response says so (X-Context7-Search-Status: partial with reason versionUnverified, X-Context7-Search-Version, and the version field of JSON responses). A prerelease tag serves only a request for that prerelease. With multiple libraries, the version is a preference and each returned library reports what it served. A version-like tag on a library value (/vercel/next.js@15) is the same request scoped to that library. 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.

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

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

Required string length: 1 - 40
context
enum<string>

Optional. broad appends more sections of the best-matching documentation pages, up to about 3,500 extra tokens, after the ranked results. How-to, migration, troubleshooting, and overview questions get these sections without it; use it when a question needs several facts but reads as a single-fact question.

Available options:
broad

Response

Bounded documentation evidence from the selected libraries

The response is of type string.