{"record":{"id":"ab5e45b707aa5b1e","repo":"BerriAI/litellm","slug":"you-are-not-authorized-to-delete-this-key","errorCode":null,"errorMessage":"You are not authorized to delete this key","messagePattern":"You are not authorized to delete this key","errorType":"http","errorClass":"HTTPException","httpStatus":403,"severity":"error","filePath":"litellm/proxy/management_endpoints/key_management_endpoints.py","lineNumber":4210,"sourceCode":"                raise HTTPException(\n                    status_code=status.HTTP_404_NOT_FOUND,\n                    detail={\"error\": \"No keys found\"},\n                )\n\n            if user_api_key_dict.user_role == LitellmUserRoles.PROXY_ADMIN.value:\n                authorized_keys = _keys_being_deleted\n            else:\n                authorized_keys = []\n                for key in _keys_being_deleted:\n                    if await can_modify_verification_token(\n                        key_info=key,\n                        user_api_key_cache=user_api_key_cache,\n                        user_api_key_dict=user_api_key_dict,\n                        prisma_client=prisma_client,\n                    ):\n                        authorized_keys.append(key)\n                    else:\n                        raise HTTPException(\n                            status_code=status.HTTP_403_FORBIDDEN,\n                            detail={\"error\": \"You are not authorized to delete this key\"},\n                        )\n            await _persist_deleted_verification_tokens(\n                keys=authorized_keys,\n                prisma_client=prisma_client,\n                user_api_key_dict=user_api_key_dict,\n                litellm_changed_by=litellm_changed_by,\n            )\n\n            if user_api_key_dict.user_role == LitellmUserRoles.PROXY_ADMIN.value:\n                deleted_tokens = await prisma_client.delete_data(tokens=tokens)\n                if deleted_tokens is not None and len(deleted_tokens) != len(tokens):\n                    failed_tokens = [token for token in tokens if token not in deleted_tokens]\n            else:\n                deletion_tasks: Final = [prisma_client.delete_data(tokens=[key.token]) for key in authorized_keys]\n                await asyncio.gather(*deletion_tasks)\n","sourceCodeStart":4192,"sourceCodeEnd":4228,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/key_management_endpoints.py#L4192-L4228","documentation":"Error \"You are not authorized to delete this key\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/key_management_endpoints.py:4210 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}