### Schema: CodeExample Source: https://context7.com/docs/openapi.json A single code example ```markdown ## Schema: CodeExample A single code example **Type:** object - **language** (string) (required): Programming language - **code** (string) (required): The actual code content ``` -------------------------------- ### GET /v2/libs/search Source: https://context7.com/docs/openapi.json Search for libraries by name with intelligent LLM-powered ranking based on your query context. ```markdown ### Parameters - **libraryName** (string, query, required): Library name to search for (e.g., 'react', 'nextjs', 'express') - **query** (string, query, required): User's original question or task - used for intelligent relevance ranking - **fast** (string (true|false), query, optional): When `true`, skip LLM reranking and return top vector-search results directly. Trades relevance quality for lower latency. ### Responses #### 200 - Search results ranked by relevance **SearchResponse** - **results** (array (Library)) (required): Array of matching libraries ranked by relevance Array items: - **id** (string): Library ID — the URL path of the library on context7.com. `/owner/repo` for GitHub repositories, or `//` for other sources (e.g., `/vercel/next.js`, `/websites/uploadcare_com`). See [Library ID format](/api-guide#library-id-format). (example: "/vercel/next.js") - **title** (string): Display name of the library (example: "Next.js") - **description** (string): Short description (example: "The React Framework") - **branch** (string): Git branch being tracked (example: "canary") - **lastUpdateDate** (string (date-time)): ISO 8601 timestamp of last update (example: "2025-01-15T10:30:00.000Z") - **state** (string (finalized|initial|processing|error|delete)): Processing state of the library (example: "finalized") ("finalized"|"initial"|"processing"|"error"|"delete") - **totalTokens** (integer): Total tokens in documentation (example: 607822) - **totalSnippets** (integer): Number of code snippets (example: 3629) - **stars** (integer): GitHub stars count (example: 131745) - **trustScore** (integer): Source reputation score (0-10) (example: 10) - **benchmarkScore** (number): Quality indicator score (0-100) (example: 95.5) - **versions** (array (string)): Available version tags (example: ["v15.1.8","v14.3.0"]) - **searchFilterApplied** (boolean) (required): Indicates whether the search results were filtered by the teamspace's public library access settings. When true, some libraries may be excluded from results based on the teamspace's configuration (e.g., only verified libraries, selected libraries, or private repos only). #### 400 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 401 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 402 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 404 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 429 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 500 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 503 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message ### Example Usage ```bash curl -X GET "https://context7.com/api/v2/libs/search?libraryName=string&query=string&fast=false" ``` ``` -------------------------------- ### API Overview: Context7 Public API Source: https://context7.com/docs/openapi.json The Context7 Public API provides programmatic access to library documentation and search functionality. Get up-to-date documentation and code examples for any library. ```yaml # Context7 Public API # Version: 2.0.0 The Context7 Public API provides programmatic access to library documentation and search functionality. Get up-to-date documentation and code examples for any library. # Base URL: https://context7.com/api ``` -------------------------------- ### GET /v2/context Source: https://context7.com/docs/openapi.json Retrieve intelligent, LLM-reranked documentation context for natural language queries. Returns the most relevant code snippets and documentation for your specific question. ```markdown ### Parameters - **libraryId** (string, query, required): Context7-compatible library ID — the URL path of the library on context7.com. Use `/owner/repo` for GitHub repositories, or `//` for other sources (websites, llms.txt, GitLab/Bitbucket, etc.). Optionally suffix with `/` or `@` to pin a specific version. See [Library ID format](/api-guide#library-id-format). - **query** (string, query, required): User's original question or task - used for intelligent relevance ranking - **type** (string (json|txt), query, optional): Response format type - **fast** (string (true|false), query, optional): When `true`, skip LLM reranking and return top vector-search results directly. Trades relevance quality for lower latency. ### Responses #### 200 - Documentation context **ContextResponse** - **codeSnippets** (array (CodeSnippet)) (required): Relevant code snippets Array items: - **codeTitle** (string) (required): Title of the code snippet - **codeDescription** (string) (required): Description of what the code does - **codeLanguage** (string) (required): Primary programming language - **codeTokens** (integer) (required): Token count for the snippet - **codeId** (string) (required): URL to source location - **pageTitle** (string) (required): Title of the documentation page - **codeList** (array (CodeExample)) (required): Code examples in different languages Array items: - **language** (string) (required): Programming language - **code** (string) (required): The actual code content - **isDynamic** (boolean): Whether this snippet was recovered from the dynamic source-code index instead of the primary docs index - **sourceFile** (string): Repo-relative source file path for dynamic snippets - **infoSnippets** (array (InfoSnippet)) (required): Relevant documentation snippets Array items: - **pageId** (string): URL to source page - **breadcrumb** (string): Navigation breadcrumb path - **content** (string) (required): The documentation content - **contentTokens** (integer) (required): Token count for the content - **rules** (object): Optional library-specific rules and guidelines - **global** (array (string)): Global team rules - **libraryOwn** (array (string)): Rules defined by the library owner - **libraryTeam** (array (string)): Library-specific rules from the team #### 202 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 301 - response **RedirectErrorResponse** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message - **redirectUrl** (string): New location of the library #### 400 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 401 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 402 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 403 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 404 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 422 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 429 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 500 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message ### Example Usage ```bash curl -X GET "https://context7.com/api/v2/context?libraryId=string&query=string&type=txt&fast=false" ``` ``` -------------------------------- ### GET /v2/libs/metrics Source: https://context7.com/docs/openapi.json Retrieve full usage metrics for a library: cumulative and daily request counters broken down by surface (web page, text docs, MCP, CLI), MCP client daily unique-user breakdown, and lifetime topic and country distributions. The API key must belong to a member of the teamspace that owns the library — claim ownership from the library's admin page on context7.com. ```markdown ### Parameters - **libraryId** (string, query, required): Context7-compatible library ID — the URL path of the library on context7.com. Use `/owner/repo` for GitHub repositories, or `//` for other sources (websites, llms.txt, GitLab/Bitbucket, etc.). Optionally suffix with `/` or `@` to pin a specific version. See [Library ID format](/api-guide#library-id-format). - **days** (integer, query, optional): Number of days of daily history to return (1-365). Defaults to 30. ### Responses #### 200 - Library usage metrics **LibraryMetricsResponse** - **total** (object) (required): Cumulative request counts for a library, broken down by request surface - **page** (integer) (required): Requests served to the context7.com web UI - **txt** (integer) (required): Plain-text documentation requests - **mcp** (integer) (required): Requests served via the Context7 MCP server - **cli** (integer) (required): Requests served to the Context7 CLI - **daily** (array (DailyStatsPoint)) (required): Per-day request counts (deltas, not cumulative), ordered from oldest to newest. Days with zero activity are omitted. Up to `days` points — fewer if the library has less history or had idle days in the window. Array items: - **date** (string (date)) (required): UTC date in `YYYY-MM-DD` format (example: "2025-01-15") - **page** (integer) (required): Requests served to the context7.com web UI on this date - **txt** (integer) (required): Plain-text documentation requests on this date - **mcp** (integer) (required): Requests served via the Context7 MCP server on this date - **cli** (integer) (required): Requests served to the Context7 CLI on this date - **total** (integer) (required): Sum of all request surfaces on this date (`page + txt + mcp + cli`) - **mcpClients** (object) (required): MCP client usage breakdown by day - **dailyData** (array (McpDailyClientData)) (required): Per-day MCP client unique-user breakdown, ordered from oldest to newest Array items: - **date** (string (date)) (required): UTC date in `YYYY-MM-DD` format (example: "2025-01-15") - **uniqueUsersByClient** (object) (required): Unique user count per MCP client identifier (e.g., `cursor`, `claude-code`, `codex`) - **totalUniqueUsers** (integer) (required): Total unique users across all clients for this library on this date - **topics** (array (TopicCount)) (required): Lifetime topic distribution, ordered by count descending Array items: - **topic** (string) (required): Normalized, lowercased topic string (example: "routing") - **count** (integer) (required): Number of requests that referenced this topic - **countries** (array (CountryCount)) (required): Lifetime country distribution (ISO-2 codes), ordered by count descending Array items: - **country** (string) (required): ISO 3166-1 alpha-2 country code (example: "US") - **count** (integer) (required): Number of requests originating from this country #### 400 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 401 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 403 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 404 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 500 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message ### Example Usage ```bash curl -X GET "https://context7.com/api/v2/libs/metrics?libraryId=string&days=30" ``` ``` -------------------------------- ### GET /v2/policies Source: https://context7.com/docs/openapi.json Retrieve the current policy configuration for the teamspace associated with the API key. Includes source type access settings and public repository filters. ```markdown ### Responses #### 200 - Current policy configuration **PolicyResponse** - **sourceTypes** (object) (required): Access settings for each documentation source type - **public_repos** (object) (required): Whether a source type is enabled or disabled - **enabled** (boolean) (required): Whether this source type is enabled - **private_sources** (object) (required): Whether a source type is enabled or disabled - **confluence** (object) (required): Whether a source type is enabled or disabled - **uploaded_files** (object) (required): Whether a source type is enabled or disabled - **websites** (object) (required): Whether a source type is enabled or disabled - **llmstxt** (object) (required): Whether a source type is enabled or disabled - **libraryFilters** (object) (required): Library access filters. Mode determines which sub-object is active. - **mode** (string (quality|select|)) (required): Filter mode: 'quality' for threshold-based filtering, 'select' for manual library selection ("quality"|"select"|"null") - **quality** (object) (required): Quality-mode settings (active when mode is 'quality') - **requireVerified** (boolean) (required): Restrict to verified libraries only - **minTrustScore** (integer) (required): Minimum trust score, 0-10 - **maxAgeDays** (integer) (required): Maximum days since last update - **blockedLibraries** (array (string)) (required): Libraries excluded from results - **exceptedLibraries** (array (string)) (required): Libraries that bypass all quality filters, blocked list, and source type restrictions - **repoFilters** (object) (required): Repo-specific quality filters - **minStars** (integer) (required): Minimum GitHub stars required - **websiteFilters** (object) (required): Website-specific quality filters - **minBacklinks** (integer) (required): Minimum number of backlinks required - **minReferringDomains** (integer) (required): Minimum number of referring domains required - **minOrganicTraffic** (integer) (required): Minimum monthly organic traffic required - **select** (object) (required): Select-mode settings (active when mode is 'select') - **allowedLibraries** (array (string)) (required): Libraries explicitly allowed - **accessibleLibraryCount** (integer) (required): Number of public libraries currently accessible under these filters #### 400 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 401 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 403 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 404 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 500 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message ### Example Usage ```bash curl -X GET "https://context7.com/api/v2/policies" ``` ``` -------------------------------- ### POST /v2/add/repo/bitbucket Source: https://context7.com/docs/openapi.json Submit a Bitbucket repository for documentation processing. Supports private repos via a gitToken or by connecting your Bitbucket account at https://context7.com/add-library. ```markdown ### Request Body **Content-Type:** application/json - **docsRepoUrl** (string (uri)) (required): The repository URL - **gitToken** (string): Personal access token for private repositories. If not provided, the token from your OAuth connection at https://context7.com/add-library is used. - **private** (boolean): Whether the repository is private - **skipVersionFiltering** (boolean): Skip filtering out version-specific documentation pages ### Responses #### 200 - response **AddLibraryResponse** - **libraryName** (string) (required): The library identifier assigned — the URL path of the library on context7.com. `/owner/repo` for GitHub repositories, or `//` for other sources (e.g., `/vercel/next.js`, `/websites/uploadcare_com`). See [Library ID format](/api-guide#library-id-format). - **message** (string) (required): Human-readable success message #### 400 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 401 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 403 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 404 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 409 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 429 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 500 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 504 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message ### Example Usage ```bash curl -X POST "https://context7.com/api/v2/add/repo/bitbucket" \ -H "Content-Type: application/json" \ -d '{ "docsRepoUrl": "string", "gitToken": "string", "private": "true", "skipVersionFiltering": "true" }' ``` ``` -------------------------------- ### POST /v2/add/website Source: https://context7.com/docs/openapi.json Submit a website URL for documentation processing. ```markdown ### Request Body **Content-Type:** application/json - **websiteUrl** (string (uri)) (required): The website URL to process - **websiteBaseUrl** (string (uri)): Base URL to limit crawling scope. Only pages starting with this URL will be indexed. ### Responses #### 200 - response **AddLibraryResponse** - **libraryName** (string) (required): The library identifier assigned — the URL path of the library on context7.com. `/owner/repo` for GitHub repositories, or `//` for other sources (e.g., `/vercel/next.js`, `/websites/uploadcare_com`). See [Library ID format](/api-guide#library-id-format). - **message** (string) (required): Human-readable success message #### 400 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 401 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 422 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 429 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 500 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 504 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message ### Example Usage ```bash curl -X POST "https://context7.com/api/v2/add/website" \ -H "Content-Type: application/json" \ -d '{ "websiteUrl": "string", "websiteBaseUrl": "string" }' ``` ``` -------------------------------- ### POST /v2/add/repo/github Source: https://context7.com/docs/openapi.json Submit a GitHub repository for documentation processing. Supports private repos via a gitToken or by connecting your GitHub account at https://context7.com/add-library. ```markdown ### Request Body **Content-Type:** application/json - **docsRepoUrl** (string (uri)) (required): The repository URL - **gitToken** (string): Personal access token for private repositories. If not provided, the token from your OAuth connection at https://context7.com/add-library is used. - **private** (boolean): Whether the repository is private - **skipVersionFiltering** (boolean): Skip filtering out version-specific documentation pages ### Responses #### 200 - response **AddLibraryResponse** - **libraryName** (string) (required): The library identifier assigned — the URL path of the library on context7.com. `/owner/repo` for GitHub repositories, or `//` for other sources (e.g., `/vercel/next.js`, `/websites/uploadcare_com`). See [Library ID format](/api-guide#library-id-format). - **message** (string) (required): Human-readable success message #### 400 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 401 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 403 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 404 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 409 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 429 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 500 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 504 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message ### Example Usage ```bash curl -X POST "https://context7.com/api/v2/add/repo/github" \ -H "Content-Type: application/json" \ -d '{ "docsRepoUrl": "string", "gitToken": "string", "private": "true", "skipVersionFiltering": "true" }' ``` ``` -------------------------------- ### Security: bearerAuth Source: https://context7.com/docs/openapi.json Get your API key at [context7.com/dashboard](https://context7.com/dashboard). Treat your API key like a password and store it securely. ```markdown ## Security: bearerAuth **Description:** Get your API key at [context7.com/dashboard](https://context7.com/dashboard). Treat your API key like a password and store it securely. **Type:** http **Scheme:** bearer ``` -------------------------------- ### Schema: AddLibraryResponse Source: https://context7.com/docs/openapi.json Response after successfully submitting a library ```markdown ## Schema: AddLibraryResponse Response after successfully submitting a library **Type:** object - **libraryName** (string) (required): The library identifier assigned — the URL path of the library on context7.com. `/owner/repo` for GitHub repositories, or `//` for other sources (e.g., `/vercel/next.js`, `/websites/uploadcare_com`). See [Library ID format](/api-guide#library-id-format). - **message** (string) (required): Human-readable success message ``` -------------------------------- ### POST /v2/add/repo/gitlab Source: https://context7.com/docs/openapi.json Submit a GitLab repository for documentation processing. Supports private repos via a gitToken or by connecting your GitLab account at https://context7.com/add-library. ```markdown ### Request Body **Content-Type:** application/json - **docsRepoUrl** (string (uri)) (required): The repository URL - **gitToken** (string): Personal access token for private repositories. If not provided, the token from your OAuth connection at https://context7.com/add-library is used. - **private** (boolean): Whether the repository is private - **skipVersionFiltering** (boolean): Skip filtering out version-specific documentation pages ### Responses #### 200 - response **AddLibraryResponse** - **libraryName** (string) (required): The library identifier assigned — the URL path of the library on context7.com. `/owner/repo` for GitHub repositories, or `//` for other sources (e.g., `/vercel/next.js`, `/websites/uploadcare_com`). See [Library ID format](/api-guide#library-id-format). - **message** (string) (required): Human-readable success message #### 400 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 401 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 403 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 404 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 409 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 429 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 500 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 504 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message ### Example Usage ```bash curl -X POST "https://context7.com/api/v2/add/repo/gitlab" \ -H "Content-Type: application/json" \ -d '{ "docsRepoUrl": "string", "gitToken": "string", "private": "true", "skipVersionFiltering": "true" }' ``` ``` -------------------------------- ### POST /v2/add/notion Source: https://context7.com/docs/openapi.json Submit selected Notion pages for documentation processing. Requires a connected Notion account and a team project. ```markdown ### Request Body **Content-Type:** application/json - **workspaceId** (string) (required): The Notion workspace ID - **workspaceName** (string) (required): The Notion workspace name - **pageIds** (array (string)) (required): List of Notion page IDs to index. - **title** (string) (required): Title for the library - **description** (string) (required): Description of the library - **projectId** (string): The team project ID to associate these Notion pages with ### Responses #### 200 - response **AddLibraryResponse** - **libraryName** (string) (required): The library identifier assigned — the URL path of the library on context7.com. `/owner/repo` for GitHub repositories, or `//` for other sources (e.g., `/vercel/next.js`, `/websites/uploadcare_com`). See [Library ID format](/api-guide#library-id-format). - **message** (string) (required): Human-readable success message #### 400 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 401 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 403 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 409 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 429 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 500 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 504 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message ### Example Usage ```bash curl -X POST "https://context7.com/api/v2/add/notion" \ -H "Content-Type: application/json" \ -d '{ "workspaceId": "string", "workspaceName": "string", "pageIds": [ "string" ], "title": "string", "description": "string", "projectId": "string" }' ``` ``` -------------------------------- ### POST /v2/add/repo/git Source: https://context7.com/docs/openapi.json Submit a repository from any Git provider not covered by the dedicated GitHub, GitLab, or Bitbucket endpoints. Supports Gitea, Forgejo, Codeberg, self-hosted GitLab, and other Git servers. For private repos, provide a personal access token via the gitToken field. ```markdown ### Request Body **Content-Type:** application/json - **docsRepoUrl** (string (uri)) (required): The Git repository URL - **gitToken** (string): Personal access token for private repositories - **private** (boolean): Whether the repository is private - **skipVersionFiltering** (boolean): Skip filtering out version-specific documentation pages ### Responses #### 200 - response **AddLibraryResponse** - **libraryName** (string) (required): The library identifier assigned — the URL path of the library on context7.com. `/owner/repo` for GitHub repositories, or `//` for other sources (e.g., `/vercel/next.js`, `/websites/uploadcare_com`). See [Library ID format](/api-guide#library-id-format). - **message** (string) (required): Human-readable success message #### 400 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 401 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 403 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 404 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 409 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 429 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 500 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 504 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message ### Example Usage ```bash curl -X POST "https://context7.com/api/v2/add/repo/git" \ -H "Content-Type: application/json" \ -d '{ "docsRepoUrl": "string", "gitToken": "string", "private": "true", "skipVersionFiltering": "true" }' ``` ``` -------------------------------- ### POST /v2/add/confluence Source: https://context7.com/docs/openapi.json Submit a Confluence space for documentation processing. Requires a connected Confluence account and a team project. You can optionally specify specific page IDs to index only a subset of the space. ```markdown ### Request Body **Content-Type:** application/json - **cloudId** (string) (required): The Confluence cloud instance ID - **siteUrl** (string) (required): The Confluence site URL - **spaceKey** (string) (required): The Confluence space key - **spaceName** (string) (required): The Confluence space name - **pageIds** (array (string)): Optional list of specific page IDs to index. If omitted, the entire space is indexed. - **title** (string) (required): Title for the library - **description** (string) (required): Description of the library - **projectId** (string): The team project ID to associate this Confluence space with ### Responses #### 200 - response **AddLibraryResponse** - **libraryName** (string) (required): The library identifier assigned — the URL path of the library on context7.com. `/owner/repo` for GitHub repositories, or `//` for other sources (e.g., `/vercel/next.js`, `/websites/uploadcare_com`). See [Library ID format](/api-guide#library-id-format). - **message** (string) (required): Human-readable success message #### 400 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 401 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 403 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 409 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 429 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 500 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 504 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message ### Example Usage ```bash curl -X POST "https://context7.com/api/v2/add/confluence" \ -H "Content-Type: application/json" \ -d '{ "cloudId": "string", "siteUrl": "string", "spaceKey": "string", "spaceName": "string", "pageIds": [ "string" ], "title": "string", "description": "string", "projectId": "string" }' ``` ``` -------------------------------- ### POST /v1/refresh Source: https://context7.com/docs/openapi.json Trigger a refresh of an existing library to fetch the latest documentation. Library owners have dedicated refresh limits. ```markdown ### Request Body **Content-Type:** application/json - **libraryName** (string) (required): Library identifier — the URL path of the library on context7.com. Use `/owner/repo` for GitHub repositories (e.g., `/vercel/next.js`), or `//` for other sources (e.g., `/websites/uploadcare_com`, `/llmstxt/`). See [Library ID format](/api-guide#library-id-format). - **branch** (string): Optional branch name to refresh - **gitToken** (string): Optional Git access token for refreshing private repositories. If not provided, the stored OAuth token will be used. ### Responses #### 200 - Refresh started successfully - **message** (string) (required) #### 400 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 401 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 403 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 404 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 429 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 500 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message ### Example Usage ```bash curl -X POST "https://context7.com/api/v1/refresh" \ -H "Content-Type: application/json" \ -d '{ "libraryName": "string", "branch": "string", "gitToken": "string" }' ``` ``` -------------------------------- ### Schema: InfoSnippet Source: https://context7.com/docs/openapi.json A documentation snippet ```markdown ## Schema: InfoSnippet A documentation snippet **Type:** object - **pageId** (string): URL to source page - **breadcrumb** (string): Navigation breadcrumb path - **content** (string) (required): The documentation content - **contentTokens** (integer) (required): Token count for the content ``` -------------------------------- ### Schema: ContextResponse Source: https://context7.com/docs/openapi.json Documentation context response ```markdown ## Schema: ContextResponse Documentation context response **Type:** object - **codeSnippets** (array (CodeSnippet)) (required): Relevant code snippets Array items: - **codeTitle** (string) (required): Title of the code snippet - **codeDescription** (string) (required): Description of what the code does - **codeLanguage** (string) (required): Primary programming language - **codeTokens** (integer) (required): Token count for the snippet - **codeId** (string) (required): URL to source location - **pageTitle** (string) (required): Title of the documentation page - **codeList** (array (CodeExample)) (required): Code examples in different languages Array items: - **language** (string) (required): Programming language - **code** (string) (required): The actual code content - **isDynamic** (boolean): Whether this snippet was recovered from the dynamic source-code index instead of the primary docs index - **sourceFile** (string): Repo-relative source file path for dynamic snippets - **infoSnippets** (array (InfoSnippet)) (required): Relevant documentation snippets Array items: - **pageId** (string): URL to source page - **breadcrumb** (string): Navigation breadcrumb path - **content** (string) (required): The documentation content - **contentTokens** (integer) (required): Token count for the content - **rules** (object): Optional library-specific rules and guidelines - **global** (array (string)): Global team rules - **libraryOwn** (array (string)): Rules defined by the library owner - **libraryTeam** (array (string)): Library-specific rules from the team ``` -------------------------------- ### POST /v2/add/openapi Source: https://context7.com/docs/openapi.json Submit an OpenAPI specification URL for documentation processing. ```markdown ### Request Body **Content-Type:** application/json - **openApiUrl** (string (uri)) (required): URL pointing to an OpenAPI specification (JSON or YAML) ### Responses #### 200 - response **AddLibraryResponse** - **libraryName** (string) (required): The library identifier assigned — the URL path of the library on context7.com. `/owner/repo` for GitHub repositories, or `//` for other sources (e.g., `/vercel/next.js`, `/websites/uploadcare_com`). See [Library ID format](/api-guide#library-id-format). - **message** (string) (required): Human-readable success message #### 400 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 401 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 429 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 500 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message #### 504 - response **Error** - **error** (string) (required): Error code identifier - **message** (string) (required): Human-readable error message ### Example Usage ```bash curl -X POST "https://context7.com/api/v2/add/openapi" \ -H "Content-Type: application/json" \ -d '{ "openApiUrl": "string" }' ``` ```