BerriAI/litellm · error · HTTPException
You are not authorized to delete this key
Error message
You are not authorized to delete this key
What it means
Error "You are not authorized to delete this key" thrown in BerriAI/litellm.
Source
Thrown at litellm/proxy/management_endpoints/key_management_endpoints.py:4210
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
detail={"error": "No keys found"},
)
if user_api_key_dict.user_role == LitellmUserRoles.PROXY_ADMIN.value:
authorized_keys = _keys_being_deleted
else:
authorized_keys = []
for key in _keys_being_deleted:
if await can_modify_verification_token(
key_info=key,
user_api_key_cache=user_api_key_cache,
user_api_key_dict=user_api_key_dict,
prisma_client=prisma_client,
):
authorized_keys.append(key)
else:
raise HTTPException(
status_code=status.HTTP_403_FORBIDDEN,
detail={"error": "You are not authorized to delete this key"},
)
await _persist_deleted_verification_tokens(
keys=authorized_keys,
prisma_client=prisma_client,
user_api_key_dict=user_api_key_dict,
litellm_changed_by=litellm_changed_by,
)
if user_api_key_dict.user_role == LitellmUserRoles.PROXY_ADMIN.value:
deleted_tokens = await prisma_client.delete_data(tokens=tokens)
if deleted_tokens is not None and len(deleted_tokens) != len(tokens):
failed_tokens = [token for token in tokens if token not in deleted_tokens]
else:
deletion_tasks: Final = [prisma_client.delete_data(tokens=[key.token]) for key in authorized_keys]
await asyncio.gather(*deletion_tasks)
View on GitHub (pinned to 77b7c6c40c)
Solutions
- Authenticate as the key's owner, a team admin of the key's team, or a proxy admin.
- Ask a proxy admin to delete the key on your behalf.
When it happens
Trigger: Thrown at litellm/proxy/management_endpoints/key_management_endpoints.py:4210 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/ab5e45b707aa5b1e.
Report an issue: GitHub.