Skip to content

Context7 Platform -- Up-to-date docs for AI agents

docs: enhance library ID descriptions in API guide and OpenAPI spec (#2568)

Enes Gules30df4a1cff33
diff --git a/docs/api-guide.mdx b/docs/api-guide.mdx
index e56b8aec..f6f32aa6 100644
--- a/docs/api-guide.mdx
+++ b/docs/api-guide.mdx
@@ -30,6 +30,32 @@ Get your API key at [context7.com/dashboard](https://context7.com/dashboard). Le
| [Add Website](/api-reference/add-library/add-a-website) | `POST /api/v2/add/website` | Submit a website for crawling |
| [Add Confluence](/api-reference/add-library/add-a-confluence-space) | `POST /api/v2/add/confluence` | Submit a Confluence space |
+## Library ID format
+
+A **library ID** is the URL path of the library on context7.com. If the library page is at `https://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](/api-reference/context/get-documentation-context) and [Refresh Library](/api-reference/refresh/refresh-a-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>` |
+
+You can pin a specific version with either `/owner/repo/<version>` or `/owner/repo@<version>`:
+
+```
+/vercel/next.js/v15.1.8
+```
+
+<Tip>
+ Don't know the ID for a library? Find it on [context7.com](https://context7.com) — the URL path of the library page **is** the ID. Or call [Search Library](/api-reference/search/search-for-libraries) and use the `id` from the response.
+</Tip>
+
### Complete Workflow Example
```python
@@ -97,6 +123,10 @@ curl "https://context7.com/api/v2/context?libraryId=/vercel/next.js&query=How%20
# Less optimal - vague query
curl "https://context7.com/api/v2/context?libraryId=/vercel/next.js&query=auth" \
-H "Authorization: Bearer CONTEXT7_API_KEY"
+
+# Non-GitHub source (website) - same endpoint, same shape
+curl "https://context7.com/api/v2/context?libraryId=/websites/uploadcare_com&query=image%20transformations" \
+ -H "Authorization: Bearer CONTEXT7_API_KEY"
```
### Cache Responses
diff --git a/docs/openapi.json b/docs/openapi.json
index 7b32a1fd..fc9e899f 100644
--- a/docs/openapi.json
+++ b/docs/openapi.json
@@ -330,7 +330,7 @@
"properties": {
"libraryName": {
"type": "string",
- "description": "Library identifier in `/owner/repo` format"
+ "description": "Library identifier — the URL path of the library on context7.com. Use `/owner/repo` for GitHub repositories (e.g., `/vercel/next.js`), or `/<source>/<id>` for other sources (e.g., `/websites/uploadcare_com`, `/llmstxt/<source>`). See [Library ID format](/api-guide#library-id-format)."
},
"branch": {
"type": "string",
@@ -342,8 +342,19 @@
}
}
},
- "example": {
- "libraryName": "/vercel/next.js"
+ "examples": {
+ "github": {
+ "summary": "GitHub repository",
+ "value": { "libraryName": "/vercel/next.js" }
+ },
+ "website": {
+ "summary": "Website source",
+ "value": { "libraryName": "/websites/uploadcare_com" }
+ },
+ "llmstxt": {
+ "summary": "llms.txt source",
+ "value": { "libraryName": "/llmstxt/example" }
+ }
}
}
}
@@ -1441,7 +1452,7 @@
"LibraryIdParam": {
"name": "libraryId",
"in": "query",
- "description": "Context7-compatible library ID in format `/owner/repo`, `/owner/repo/version`, or `/owner/repo@version`",
+ "description": "Context7-compatible library ID — the URL path of the library on context7.com. Use `/owner/repo` for GitHub repositories, or `/<source>/<id>` for other sources (websites, llms.txt, GitLab/Bitbucket, etc.). Optionally suffix with `/<version>` or `@<version>` to pin a specific version. See [Library ID format](/api-guide#library-id-format).",
"required": true,
"schema": {
"type": "string",
@@ -1450,15 +1461,19 @@
"pattern": "^/[^/]+/[^/]+([/@][^/]+)?$"
},
"examples": {
- "basic": {
- "summary": "Basic library ID",
+ "github": {
+ "summary": "GitHub repository",
"value": "/vercel/next.js"
},
- "withVersion": {
- "summary": "With specific version (slash)",
- "value": "/vercel/next.js/v14.3.0"
+ "website": {
+ "summary": "Website source",
+ "value": "/websites/uploadcare_com"
},
- "withVersionAt": {
+ "llmstxt": {
+ "summary": "llms.txt source",
+ "value": "/llmstxt/example"
+ },
+ "withVersion": {
"summary": "With specific version (@ syntax)",
"value": "/vercel/[email protected]"
}
@@ -1515,7 +1530,7 @@
"properties": {
"id": {
"type": "string",
- "description": "Library ID in format `/owner/repo`",
+ "description": "Library ID — the URL path of the library on context7.com. `/owner/repo` for GitHub repositories, or `/<source>/<id>` 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": {
@@ -2011,7 +2026,7 @@
"properties": {
"libraryName": {
"type": "string",
- "description": "The library identifier assigned (e.g., /owner/repo)"
+ "description": "The library identifier assigned — the URL path of the library on context7.com. `/owner/repo` for GitHub repositories, or `/<source>/<id>` for other sources (e.g., `/vercel/next.js`, `/websites/uploadcare_com`). See [Library ID format](/api-guide#library-id-format)."
},
"message": {
"type": "string",
@@ -2397,7 +2412,7 @@
"summary": "Invalid library ID format",
"value": {
"error": "invalid_library_id",
- "message": "Invalid library ID format. Expected: /owner/repo or /owner/repo/version"
+ "message": "Invalid library ID format. Expected: `/owner/repo` for GitHub repositories, or `/<source>/<id>` for other sources (the URL path of the library on context7.com)"
}
}
}