2025-11-06 11:48:01 +03:00
{
"openapi" : "3.0.0" ,
"info" : {
"title" : "Context7 Public API" ,
"description" : "The Context7 Public API provides programmatic access to library documentation and search functionality. Get up-to-date documentation and code examples for any library." ,
2025-11-24 13:49:58 +03:00
"version" : "2.0.0" ,
2025-11-06 11:48:01 +03:00
"contact" : {
"name" : "Context7 Support" ,
"url" : "https://context7.com" ,
"email" : "support@context7.com"
}
} ,
"servers" : [
{
"url" : "https://context7.com/api" ,
"description" : "Production server"
}
] ,
"paths" : {
2025-11-24 13:49:58 +03:00
"/v2/docs/code/{owner}/{repo}" : {
2025-11-06 11:48:01 +03:00
"get" : {
2025-11-24 13:49:58 +03:00
"summary" : "Get code snippets for a library" ,
"description" : "Retrieves paginated code examples and API snippets from a library's documentation. Supports filtering by topic and returns results in JSON or text format." ,
"operationId" : "getCodeSnippets" ,
"tags" : [ "Retrieve Documentation" ] ,
2025-11-06 11:48:01 +03:00
"parameters" : [
{
2025-11-24 13:49:58 +03:00
"$ref" : "#/components/parameters/OwnerParam"
2025-11-06 11:48:01 +03:00
} ,
{
2025-11-24 13:49:58 +03:00
"$ref" : "#/components/parameters/RepoParam"
2025-11-06 11:48:01 +03:00
} ,
{
2025-11-24 13:49:58 +03:00
"$ref" : "#/components/parameters/TopicParam"
2025-11-06 11:48:01 +03:00
} ,
{
2025-11-24 13:49:58 +03:00
"$ref" : "#/components/parameters/TypeParam"
2025-11-06 11:48:01 +03:00
} ,
{
2025-11-24 13:49:58 +03:00
"$ref" : "#/components/parameters/PageParam"
} ,
{
"$ref" : "#/components/parameters/LimitParam"
2025-11-06 11:48:01 +03:00
}
] ,
"responses" : {
"200" : {
2025-11-24 13:49:58 +03:00
"$ref" : "#/components/responses/CodeSnippetsJsonResponse"
2025-11-06 11:48:01 +03:00
} ,
2025-11-06 18:13:23 +03:00
"400" : {
"$ref" : "#/components/responses/BadRequestError"
} ,
2025-11-06 11:48:01 +03:00
"401" : {
"$ref" : "#/components/responses/UnauthorizedError"
} ,
"404" : {
"$ref" : "#/components/responses/NotFoundError"
} ,
2025-11-24 13:49:58 +03:00
"202" : {
"$ref" : "#/components/responses/AcceptedError"
} ,
"301" : {
"$ref" : "#/components/responses/RedirectError"
} ,
"403" : {
"$ref" : "#/components/responses/ForbiddenError"
} ,
"422" : {
"$ref" : "#/components/responses/UnprocessableEntityError"
} ,
2025-11-06 11:48:01 +03:00
"429" : {
"$ref" : "#/components/responses/RateLimitError"
} ,
"500" : {
"$ref" : "#/components/responses/InternalServerError"
}
2025-11-24 13:49:58 +03:00
} ,
"security" : [
{ } ,
{
"bearerAuth" : [ ]
}
]
2025-11-06 11:48:01 +03:00
}
} ,
2025-11-24 13:49:58 +03:00
"/v2/docs/code/{owner}/{repo}/{version}" : {
2025-11-06 11:48:01 +03:00
"get" : {
2025-11-24 13:49:58 +03:00
"summary" : "Get code snippets for a specific library version" ,
"description" : "Retrieves paginated code examples and API snippets from a specific version (tag or branch) of a library's documentation." ,
"operationId" : "getCodeSnippetsByVersion" ,
"tags" : [ "Retrieve Documentation" ] ,
2025-11-06 11:48:01 +03:00
"parameters" : [
{
2025-11-24 13:49:58 +03:00
"$ref" : "#/components/parameters/OwnerParam"
2025-11-06 11:48:01 +03:00
} ,
{
2025-11-24 13:49:58 +03:00
"$ref" : "#/components/parameters/RepoParam"
2025-11-06 11:48:01 +03:00
} ,
{
2025-11-24 13:49:58 +03:00
"$ref" : "#/components/parameters/VersionParam"
2025-11-06 11:48:01 +03:00
} ,
{
2025-11-24 13:49:58 +03:00
"$ref" : "#/components/parameters/TopicParam"
2025-11-06 11:48:01 +03:00
} ,
{
2025-11-24 13:49:58 +03:00
"$ref" : "#/components/parameters/TypeParam"
2025-11-06 11:48:01 +03:00
} ,
{
2025-11-24 13:49:58 +03:00
"$ref" : "#/components/parameters/PageParam"
} ,
{
"$ref" : "#/components/parameters/LimitParam"
2025-11-06 11:48:01 +03:00
}
] ,
"responses" : {
"200" : {
2025-11-24 13:49:58 +03:00
"$ref" : "#/components/responses/CodeSnippetsJsonResponse"
2025-11-06 11:48:01 +03:00
} ,
2025-11-06 18:13:23 +03:00
"400" : {
"$ref" : "#/components/responses/BadRequestError"
} ,
2025-11-06 11:48:01 +03:00
"401" : {
"$ref" : "#/components/responses/UnauthorizedError"
} ,
"404" : {
"$ref" : "#/components/responses/NotFoundError"
} ,
2025-11-24 13:49:58 +03:00
"202" : {
"$ref" : "#/components/responses/AcceptedError"
} ,
"301" : {
"$ref" : "#/components/responses/RedirectError"
} ,
"403" : {
"$ref" : "#/components/responses/ForbiddenError"
} ,
"422" : {
"$ref" : "#/components/responses/UnprocessableEntityError"
} ,
2025-11-06 11:48:01 +03:00
"429" : {
"$ref" : "#/components/responses/RateLimitError"
} ,
"500" : {
"$ref" : "#/components/responses/InternalServerError"
}
2025-11-24 13:49:58 +03:00
} ,
"security" : [
{ } ,
{
"bearerAuth" : [ ]
}
]
2025-11-06 11:48:01 +03:00
}
} ,
2025-11-24 13:49:58 +03:00
"/v2/docs/info/{owner}/{repo}" : {
2025-11-06 11:48:01 +03:00
"get" : {
2025-11-24 13:49:58 +03:00
"summary" : "Get documentation content for a library" ,
"description" : "Retrieves paginated informational documentation snippets from a library. Supports filtering by topic and returns results in JSON or text format." ,
"operationId" : "getInfoSnippets" ,
"tags" : [ "Retrieve Documentation" ] ,
2025-11-06 11:48:01 +03:00
"parameters" : [
{
2025-11-24 13:49:58 +03:00
"$ref" : "#/components/parameters/OwnerParam"
} ,
{
"$ref" : "#/components/parameters/RepoParam"
} ,
{
"$ref" : "#/components/parameters/TopicParam"
} ,
{
"$ref" : "#/components/parameters/TypeParam"
} ,
{
"$ref" : "#/components/parameters/PageParam"
} ,
{
"$ref" : "#/components/parameters/LimitParam"
2025-11-06 11:48:01 +03:00
}
] ,
"responses" : {
"200" : {
2025-11-24 13:49:58 +03:00
"$ref" : "#/components/responses/InfoSnippetsJsonResponse"
} ,
"400" : {
"$ref" : "#/components/responses/BadRequestError"
2025-11-06 11:48:01 +03:00
} ,
"401" : {
"$ref" : "#/components/responses/UnauthorizedError"
} ,
2025-11-24 13:49:58 +03:00
"404" : {
"$ref" : "#/components/responses/NotFoundError"
} ,
"202" : {
"$ref" : "#/components/responses/AcceptedError"
} ,
"301" : {
"$ref" : "#/components/responses/RedirectError"
} ,
"403" : {
"$ref" : "#/components/responses/ForbiddenError"
} ,
"422" : {
"$ref" : "#/components/responses/UnprocessableEntityError"
} ,
2025-11-06 11:48:01 +03:00
"429" : {
"$ref" : "#/components/responses/RateLimitError"
} ,
"500" : {
"$ref" : "#/components/responses/InternalServerError"
}
2025-11-24 13:49:58 +03:00
} ,
2025-11-06 18:13:23 +03:00
"security" : [
2025-11-24 13:49:58 +03:00
{ } ,
2025-11-06 18:13:23 +03:00
{
"bearerAuth" : [ ]
}
2025-11-24 13:49:58 +03:00
]
}
} ,
"/v2/docs/info/{owner}/{repo}/{version}" : {
"get" : {
"summary" : "Get documentation content for a specific library version" ,
"description" : "Retrieves paginated informational documentation snippets from a specific version (tag or branch) of a library." ,
"operationId" : "getInfoSnippetsByVersion" ,
"tags" : [ "Retrieve Documentation" ] ,
"parameters" : [
{
"$ref" : "#/components/parameters/OwnerParam"
} ,
{
"$ref" : "#/components/parameters/RepoParam"
} ,
{
"$ref" : "#/components/parameters/VersionParam"
} ,
{
"$ref" : "#/components/parameters/TopicParam"
} ,
{
"$ref" : "#/components/parameters/TypeParam"
} ,
{
"$ref" : "#/components/parameters/PageParam"
} ,
{
"$ref" : "#/components/parameters/LimitParam"
}
2025-11-06 18:13:23 +03:00
] ,
2025-11-24 13:49:58 +03:00
"responses" : {
"200" : {
"$ref" : "#/components/responses/InfoSnippetsJsonResponse"
} ,
"400" : {
"$ref" : "#/components/responses/BadRequestError"
} ,
"401" : {
"$ref" : "#/components/responses/UnauthorizedError"
} ,
"404" : {
"$ref" : "#/components/responses/NotFoundError"
} ,
"202" : {
"$ref" : "#/components/responses/AcceptedError"
} ,
"301" : {
"$ref" : "#/components/responses/RedirectError"
} ,
"403" : {
"$ref" : "#/components/responses/ForbiddenError"
} ,
"422" : {
"$ref" : "#/components/responses/UnprocessableEntityError"
} ,
"429" : {
"$ref" : "#/components/responses/RateLimitError"
} ,
"500" : {
"$ref" : "#/components/responses/InternalServerError"
2025-11-06 11:48:01 +03:00
}
} ,
2025-11-24 13:49:58 +03:00
"security" : [
{ } ,
{
"bearerAuth" : [ ]
}
]
}
} ,
"/v2/search" : {
"get" : {
"summary" : "Search for libraries" ,
"description" : "Search across available libraries. Returns finalized public libraries and accessible private repositories based on authentication." ,
"operationId" : "searchLibraries" ,
"tags" : [ "Search Libraries" ] ,
"parameters" : [
{
"name" : "query" ,
"in" : "query" ,
"description" : "Search query string. Returns empty results if not provided." ,
"required" : false ,
"schema" : {
"type" : "string" ,
"maxLength" : 500
} ,
"example" : "react hooks"
}
] ,
2025-11-06 11:48:01 +03:00
"responses" : {
"200" : {
2025-11-24 13:49:58 +03:00
"description" : "Successful search response" ,
2025-11-06 11:48:01 +03:00
"content" : {
"application/json" : {
"schema" : {
2025-11-24 13:49:58 +03:00
"type" : "object" ,
"description" : "Search results response" ,
"properties" : {
"results" : {
"type" : "array" ,
"description" : "Array of matching libraries" ,
"items" : {
"$ref" : "#/components/schemas/Library"
}
}
} ,
2025-12-15 15:13:58 +03:00
"required" : [ "results" ]
2025-11-24 13:49:58 +03:00
} ,
"examples" : {
"withResults" : {
"summary" : "Search with results" ,
"value" : {
"results" : [
{
"id" : "/vercel/next.js" ,
"title" : "Next.js" ,
"description" : "Next.js enables you to create full-stack web applications by extending the latest React features and integrating powerful Rust-based JavaScript tooling for the fastest builds." ,
"branch" : "canary" ,
"lastUpdateDate" : "2025-11-17T22:20:15.784Z" ,
"state" : "finalized" ,
"totalTokens" : 824953 ,
"totalSnippets" : 3336 ,
"stars" : 131745 ,
"trustScore" : 10 ,
"benchmarkScore" : 91.1 ,
"versions" : [
"v14.3.0-canary.87" ,
"v13.5.11" ,
"v15.1.8" ,
"v15.4.0-canary.82" ,
"v12.3.7" ,
"v11.1.3"
]
}
2025-12-15 15:13:58 +03:00
]
2025-11-24 13:49:58 +03:00
}
} ,
"emptyQuery" : {
"summary" : "Empty query returns no results" ,
"value" : {
2025-12-15 15:13:58 +03:00
"results" : [ ]
2025-11-24 13:49:58 +03:00
}
}
2025-11-06 11:48:01 +03:00
}
}
}
} ,
"401" : {
"$ref" : "#/components/responses/UnauthorizedError"
} ,
"429" : {
"$ref" : "#/components/responses/RateLimitError"
} ,
"500" : {
"$ref" : "#/components/responses/InternalServerError"
}
2025-11-24 13:49:58 +03:00
} ,
"security" : [
{ } ,
{
"bearerAuth" : [ ]
}
]
2025-11-06 11:48:01 +03:00
}
}
} ,
"components" : {
"securitySchemes" : {
"bearerAuth" : {
"type" : "http" ,
"scheme" : "bearer" ,
"description" : "Get your API key at [context7.com/dashboard](https://context7.com/dashboard). Treat your API key like a password and store it securely."
}
} ,
2025-11-24 13:49:58 +03:00
"parameters" : {
"OwnerParam" : {
"name" : "owner" ,
"in" : "path" ,
"description" : "Repository owner - GitHub username or organization name (case-insensitive)" ,
"required" : true ,
"schema" : {
"type" : "string" ,
"minLength" : 1 ,
"maxLength" : 500
} ,
"example" : "vercel"
} ,
"RepoParam" : {
"name" : "repo" ,
"in" : "path" ,
"description" : "Repository name (case-insensitive)" ,
"required" : true ,
"schema" : {
"type" : "string" ,
"minLength" : 1 ,
"maxLength" : 500
} ,
"example" : "next.js"
} ,
"VersionParam" : {
"name" : "version" ,
"in" : "path" ,
"description" : "Specific version (tag or branch) of the library" ,
"required" : true ,
"schema" : {
"type" : "string" ,
"minLength" : 1 ,
"maxLength" : 500
} ,
"example" : "v14.0.0"
} ,
"TopicParam" : {
"name" : "topic" ,
"in" : "query" ,
"description" : "Filter snippets by topic or search term" ,
"required" : false ,
"schema" : {
"type" : "string" ,
"maxLength" : 500
} ,
"example" : "authentication"
} ,
"TypeParam" : {
"name" : "type" ,
"in" : "query" ,
"description" : "Response format type" ,
"required" : false ,
"schema" : {
"type" : "string" ,
"enum" : [ "json" , "txt" ] ,
"default" : "txt"
} ,
"example" : "json"
} ,
"PageParam" : {
"name" : "page" ,
"in" : "query" ,
"description" : "Page number for pagination (1-indexed). Maximum 10 pages accessible for each topic." ,
"required" : false ,
"schema" : {
"type" : "integer" ,
"minimum" : 1 ,
"default" : 1
} ,
"example" : 1
} ,
"LimitParam" : {
"name" : "limit" ,
"in" : "query" ,
"description" : "Number of items per page" ,
"required" : false ,
"schema" : {
"type" : "integer" ,
"minimum" : 1 ,
"maximum" : 10 ,
"default" : 10
} ,
"example" : 10
}
} ,
2025-11-06 11:48:01 +03:00
"schemas" : {
2025-11-24 13:49:58 +03:00
"CodeSnippet" : {
2025-11-06 11:48:01 +03:00
"type" : "object" ,
2025-11-24 13:49:58 +03:00
"description" : "A code snippet from library documentation" ,
2025-11-06 11:48:01 +03:00
"properties" : {
2025-11-24 13:49:58 +03:00
"codeTitle" : {
2025-11-06 11:48:01 +03:00
"type" : "string" ,
2025-11-24 13:49:58 +03:00
"description" : "Title of the code snippet"
2025-11-06 11:48:01 +03:00
} ,
2025-11-24 13:49:58 +03:00
"codeDescription" : {
2025-11-06 11:48:01 +03:00
"type" : "string" ,
2025-11-24 13:49:58 +03:00
"description" : "Description of what the code does"
2025-11-06 11:48:01 +03:00
} ,
2025-11-24 13:49:58 +03:00
"codeLanguage" : {
2025-11-06 11:48:01 +03:00
"type" : "string" ,
2025-11-24 13:49:58 +03:00
"description" : "Primary programming language of the snippet"
2025-11-06 11:48:01 +03:00
} ,
2025-11-24 13:49:58 +03:00
"codeTokens" : {
2025-11-06 11:48:01 +03:00
"type" : "integer" ,
2025-11-24 13:49:58 +03:00
"description" : "Token count for the snippet"
} ,
"codeId" : {
"type" : "string" ,
"description" : "Unique identifier for the code snippet"
} ,
"pageTitle" : {
"type" : "string" ,
"description" : "Title of the documentation page containing this snippet"
2025-11-06 11:48:01 +03:00
} ,
2025-11-24 13:49:58 +03:00
"codeList" : {
2025-11-06 11:48:01 +03:00
"type" : "array" ,
2025-11-24 13:49:58 +03:00
"description" : "List of code examples in different languages" ,
2025-11-06 11:48:01 +03:00
"items" : {
2025-11-24 13:49:58 +03:00
"$ref" : "#/components/schemas/CodeExample"
2025-11-06 11:48:01 +03:00
}
2025-11-24 13:49:58 +03:00
}
} ,
2025-11-28 15:18:33 +03:00
"required" : [
"codeTitle" ,
"codeDescription" ,
"codeLanguage" ,
"codeTokens" ,
"codeId" ,
"pageTitle" ,
"codeList"
]
2025-11-24 13:49:58 +03:00
} ,
"CodeExample" : {
"type" : "object" ,
"description" : "A single code example" ,
"properties" : {
"language" : {
"type" : "string" ,
"description" : "Programming language of this code example"
2025-11-06 18:13:23 +03:00
} ,
2025-11-24 13:49:58 +03:00
"code" : {
"type" : "string" ,
"description" : "The actual code content"
2025-11-06 11:48:01 +03:00
}
2025-11-24 13:49:58 +03:00
} ,
"required" : [ "language" , "code" ]
2025-11-06 11:48:01 +03:00
} ,
2025-11-24 13:49:58 +03:00
"InfoSnippet" : {
2025-11-06 11:48:01 +03:00
"type" : "object" ,
2025-11-24 13:49:58 +03:00
"description" : "A documentation/info snippet from library" ,
2025-11-06 11:48:01 +03:00
"properties" : {
2025-11-24 13:49:58 +03:00
"pageId" : {
"type" : "string" ,
"description" : "Unique page identifier"
2025-11-06 11:48:01 +03:00
} ,
2025-11-24 13:49:58 +03:00
"breadcrumb" : {
"type" : "string" ,
"description" : "Navigation breadcrumb path"
} ,
"content" : {
"type" : "string" ,
"description" : "The documentation content"
} ,
"contentTokens" : {
"type" : "integer" ,
"description" : "Token count for the content"
2025-11-06 11:48:01 +03:00
}
} ,
2025-11-24 13:49:58 +03:00
"required" : [ "content" , "contentTokens" ]
} ,
"Pagination" : {
"type" : "object" ,
"description" : "Pagination metadata" ,
"properties" : {
"page" : {
"type" : "integer" ,
"description" : "Current page number (1-indexed)" ,
"minimum" : 1
} ,
"limit" : {
"type" : "integer" ,
"description" : "Items per page" ,
"minimum" : 1 ,
"maximum" : 10
} ,
"totalPages" : {
"type" : "integer" ,
"description" : "Total number of pages available for a topic" ,
"minimum" : 0
} ,
"hasNext" : {
"type" : "boolean" ,
"description" : "Whether a next page exists"
} ,
"hasPrev" : {
"type" : "boolean" ,
"description" : "Whether a previous page exists"
2025-11-06 11:48:01 +03:00
}
2025-11-24 13:49:58 +03:00
} ,
"required" : [ "page" , "limit" , "totalPages" , "hasNext" , "hasPrev" ]
} ,
2025-11-06 11:48:01 +03:00
"Library" : {
"type" : "object" ,
"description" : "Library metadata" ,
"properties" : {
"id" : {
"type" : "string" ,
"description" : "Library ID in format `/owner/repo`" ,
"example" : "/vercel/next.js"
} ,
"title" : {
"type" : "string" ,
"description" : "Display name of the library" ,
"example" : "Next.js"
} ,
"description" : {
"type" : "string" ,
"description" : "Short description" ,
"example" : "The React Framework"
} ,
"branch" : {
"type" : "string" ,
"description" : "Git branch being tracked" ,
"example" : "canary"
} ,
"lastUpdateDate" : {
"type" : "string" ,
"format" : "date-time" ,
"description" : "ISO 8601 timestamp of last update" ,
"example" : "2025-07-27T06:56:26.691Z"
} ,
"state" : {
"type" : "string" ,
"enum" : [ "finalized" , "initial" , "processing" , "error" , "delete" ] ,
"description" : "Processing state of the library" ,
"example" : "finalized"
} ,
"totalTokens" : {
"type" : "integer" ,
"description" : "Total tokens in documentation" ,
"example" : 607822
} ,
"totalSnippets" : {
"type" : "integer" ,
"description" : "Number of code snippets" ,
"example" : 3629
} ,
"stars" : {
"type" : "integer" ,
"description" : "GitHub stars count" ,
"example" : 131745
} ,
"trustScore" : {
"type" : "integer" ,
2025-11-13 15:14:03 +03:00
"description" : "Source reputation score (0-10, used internally to determine High/Medium/Low/Unknown reputation)" ,
2025-11-06 11:48:01 +03:00
"minimum" : 0 ,
"maximum" : 10 ,
"example" : 10
} ,
2025-11-13 15:14:03 +03:00
"benchmarkScore" : {
"type" : "number" ,
"description" : "Quality indicator score (0-100, with 100 being the highest quality)" ,
"minimum" : 0 ,
"maximum" : 100 ,
"example" : 95.5
} ,
2025-11-06 11:48:01 +03:00
"versions" : {
"type" : "array" ,
"description" : "Available version tags" ,
"items" : {
"type" : "string"
} ,
"example" : [ "v15.1.8" , "v14.3.0-canary.87" ]
}
}
} ,
2025-11-24 13:49:58 +03:00
"Error" : {
2025-11-06 11:48:01 +03:00
"type" : "object" ,
"properties" : {
2025-11-24 13:49:58 +03:00
"error" : {
2025-11-06 18:13:23 +03:00
"type" : "string" ,
2025-11-24 13:49:58 +03:00
"description" : "Error code identifier"
2025-11-06 11:48:01 +03:00
} ,
2025-11-24 13:49:58 +03:00
"message" : {
2025-11-06 11:48:01 +03:00
"type" : "string" ,
2025-11-24 13:49:58 +03:00
"description" : "Human-readable error message"
2025-11-06 11:48:01 +03:00
} ,
2025-11-24 13:49:58 +03:00
"status" : {
"type" : "integer" ,
"description" : "HTTP status code"
}
} ,
"required" : [ "error" ]
} ,
"ValidationError" : {
"allOf" : [
{
"$ref" : "#/components/schemas/Error"
2025-11-06 11:48:01 +03:00
} ,
2025-11-24 13:49:58 +03:00
{
"type" : "object" ,
"properties" : {
"maxLimit" : {
"type" : "integer" ,
"description" : "Maximum allowed limit value (only present for limit exceeded errors)"
} ,
"redirectUrl" : {
"type" : "string" ,
"description" : "New location of the library (only present for redirect errors)"
}
}
}
]
}
} ,
2025-11-28 16:43:27 +03:00
"headers" : {
"X-Context7-Page" : {
"description" : "Current page number (1-indexed). Only returned for text/plain responses (type=txt)." ,
"schema" : {
"type" : "integer" ,
"minimum" : 1
} ,
"example" : 1
} ,
"X-Context7-Limit" : {
"description" : "Number of items per page. Only returned for text/plain responses (type=txt)." ,
"schema" : {
"type" : "integer" ,
"minimum" : 1 ,
"maximum" : 10
} ,
"example" : 10
} ,
"X-Context7-Total-Pages" : {
"description" : "Total number of pages available. Only returned for text/plain responses (type=txt)." ,
"schema" : {
"type" : "integer" ,
"minimum" : 0
} ,
"example" : 10
} ,
"X-Context7-Has-Next" : {
"description" : "Whether a next page exists. Only returned for text/plain responses (type=txt)." ,
"schema" : {
"type" : "string" ,
"enum" : [ "true" , "false" ]
} ,
"example" : "true"
} ,
"X-Context7-Has-Prev" : {
"description" : "Whether a previous page exists. Only returned for text/plain responses (type=txt)." ,
"schema" : {
"type" : "string" ,
"enum" : [ "true" , "false" ]
} ,
"example" : "false"
} ,
"X-Context7-Total-Tokens" : {
"description" : "Total token count for the current page. Only returned for text/plain responses (type=txt)." ,
"schema" : {
"type" : "integer" ,
"minimum" : 0
} ,
"example" : 1500
}
} ,
2025-11-24 13:49:58 +03:00
"responses" : {
"CodeSnippetsJsonResponse" : {
"description" : "Successful response with code snippets" ,
"content" : {
"application/json" : {
"schema" : {
"type" : "object" ,
"description" : "Response containing code snippets" ,
"properties" : {
"snippets" : {
"type" : "array" ,
"description" : "Array of code snippets" ,
"items" : {
"$ref" : "#/components/schemas/CodeSnippet"
}
} ,
"totalTokens" : {
"type" : "integer" ,
"description" : "Total token count for all returned snippets"
} ,
"pagination" : {
"$ref" : "#/components/schemas/Pagination"
}
} ,
2025-12-15 15:13:58 +03:00
"required" : [ "snippets" , "totalTokens" , "pagination" ]
2025-11-06 11:48:01 +03:00
} ,
2025-11-24 13:49:58 +03:00
"example" : {
"snippets" : [
{
"codeTitle" : "Create and Run Next.js App with create-next-app (Quick Start)" ,
"codeDescription" : "Quickly set up and start a new Next.js application using `create-next-app` with various package managers. This command creates a new project directory, installs dependencies, and starts the development server. The `--yes` flag skips interactive prompts, enabling a default setup with TypeScript, Tailwind, ESLint, App Router, and Turbopack." ,
"codeLanguage" : "bash" ,
"codeTokens" : 185 ,
"codeId" : "https://github.com/vercel/next.js/blob/canary/docs/01-app/01-getting-started/01-installation.mdx#_snippet_0" ,
"pageTitle" : "Installation" ,
"codeList" : [
{
"language" : "bash" ,
"code" : "pnpm create next-app@latest my-app --yes\ncd my-app\npnpm dev"
} ,
{
"language" : "bash" ,
"code" : "npx create-next-app@latest my-app --yes\ncd my-app\nnpm run dev"
} ,
{
"language" : "bash" ,
"code" : "yarn create next-app@latest my-app --yes\ncd my-app\nyarn dev"
} ,
{
"language" : "bash" ,
"code" : "bun create next-app@latest my-app --yes\ncd my-app\nbun dev"
}
]
}
] ,
"totalTokens" : 185 ,
"pagination" : {
"page" : 1 ,
"limit" : 10 ,
"totalPages" : 10 ,
"hasNext" : true ,
"hasPrev" : false
}
}
2025-11-06 11:48:01 +03:00
} ,
2025-11-24 13:49:58 +03:00
"text/plain" : {
"schema" : {
2025-11-28 16:43:27 +03:00
"type" : "string" ,
2025-12-15 15:13:58 +03:00
"description" : "Plain text formatted documentation."
2025-11-06 11:48:01 +03:00
} ,
2025-11-24 13:49:58 +03:00
"example" : "### Create and Run Next.js App with create-next-app (Quick Start)\n\nSource: https://github.com/vercel/next.js/blob/canary/docs/01-app/01-getting-started/01-installation.mdx\n\nQuickly set up and start a new Next.js application using `create-next-app` with various package managers. This command creates a new project directory, installs dependencies, and starts the development server. The `--yes` flag skips interactive prompts, enabling a default setup with TypeScript, Tailwind, ESLint, App Router, and Turbopack.\n\n```bash\npnpm create next-app@latest my-app --yes\ncd my-app\npnpm dev\n```\n\n```bash\nnpx create-next-app@latest my-app --yes\ncd my-app\nnpm run dev\n```\n\n```bash\nyarn create next-app@latest my-app --yes\ncd my-app\nyarn dev\n```\n\n```bash\nbun create next-app@latest my-app --yes\ncd my-app\nbun dev\n```"
2025-11-06 11:48:01 +03:00
}
2025-11-28 16:43:27 +03:00
} ,
"headers" : {
"X-Context7-Page" : {
"$ref" : "#/components/headers/X-Context7-Page"
} ,
"X-Context7-Limit" : {
"$ref" : "#/components/headers/X-Context7-Limit"
} ,
"X-Context7-Total-Pages" : {
"$ref" : "#/components/headers/X-Context7-Total-Pages"
} ,
"X-Context7-Has-Next" : {
"$ref" : "#/components/headers/X-Context7-Has-Next"
} ,
"X-Context7-Has-Prev" : {
"$ref" : "#/components/headers/X-Context7-Has-Prev"
} ,
"X-Context7-Total-Tokens" : {
"$ref" : "#/components/headers/X-Context7-Total-Tokens"
}
2025-11-06 11:48:01 +03:00
}
} ,
2025-11-24 13:49:58 +03:00
"InfoSnippetsJsonResponse" : {
"description" : "Successful response with info/documentation snippets" ,
"content" : {
"application/json" : {
"schema" : {
"type" : "object" ,
"description" : "Response containing info/documentation snippets" ,
"properties" : {
"snippets" : {
"type" : "array" ,
"description" : "Array of info snippets" ,
"items" : {
"$ref" : "#/components/schemas/InfoSnippet"
}
} ,
"totalTokens" : {
"type" : "integer" ,
"description" : "Total token count for all returned snippets"
} ,
"pagination" : {
"$ref" : "#/components/schemas/Pagination"
}
} ,
2025-12-15 15:13:58 +03:00
"required" : [ "snippets" , "totalTokens" , "pagination" ]
2025-11-06 11:48:01 +03:00
} ,
2025-11-24 13:49:58 +03:00
"example" : {
"snippets" : [
{
"pageId" : "https://github.com/vercel/next.js/blob/canary/docs/04-community/01-contribution-guide.mdx" ,
"breadcrumb" : "How to Contribute > Writing MDX" ,
"content" : "The docs are written in [MDX](https://mdxjs.com/), a markdown format that supports JSX syntax. This allows us to embed React components in the docs. See the [GitHub Markdown Guide](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) for a quick overview of markdown syntax." ,
"contentTokens" : 84
}
] ,
"totalTokens" : 84 ,
"pagination" : {
"page" : 1 ,
"limit" : 10 ,
"totalPages" : 10 ,
"hasNext" : true ,
"hasPrev" : false
}
}
2025-11-06 11:48:01 +03:00
} ,
2025-11-24 13:49:58 +03:00
"text/plain" : {
"schema" : {
2025-11-28 16:43:27 +03:00
"type" : "string" ,
2025-12-15 15:13:58 +03:00
"description" : "Plain text formatted documentation."
2025-11-06 11:48:01 +03:00
} ,
2025-11-24 13:49:58 +03:00
"example" : "### How to Contribute > Writing MDX\n\nSource: https://github.com/vercel/next.js/blob/canary/docs/04-community/01-contribution-guide.mdx\n\nThe docs are written in [MDX](https://mdxjs.com/), a markdown format that supports JSX syntax. This allows us to embed React components in the docs. See the [GitHub Markdown Guide](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) for a quick overview of markdown syntax."
}
2025-11-28 16:43:27 +03:00
} ,
"headers" : {
"X-Context7-Page" : {
"$ref" : "#/components/headers/X-Context7-Page"
} ,
"X-Context7-Limit" : {
"$ref" : "#/components/headers/X-Context7-Limit"
} ,
"X-Context7-Total-Pages" : {
"$ref" : "#/components/headers/X-Context7-Total-Pages"
} ,
"X-Context7-Has-Next" : {
"$ref" : "#/components/headers/X-Context7-Has-Next"
} ,
"X-Context7-Has-Prev" : {
"$ref" : "#/components/headers/X-Context7-Has-Prev"
} ,
"X-Context7-Total-Tokens" : {
"$ref" : "#/components/headers/X-Context7-Total-Tokens"
}
2025-11-24 13:49:58 +03:00
}
} ,
"BadRequestError" : {
"description" : "Bad Request - Invalid input parameters" ,
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/ValidationError"
2025-11-06 11:48:01 +03:00
} ,
2025-11-24 13:49:58 +03:00
"examples" : {
"invalidInput" : {
"summary" : "Multiple source parameters provided" ,
"value" : {
"error" : "invalid_input" ,
"message" : "Provide exactly one of: docsRepoUrl or llmstxtUrl" ,
"status" : 400
}
} ,
"invalidFormat" : {
"summary" : "Invalid library format (v2 endpoints)" ,
"value" : {
"error" : "invalid_format" ,
"message" : "Invalid library format. Expected: owner/repo[/version]"
}
} ,
"invalidLength" : {
"summary" : "Invalid parameter length" ,
"value" : {
"error" : "invalid_length" ,
"message" : "Invalid owner or repo name. Must be 1-500 characters."
}
} ,
"invalidType" : {
"summary" : "Invalid type parameter" ,
"value" : {
"error" : "invalid_type" ,
"message" : "Invalid type parameter. Supported values: json, txt"
}
} ,
"invalidPage" : {
"summary" : "Invalid page number" ,
"value" : {
"error" : "invalid_page" ,
"message" : "Invalid page number. Must be a positive integer."
}
} ,
"invalidLimit" : {
"summary" : "Limit exceeds maximum" ,
"value" : {
"error" : "invalid_limit" ,
"message" : "Items per page exceeds maximum allowed (10)" ,
"maxLimit" : 10
}
} ,
"invalidLlmstxtUrl" : {
"summary" : "Invalid llms.txt URL" ,
"value" : {
"error" : "invalid_llmstxt_url" ,
"message" : "llmstxtUrl must end with llms.txt, llms-full.txt, or llms-small.txt" ,
"status" : 400
}
2025-11-06 11:48:01 +03:00
}
}
}
2025-11-24 13:49:58 +03:00
}
} ,
"UnauthorizedError" : {
"description" : "Unauthorized - Invalid or missing API key, or access denied" ,
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/Error"
} ,
"examples" : {
"invalidApiKey" : {
"summary" : "Invalid API key" ,
"value" : {
"error" : "invalid_api_key" ,
"message" : "Invalid or expired API key" ,
"status" : 401
}
} ,
"accessDenied" : {
"summary" : "Access denied to library" ,
"value" : {
"error" : "access_denied" ,
"message" : "Access denied: Library /vercel/next.js is not included in your allowed libraries"
}
} ,
"authenticationFailed" : {
"summary" : "Authentication failed" ,
"value" : {
"error" : "authentication_failed" ,
"message" : "Failed to authenticate API key" ,
"status" : 401
}
}
}
2025-11-06 11:48:01 +03:00
}
}
} ,
2025-11-24 13:49:58 +03:00
"ForbiddenError" : {
"description" : "Forbidden - Insufficient permissions or blocked library" ,
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/Error"
} ,
"examples" : {
"insufficientPermissions" : {
"summary" : "Insufficient permissions" ,
"value" : {
"error" : "insufficient_permissions" ,
"message" : "Insufficient permissions" ,
"status" : 403
}
} ,
"libraryBlocked" : {
"summary" : "Library has been blocked" ,
"value" : {
"error" : "library_blocked" ,
"message" : "Library /owner/repo has been blocked by system."
}
}
}
2025-11-06 11:48:01 +03:00
}
}
2025-11-24 13:49:58 +03:00
} ,
"NotFoundError" : {
"description" : "Not Found - Library, project, or resource doesn't exist" ,
2025-11-06 18:13:23 +03:00
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/Error"
} ,
2025-11-24 13:49:58 +03:00
"examples" : {
"libraryNotFound" : {
"summary" : "Library not found" ,
"value" : {
"error" : "library_not_found" ,
"message" : "Library /owner/repo not found. You can add it at context7.com/add-library" ,
"status" : 404
}
} ,
"tagNotFound" : {
"summary" : "Version/tag not found" ,
"value" : {
"error" : "tag_not_found" ,
"message" : "Tag 'v1.0.0' not found for library /owner/repo"
}
}
2025-11-06 18:13:23 +03:00
}
}
}
} ,
2025-11-24 13:49:58 +03:00
"AcceptedError" : {
"description" : "Accepted - Library not yet finalized" ,
2025-11-06 11:48:01 +03:00
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/Error"
} ,
"example" : {
2025-11-24 13:49:58 +03:00
"error" : "library_not_finalized" ,
"message" : "Library /owner/repo not finalized yet."
2025-11-06 11:48:01 +03:00
}
}
}
} ,
2025-11-24 13:49:58 +03:00
"RedirectError" : {
"description" : "Moved Permanently - Library has been redirected" ,
2025-11-06 18:13:23 +03:00
"content" : {
"application/json" : {
"schema" : {
2025-11-24 13:49:58 +03:00
"$ref" : "#/components/schemas/ValidationError"
2025-11-06 18:13:23 +03:00
} ,
"example" : {
2025-11-24 13:49:58 +03:00
"error" : "library_redirected" ,
"message" : "Library /owner/repo has been redirected to this library: /new-owner/new-repo." ,
"redirectUrl" : "/new-owner/new-repo"
2025-11-06 18:13:23 +03:00
}
}
}
} ,
2025-11-24 13:49:58 +03:00
"UnprocessableEntityError" : {
"description" : "Unprocessable Entity - Library is too large or has no code" ,
2025-11-06 11:48:01 +03:00
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/Error"
} ,
2025-11-24 13:49:58 +03:00
"examples" : {
"tooLarge" : {
"summary" : "Library too large" ,
"value" : {
"error" : "library_too_large" ,
"message" : "Library /owner/repo is too large to process."
}
} ,
"noCode" : {
"summary" : "No code found" ,
"value" : {
"error" : "no_code_found" ,
"message" : "Library /owner/repo has no or too few snippets found in documentation files."
}
}
2025-11-06 11:48:01 +03:00
}
}
}
} ,
"RateLimitError" : {
"description" : "Too Many Requests - Rate limit exceeded" ,
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/Error"
} ,
"example" : {
"error" : "Too many requests" ,
2025-11-24 13:49:58 +03:00
"status" : 429
2025-11-06 11:48:01 +03:00
}
}
}
} ,
"InternalServerError" : {
"description" : "Internal Server Error" ,
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/Error"
} ,
2025-11-24 13:49:58 +03:00
"examples" : {
"generic" : {
"summary" : "Generic internal error" ,
"value" : {
"error" : "internal_server_error" ,
"message" : "An internal error occurred while processing your request." ,
"status" : 500
}
} ,
"serverConfiguration" : {
"summary" : "Server configuration error" ,
"value" : {
"error" : "server_configuration" ,
"message" : "Server configuration error" ,
"status" : 500
}
} ,
"databaseError" : {
"summary" : "Database operation failed" ,
"value" : {
"error" : "database_error" ,
"message" : "Failed to save private repository" ,
"status" : 500
}
} ,
"processingFailed" : {
"summary" : "Library processing failed" ,
"value" : {
"error" : "processing_failed" ,
"message" : "Failed to process library" ,
"status" : 500
}
}
2025-11-06 11:48:01 +03:00
}
}
}
}
}
} ,
"tags" : [
{
2025-11-24 13:49:58 +03:00
"name" : "Retrieve Documentation" ,
2025-11-06 11:48:01 +03:00
"description" : "Retrieve library documentation and code examples"
} ,
{
2025-11-24 13:49:58 +03:00
"name" : "Search Libraries" ,
2025-11-06 11:48:01 +03:00
"description" : "Search for libraries in the Context7 database"
}
]
}