OpenBB-finance/OpenBB · error · UnauthorizedError
Unauthorized Benzinga request -> {results[0]}
Error message
Unauthorized Benzinga request -> {results[0]} What it means
Raised by Benzinga's shared response_callback when the API returns a single-element list of strings containing 'access denied'. The callback inspects every Benzinga response, and this specific shape is how Benzinga reports credential failures. It is an UnauthorizedError, so the root cause is the API key, not the query.
Source
Thrown at openbb_platform/providers/benzinga/openbb_benzinga/utils/helpers.py:18
"""Benzinga Helpers."""
from openbb_core.app.model.abstract.error import OpenBBError
from openbb_core.provider.utils.errors import UnauthorizedError
async def response_callback(response, _):
"""Response callback."""
# pylint: disable=import-outside-toplevel
results = await response.json()
if (
results
and isinstance(results, list)
and len(results) == 1
and isinstance(results[0], str)
):
if "access denied" in results[0].lower():
raise UnauthorizedError(f"Unauthorized Benzinga request -> {results[0]}")
raise OpenBBError(results[0])
return results
View on GitHub (pinned to 3e071fcc2c)
Solutions
- Set a valid key: obb.user.credentials.benzinga_api_key = 'your_key' (or via the /account credentials UI)
- Confirm the key is active and has remaining quota on the Benzinga developer dashboard
- Verify the key is entitled to the specific endpoint being called (some are tier-gated)
- Retry after quota resets if a rate limit was hit
Example fix
// before obb.news(provider='benzinga') # UnauthorizedError: access denied // after obb.user.credentials.benzinga_api_key = 'VALID_KEY' obb.news(provider='benzinga')
Defensive patterns
Strategy: validation
Validate before calling
async def check_benzinga_key(api_key: str) -> bool:
import requests
r = requests.get('https://api.benzinga.com/api/v2/news',
params={'token': api_key, 'limit': 1})
body = r.json()
return not (isinstance(body, list) and body and 'access denied' in str(body[0]).lower()) Try / catch
from openbb_core.provider.utils.errors import UnauthorizedError
try:
news = obb.news(provider='benzinga')
except UnauthorizedError as e:
raise SystemExit('Fix benzinga_api_key: ' + str(e)) from e Prevention
- Validate the Benzinga token with a one-off request at startup
- Store the key via obb.user.credentials, never hardcoded
- Track quota on the Benzinga dashboard for scheduled jobs
When it happens
Trigger: Any Benzinga provider call (news, ratings, price targets, etc.) where the api_key is missing, expired, out of credits, or not entitled to the requested endpoint; the response body is e.g. ["Access denied for user"] which the callback converts into this error.
Common situations: Key not set in OpenBB credentials (obb.user.credentials.benzinga_api_key), a trial key that lapsed, exceeding the request quota, or requesting a premium endpoint on a basic plan.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- [Error] -> {e}
- No ratings data returned.
- Unexpected data format. Expected 'analyst_ratings_analyst' k
- Unexpected data format. Expected dict, got: {type(data).__na
- The request was returned empty.
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/b0420c7a02bc6e73.
Report an issue: GitHub.