OpenBB-finance/OpenBB · error · UnauthorizedError
Unauthorized Intrinio request -> {message} -> {error}
Error message
Unauthorized Intrinio request -> {message} -> {error} What it means
UnauthorizedError raised in the forward P/E fetch callback when the Intrinio response body carries an 'error' key and either the message mentions 'api key' or the error text itself contains 'view this data'. The second condition catches Intrinio's entitlement errors ('You do not have permission to view this data'), so this fires for both invalid keys and keys whose plan lacks the Zacks forward P/E feed.
Source
Thrown at openbb_platform/providers/intrinio/openbb_intrinio/models/forward_pe_estimates.py:129
if not results:
raise EmptyDataError(
f"There were no results found for any of the given symbols. -> {symbols}"
)
return results
except Exception as e:
raise OpenBBError(
f"Error in Intrinio request -> {e} -> {symbols}"
) from e
async def fetch_callback(response, session):
"""Use callback for pagination."""
data = await response.json()
error = data.get("error", None)
if error:
message = data.get("message", "")
if "api key" in message.lower() or "view this data" in error.lower():
raise UnauthorizedError(
f"Unauthorized Intrinio request -> {message} -> {error}"
)
raise OpenBBError(f"Error: {error} -> {message}")
forward_pe = data.get("forward_pe")
if forward_pe and len(forward_pe) > 0: # type: ignore
results.extend(forward_pe) # type: ignore
return results
url = f"{BASE_URL}?page_size=10000&api_key={api_key}"
results = await amake_request(url, response_callback=fetch_callback, **kwargs) # type: ignore
if not results:
raise EmptyDataError("The request was successful but was returned empty.")
return resultsView on GitHub (pinned to 3e071fcc2c)
Solutions
- Set a valid entitled key: obb.user.credentials.intrinio_api_key = '...' or INTRINIO_API_KEY env var.
- curl the endpoint directly with your key to see the raw Intrinio permission message.
- Upgrade the Intrinio plan to one that includes Zacks estimates, or use another provider.
- Re-check the key for truncation/whitespace.
Example fix
# before obb.equity.estimates.forward_pe(symbol='AAPL', provider='intrinio') # raises UnauthorizedError on free tier # after obb.user.credentials.intrinio_api_key = os.environ['INTRINIO_API_KEY'] # entitled key df = obb.equity.estimates.forward_pe(symbol='AAPL', provider='intrinio').to_df()
Defensive patterns
Strategy: validation
Validate before calling
import os, urllib.request, json
key = os.environ['INTRINIO_API_KEY']
url = f'https://api-v2.intrinio.com/zacks/forward_pe/AAPL?api_key={key}'
with urllib.request.urlopen(url) as r: # raises HTTPError on 401/403 entitlement
json.load(r) Try / catch
from openbb_core.provider.exceptions import UnauthorizedError
try:
res = obb.equity.estimates.forward_pe(symbol='AAPL', provider='intrinio')
except UnauthorizedError:
switch_provider('fmp') # or prompt for an entitled key Prevention
- Verify Zacks entitlement with one direct curl before building on the endpoint
- Distinguish key-invalid vs plan-limited: both raise here
- Persist an entitled key in hub credentials
- Monitor for subscription expirations
When it happens
Trigger: equity/estimates/forward_pe with provider='intrinio' using an invalid/expired key (message contains 'api key'), or a valid key on a plan without Zacks data access (error contains 'view this data'); Intrinio returns the error JSON in the body and the callback raises before parsing forward_pe.
Common situations: Free-tier Intrinio keys attempting Zacks endpoints; expired or mis-copied credentials; sandbox vs production key confusion; subscription downgraded.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- Unauthorized Intrinio request -> {message}
- Unauthorized Intrinio request -> {message}
- No results were found. -> {query.symbol}
- Unauthorized Intrinio request -> {message}
- Error: {error} -> {message}
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/ff3ef26c93c0f768.
Report an issue: GitHub.