OpenBB-finance/OpenBB · error · UnauthorizedError
Unauthorized Intrinio request -> {result.get('message')}
Error message
Unauthorized Intrinio request -> {result.get('message')} What it means
Raised inside the async response callback of IntrinioCompanyNewsFetcher when the Intrinio API returns a JSON dict containing an 'error' key whose 'message' mentions 'api key'. It maps the provider response to OpenBB's UnauthorizedError, signaling an authentication failure (missing, malformed, invalid, or insufficient-plan key) rather than a generic API error.
Source
Thrown at openbb_platform/providers/intrinio/openbb_intrinio/models/company_news.py:225
api_key = credentials.get("intrinio_api_key") if credentials else ""
base_url = "https://api-v2.intrinio.com/companies"
ignore = (
["symbol", "page_size", "is_spam"]
if not query.source or query.source == "yahoo"
else ["symbol", "page_size"]
)
query_str = get_querystring(query.model_dump(by_alias=True), ignore)
symbols = query.symbol.split(",") if query.symbol else []
news: list = []
async def callback(response, session):
"""Response callback."""
result = await response.json()
if isinstance(result, dict) and "error" in result:
if "api key" in result.get("message", "").lower():
raise UnauthorizedError(
f"Unauthorized Intrinio request -> {result.get('message')}"
)
raise OpenBBError(f"Error in Intrinio request -> {result}")
symbol = response.url.parts[-2]
_data = result.get("news", [])
data = []
data.extend([{"symbol": symbol, **d} for d in _data])
articles = len(data)
next_page = result.get("next_page")
# query.limit can be None...
limit = query.limit or 2500
while next_page and limit > articles:
url = (
f"{base_url}/{symbol}/news?{query_str}"
+ f"&page_size={query.limit}&api_key={api_key}&next_page={next_page}"
)
result = await get_data(url, session=session, **kwargs)View on GitHub (pinned to 3e071fcc2c)
Solutions
- Set the credential: obb.account.credentials.intrinio_api_key = '<key>' (or the INTRINIO_API_KEY environment variable), then retry
- Verify the key directly: curl 'https://api-v2.intrinio.com/companies/AAPL/news?api_key=<key>' and confirm no error payload
- Check your Intrinio subscription plan includes the News API product
- Catch UnauthorizedError separately from OpenBBError to surface a 'fix your key' message in your app instead of a generic failure
Example fix
# before obb.account.credentials.intrinio_api_key = "" # empty key news = await obb.news.company_news(provider="intrinio", symbol="AAPL").to_df() # after obb.account.credentials.intrinio_api_key = os.environ["INTRINIO_API_KEY"] news = await obb.news.company_news(provider="intrinio", symbol="AAPL").to_df()
Defensive patterns
Strategy: try-catch
Validate before calling
def has_intrinio_key() -> bool:
creds = obb.account.credentials
return bool(getattr(creds, "intrinio_api_key", None)) Type guard
from openbb_core.provider.utils.errors import UnauthorizedError
def is_unauthorized(err: BaseException) -> bool:
return isinstance(err, UnauthorizedError) or "Unauthorized Intrinio request" in str(err) Try / catch
from openbb_core.provider.utils.errors import UnauthorizedError, OpenBBError
try:
news = await obb.news.company_news(provider="intrinio", symbol="AAPL")
except UnauthorizedError as e:
# auth problem: fix credentials, do not retry
raise RuntimeError(f"Check intrinio_api_key: {e}") from e
except OpenBBError:
raise Prevention
- Set intrinio_api_key once at startup and fail fast if missing
- Separate UnauthorizedError from OpenBBError in except clauses
- Smoke-test the key against a cheap Intrinio endpoint on boot
When it happens
Trigger: Any GET to api-v2.intrinio.com .../news with a bad credential: intrinio_api_key not set in credentials, an expired/free key, a typo'd key, or a key whose plan does not include the news endpoint. Detection is substring-based: 'api key' must appear in result['message'].lower().
Common situations: First run after installing the intrinio provider without obb.account credentials; CI environments where the key env var is not exported; key rotated on Intrinio's dashboard but not updated locally; free-tier key hitting a paid endpoint.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- Unauthorized Intrinio request -> {message}
- Unsupported file format. Please use .json or .env files.
- Missing credential '{c}'.{extra_msg} Refer to the documentat
- Invalid username or password.
- {error.get('code', '')} -> {error.get('message', '')}
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/3da8fbb1d2bcf72f.
Report an issue: GitHub.