Skip to main content
Get your API key at context7.com/dashboard. Learn more about creating and managing API keys.
You can pin a specific version with either
All errors return a JSON object with
For
Overview
API Guide
Authentication, rate limits, best practices, and integration guides for the Context7 API
Authentication
All API requests require authentication using an API key. Include your API key in theAuthorization header:
API Methods
Library ID format
A library ID is the URL path of the library on context7.com. If the library page is athttps://context7.com/websites/uploadcare_com, its ID is /websites/uploadcare_com. The same ID works for every endpoint that accepts a libraryId or libraryName — including Get Context and Refresh Library.
Use /owner/repo for GitHub repositories, or /<source>/<id> for other sources:
| Source | Example library ID |
|---|---|
| GitHub repository | /vercel/next.js |
| GitLab / Bitbucket / generic Git repo | /<owner>/<repo> (same shape as GitHub) |
| Website | /websites/uploadcare_com |
| llms.txt source | /llmstxt/<source> |
| npm / package source | /packages/<name> or /npm/<name> |
| Uploaded docs | /docs/<name> |
/owner/repo/<version> or /owner/repo@<version>:
Complete Workflow Example
For TypeScript SDK usage, see Search Library and Get Context.
Rate Limits
- Without API key: Low rate limits and no custom configuration
- With API key: Higher limits based on your plan
- View current usage and reset windows in the dashboard.
429 status code with these headers:
| Header | Description |
|---|---|
Retry-After | Seconds until rate limit resets |
RateLimit-Limit | Total request limit |
RateLimit-Remaining | Remaining requests in window |
RateLimit-Reset | Unix timestamp when limit resets |
Best Practices
Be Specific with Queries
Use detailed, natural language queries for better results:Cache Responses
Documentation updates are relatively infrequent, so caching responses for several hours or days reduces API calls and improves performance.Handle Rate Limits
Implement exponential backoff for rate limit errors:Use Specific Versions
Pin to a specific version for consistent results. Both/ and @ syntax are supported:
Error Handling
The Context7 API uses standard HTTP status codes:error and message fields:
301 redirects, the response also includes a redirectUrl field pointing to the new library ID.
