{"record":{"id":"565761ecc6b6bc3a","repo":"BerriAI/litellm","slug":"no-scope-name-associated-with-this-api-key-pass","errorCode":null,"errorMessage":"No {scope_name} associated with this API key; pass a {scope_name} query param","messagePattern":"No (.+?) associated with this API key; pass a (.+?) query param","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/spend_tracking/spend_management_endpoints.py","lineNumber":1615,"sourceCode":"    requested: str | None,\n    caller_value: str | None,\n    scope_name: str,\n) -> str:\n    \"\"\"Return the scope value the caller may query spend for.\n\n    Non-admin callers are clamped to their own identity: a ``requested`` value\n    that differs from ``caller_value`` is a 403. Proxy admins (and admin\n    viewers) may request any scope.\n    \"\"\"\n    if requested:\n        if requested != caller_value and not _is_admin_view_safe(user_api_key_dict=user_api_key_dict):\n            raise HTTPException(\n                status_code=status.HTTP_403_FORBIDDEN,\n                detail=f\"Not authorized to view spend for a {scope_name} other than your own\",\n            )\n        return requested\n    if caller_value is None:\n        raise HTTPException(\n            status_code=status.HTTP_400_BAD_REQUEST,\n            detail=f\"No {scope_name} associated with this API key; pass a {scope_name} query param\",\n        )\n    return caller_value\n\n\nasync def _resolve_org_spend_report_scope(\n    user_api_key_dict: UserAPIKeyAuth,\n    organization_id: str | None,\n    prisma_client: PrismaClient,\n) -> tuple[str, tuple[str, ...]]:\n    \"\"\"Return the organization to report on and the team_ids belonging to it.\n\n    Callable by proxy admins (any organization) and org admins of the target\n    organization; every other caller is a 403 from ``_verify_org_access``.\n    \"\"\"\n    from litellm.proxy.management_endpoints.organization_endpoints import _verify_org_access\n","sourceCodeStart":1597,"sourceCodeEnd":1633,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/spend_tracking/spend_management_endpoints.py#L1597-L1633","documentation":"Error \"No {scope_name} associated with this API key; pass a {scope_name} query param\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/spend_tracking/spend_management_endpoints.py:1615 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the scope (team/org) query param explicitly, or use a key associated with that scope."],"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"}