{"record":{"id":"a92d038410dd8bb4","repo":"BerriAI/litellm","slug":"no-organization-id-associated-with-this-api-key-p","errorCode":null,"errorMessage":"No organization_id associated with this API key; pass an organization_id query param","messagePattern":"No organization_id associated with this API key; pass an organization_id query param","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/spend_tracking/spend_management_endpoints.py","lineNumber":1636,"sourceCode":"        )\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\n    target_org = organization_id or user_api_key_dict.org_id\n    if target_org is None:\n        raise HTTPException(\n            status_code=status.HTTP_400_BAD_REQUEST,\n            detail=\"No organization_id associated with this API key; pass an organization_id query param\",\n        )\n    await _verify_org_access(\n        organization_id=target_org,\n        user_api_key_dict=user_api_key_dict,\n        prisma_client=prisma_client,\n    )\n    teams = await TeamRepository(prisma_client).find_by_organization_id(organization_id=target_org)\n    return target_org, tuple(team.team_id for team in teams)\n\n\n@router.get(\n    \"/key/spend/report\",\n    tags=(\"Budget & Spend Tracking\",),\n)\nasync def get_key_spend_report(\n    user_api_key_dict: Annotated[UserAPIKeyAuth, Depends(user_api_key_auth)],","sourceCodeStart":1618,"sourceCodeEnd":1654,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/spend_tracking/spend_management_endpoints.py#L1618-L1654","documentation":"Error \"No organization_id associated with this API key; pass an organization_id query param\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/spend_tracking/spend_management_endpoints.py:1636 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass organization_id as a query parameter, or use a key linked to an organization."],"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-14T05:17:10.506Z"}