canonical: https://jentic.com/apis/context7.com/context7

# Context7 Public API

The Context7 Public API searches and retrieves up-to-date library documentation and code examples for use as model context. It resolves a library by name, returns documentation context in a single request, and searches across indexed sources. Teams extend the index by adding GitHub, GitLab, and Bitbucket repositories, uploading OpenAPI specs, PDFs, and Word documents, or pulling in websites, Confluence spaces, and Notion pages, and can refresh a library to re-index it.

## For AI agents

Search for libraries and retrieve current documentation context for grounding an LLM, and index new sources from repositories, files, websites, or Notion. Search and context reads work with or without a bearer token.

## Scope

Does not handle code execution, vector-database hosting, or model inference. Use for indexing and retrieving library documentation only.

## Capabilities

- Search for a library by name and resolve it to its documentation
- Retrieve up-to-date documentation context for a library in a single request
- Search indexed documentation across sources in one request
- Index a GitHub, GitLab, or Bitbucket repository to make its docs searchable
- Ingest an OpenAPI spec, PDF, Word document, website, Confluence space, or Notion pages
- Refresh a library to re-index its latest documentation
- Read API usage and read or update teamspace policies

## Use cases

### Grounded Code Generation

A coding agent resolves a library by name and pulls its current documentation context from Context7 before writing code, so it generates against the live API surface rather than stale training data. The context request returns documentation and code examples in one call, which the agent injects into its prompt to cut hallucinated method names.

Example prompt: Call GET `/v2/libs/search` to resolve the library, then GET `/v2/context` to retrieve its documentation for the prompt

### Private Documentation Indexing

A team makes its internal docs searchable by adding a GitHub repository, uploading an OpenAPI spec, or pulling in a Confluence space, then refreshing the library so retrieval reflects the latest changes. Context7 handles the ingestion and indexing, so an agent can later search across both public and private sources in one request.

Example prompt: Call POST `/v2/add/repo/github` to index a repository, then POST `/v1/refresh` to re-index its latest documentation

### AI Agent Integration via Jentic

An AI agent reaches Context7 through Jentic without handling the bearer token itself. It searches by intent, receives the matching operation and its input schema, and executes the call with the credential injected at run time. This lets an agent fetch documentation context as a grounding step before it answers a coding question.

Example prompt: Search Jentic for 'fetch current documentation for a library', load the GET `/v2/context` schema, and execute it with Jentic-managed credentials

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | `/v2/libs/search` | Search for libraries |
| GET | `/v2/context` | Get documentation context |
| GET | `/v3/search` | Search documentation in one request |
| POST | `/v2/add/repo/github` | Add a GitHub repository |
| POST | `/v2/add/openapi` | Add an OpenAPI specification by URL |
| POST | `/v1/refresh` | Refresh a library |
| GET | `/v2/usage` | Get API usage |

## Key resources

- **Library search** — Resolve a library by name via `/v2/libs/search` and read usage metrics via `/v2/libs/metrics`
- **Context retrieval** — Fetch documentation context via `/v2/context` and search documentation via `/v3/search`
- **Sources** — Add repositories, specs, files, websites, Confluence, and Notion via `/v2/add`/*
- **Teamspace** — Read and update teamspace policies via `/v2/policies` and read usage via `/v2/usage`

## AI readiness

This API is usable in Jentic One now. Its AI-readiness score against Jentic's framework shows where it stands today and where improvements would make it even easier for agents to use.

- **Score:** 75 / 100
- **Maturity:** AI-Ready
- **Dimensions:**
  - Foundational Compliance: 100 / 100
  - Developer Experience & Jentic Compatibility: 73 / 100
  - AI-Readiness & Agent Experience: 63 / 100
  - Agent Usability: 94 / 100
  - Security: 60 / 100
  - AI Discoverability: 82 / 100
- **View full report:** https://jentic.com/apis/context7.com/context7/scorecard
- **How the score is calculated:** https://docs.jentic.com/reference/api-readiness-framework/overview/
- **More about the dimensions:** https://docs.jentic.com/reference/api-readiness-framework/specification/#dimensional-model-overview

### Score it yourself

Every API in the directory is allowlisted, so you can re-score it with no key required.

- **Score your own API:** https://jentic.com/scorecard.md
- **Scoring CLI agent skill:** https://github.com/jentic/jentic-api-scorecard/blob/main/skills/jentic-api-scorecard/SKILL.md

```sh
npx @jentic/api-scorecard-cli score <openapi-url>
```

## Why Jentic

- **Setup:** Wiring Context7 by hand means managing its bearer token, deciding which endpoints need a key, and threading the token through each search, context, and indexing call. Through Jentic you install once, import Context7 from the API Directory, store the key once, and your agent calls it.
- **Permission scoping:** Context7 carries the target library or source in the request body, so a rule bounds which operations your agent may call, not which library. You choose the operations it may call, so retrieval reads can be allowed while repository indexing and teamspace-policy updates are not included unless you add them.
- **Credential handling:** Your Context7 key is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'fetch current documentation' or 'search a library', and Jentic returns the matching Context7 operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Tavily** — Web search API built for retrieval-augmented LLM workflows
- **Exa** — Neural web search and content retrieval for AI applications
- **Pinecone** — Managed vector database for storing and querying embeddings

## FAQ

### What authentication does the Context7 Public API use?

The Context7 Public API authenticates with a bearer token in the Authorization header, per its OpenAPI spec, with your API key issued from the Context7 dashboard. The library search and context endpoints work with or without a key, while indexing and policy operations require the token. Through Jentic the key is stored encrypted by your own Jentic One instance and injected at execution time, so it never reaches the agent.

### Can I index my own documentation with the Context7 Public API?

Yes. You can add a GitHub, GitLab, or Bitbucket repository, upload an OpenAPI spec, PDF, or Word document, or pull in a website, Confluence space, or Notion pages, then refresh the library to re-index it. After ingestion an agent can search across your private sources alongside public libraries in one request.

### What are the rate limits for the Context7 Public API?

The OpenAPI spec does not publish specific rate-limit numbers; check https://context7.com/dashboard for the current limits on your plan. The usage endpoint reports your consumption so an agent can gauge headroom before a batch of context requests.

### Is there a Context7 MCP server?

You don't need an MCP server to give your agent Context7. Jentic connects it directly from the API Directory: import it, store your credential once, and your agent calls the search and context operations. Operations are discovered on demand, so nothing extra loads into the agent's context until one is invoked.

### Can I limit what my agent is allowed to do with the Context7 Public API?

Yes. Context7 carries the target library or source in the request body, so a rule bounds which operations your agent may call rather than which library. Allow only the search and context reads and the agent can retrieve documentation while the repository-add and policy-update operations stay out of reach, with every call logged by your own Jentic One instance.

### How do I fetch documentation context with the Context7 Public API through Jentic?

Search Jentic for 'fetch current documentation for a library', and it returns the Context7 context operation with its input schema. Load the schema and execute GET `/v2/context` for the resolved library with the credential injected at run time. To run it on your own infrastructure, install Jentic One from its GitHub repo.
