Skip to content

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

feat: enhance OpenAPI spec with improved error handling and auth

enesgulescaed63decd66
diff --git a/docs/openapi.json b/docs/openapi.json
index 3c0b1ac1..7a24c15f 100644
--- a/docs/openapi.json
+++ b/docs/openapi.json
@@ -16,11 +16,6 @@
"description": "Production server"
}
],
- "security": [
- {
- "bearerAuth": []
- }
- ],
"paths": {
"/v1/{owner}/{repo}": {
"get": {
@@ -100,6 +95,9 @@
}
}
},
+ "400": {
+ "$ref": "#/components/responses/BadRequestError"
+ },
"401": {
"$ref": "#/components/responses/UnauthorizedError"
},
@@ -203,6 +201,9 @@
}
}
},
+ "400": {
+ "$ref": "#/components/responses/BadRequestError"
+ },
"401": {
"$ref": "#/components/responses/UnauthorizedError"
},
@@ -262,9 +263,14 @@
"/v1/add": {
"post": {
"summary": "Add a Library",
- "description": "Submit a new library to Context7 for indexing. The parsing process starts immediately and the status transitions from `processing` to `finalized`.",
+ "description": "Submit a new library to Context7 for indexing. Supports GitHub/GitLab repositories, llms.txt files, and tag-based library versions. The parsing process starts immediately and the status transitions from `processing` to `finalized`.",
"operationId": "addLibrary",
"tags": ["Library Management"],
+ "security": [
+ {
+ "bearerAuth": []
+ }
+ ],
"requestBody": {
"required": true,
"content": {
@@ -273,29 +279,25 @@
"$ref": "#/components/schemas/AddLibraryRequest"
},
"examples": {
- "basic": {
- "summary": "Basic example",
+ "github": {
+ "summary": "GitHub repository",
"value": {
"docsRepoUrl": "https://github.com/okken/pytest-check",
- "projectTitle": "PyTest Check",
- "branch": "main"
+ "branch": "main",
+ "folders": ["docs"]
}
},
- "withFolders": {
- "summary": "With included folders",
+ "llmstxt": {
+ "summary": "llms.txt file",
"value": {
- "docsRepoUrl": "https://github.com/okken/pytest-check",
- "branch": "main",
- "folders": ["docs", "examples"]
+ "llmstxtUrl": "https://example.com/llms.txt"
}
},
- "withExclusions": {
- "summary": "With excluded folders",
+ "tag": {
+ "summary": "Tag-based version",
"value": {
- "docsRepoUrl": "https://github.com/psf/requests",
- "projectTitle": "Requests",
- "branch": "main",
- "excludeFolders": ["tests", "examples"]
+ "libraryName": "/vercel/next.js",
+ "libraryTagCode": "v15.1.8"
}
}
}
@@ -313,9 +315,18 @@
}
}
},
+ "400": {
+ "$ref": "#/components/responses/BadRequestError"
+ },
"401": {
"$ref": "#/components/responses/UnauthorizedError"
},
+ "403": {
+ "$ref": "#/components/responses/ForbiddenError"
+ },
+ "404": {
+ "$ref": "#/components/responses/NotFoundError"
+ },
"429": {
"$ref": "#/components/responses/RateLimitError"
},
@@ -387,6 +398,17 @@
}
}
}
+ },
+ "metadata": {
+ "type": "object",
+ "description": "API request metadata",
+ "properties": {
+ "authentication": {
+ "type": "string",
+ "description": "Authentication status",
+ "example": "paid"
+ }
+ }
}
}
},
@@ -516,17 +538,27 @@
},
"AddLibraryRequest": {
"type": "object",
- "required": ["docsRepoUrl"],
+ "description": "Request to add a library. Provide exactly one of: docsRepoUrl, llmstxtUrl, or both libraryName and libraryTagCode.",
"properties": {
"docsRepoUrl": {
"type": "string",
- "description": "GitHub repository URL",
+ "description": "GitHub or GitLab repository URL",
"example": "https://github.com/okken/pytest-check"
},
- "projectTitle": {
+ "llmstxtUrl": {
"type": "string",
- "description": "Display name for the project (auto-detected if not provided)",
- "example": "PyTest Check"
+ "description": "URL to llms.txt, llms-full.txt, or llms-small.txt file",
+ "example": "https://example.com/llms.txt"
+ },
+ "libraryName": {
+ "type": "string",
+ "description": "Library identifier for tag-based sources (use with libraryTagCode)",
+ "example": "/vercel/next.js"
+ },
+ "libraryTagCode": {
+ "type": "string",
+ "description": "Version tag for tag-based sources (use with libraryName)",
+ "example": "v15.1.8"
},
"branch": {
"type": "string",
@@ -589,11 +621,6 @@
"description": "Auto-detected project description",
"example": "A pytest plugin that allows multiple failures per test."
},
- "projectTitle": {
- "type": "string",
- "description": "Project title (auto-detected or provided)",
- "example": "auto-detected"
- },
"folders": {
"type": "array",
"description": "Folders included in parsing",
@@ -643,7 +670,6 @@
"docsRepoUrl": "https://github.com/okken/pytest-check",
"projectName": "/okken/pytest-check",
"description": "A pytest plugin that allows multiple failures per test.",
- "projectTitle": "auto-detected",
"folders": ["docs", "examples"],
"excludeFolders": ["archive"],
"excludeFiles": [
@@ -680,6 +706,20 @@
}
},
"responses": {
+ "BadRequestError": {
+ "description": "Bad Request - Invalid input parameters",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Error"
+ },
+ "example": {
+ "error": "Invalid input",
+ "status": 400
+ }
+ }
+ }
+ },
"UnauthorizedError": {
"description": "Unauthorized - Invalid or missing API key",
"content": {
@@ -694,6 +734,20 @@
}
}
},
+ "ForbiddenError": {
+ "description": "Forbidden - Insufficient permissions",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Error"
+ },
+ "example": {
+ "error": "Insufficient permissions",
+ "status": 403
+ }
+ }
+ }
+ },
"NotFoundError": {
"description": "Not Found - Library or endpoint doesn't exist",
"content": {