Significant-Gravitas/AutoGPT · error · HTTPException
Missing API key
Error message
Missing API key
What it means
Error "Missing API key" thrown in Significant-Gravitas/AutoGPT.
Source
Thrown at autogpt_platform/backend/backend/api/external/middleware.py:21
from prisma.enums import APIKeyPermission
from backend.data.auth.api_key import APIKeyInfo, validate_api_key
from backend.data.auth.base import APIAuthorizationInfo
from backend.data.auth.oauth import (
InvalidClientError,
InvalidTokenError,
OAuthAccessTokenInfo,
validate_access_token,
)
api_key_header = APIKeyHeader(name="X-API-Key", auto_error=False)
bearer_auth = HTTPBearer(auto_error=False)
async def require_api_key(api_key: str | None = Security(api_key_header)) -> APIKeyInfo:
"""Middleware for API key authentication only"""
if api_key is None:
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED, detail="Missing API key"
)
api_key_obj = await validate_api_key(api_key)
if not api_key_obj:
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED, detail="Invalid API key"
)
return api_key_obj
async def require_access_token(
bearer: HTTPAuthorizationCredentials | None = Security(bearer_auth),
) -> OAuthAccessTokenInfo:
"""Middleware for OAuth access token authentication only"""
if bearer is None:View on GitHub (pinned to 9c8bb5550f)
Solutions
- Pass the API key in the expected header (e.g. 'X-API-Key') with the request.
- Create an API key in your account settings if you do not have one.
When it happens
Trigger: Thrown at autogpt_platform/backend/backend/api/external/middleware.py:21 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14).
Data as JSON: /api/errors/07c9980a8678db06.
Report an issue: GitHub.