OpenBB-finance/OpenBB · error · UnauthorizedError

Unauthorized Intrinio request -> {message}

Error message

Unauthorized Intrinio request -> {message}

What it means

UnauthorizedError raised inside the pagination callback of the Intrinio forward EPS estimates fetcher when the API response body contains an 'error' key and the accompanying 'message' text contains 'api key' (case-insensitive). It signals that Intrinio rejected the request because the supplied API key is missing, malformed, or lacks entitlement to the zacks/forward_eps endpoint.

Source

Thrown at openbb_platform/providers/intrinio/openbb_intrinio/models/forward_eps_estimates.py:170

            if not data or not isinstance(data, dict) or not data.get("estimates"):
                warn(f"Symbol Error: No data found for {symbol}")
            if isinstance(data, dict) and data.get("estimates"):
                new_data = data.get("estimates")  # type: ignore
                if new_data:
                    results.extend(new_data)

        if symbols:
            await asyncio.gather(*[get_one(symbol) for symbol in symbols])
            return results

        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():
                    raise UnauthorizedError(
                        f"Unauthorized Intrinio request -> {message}"
                    )
                raise OpenBBError(f"Error: {error} -> {message}")

            if data.get("estimates") and len(data.get("estimates")) > 0:  # type: ignore
                results.extend(data.get("estimates"))  # type: ignore
                while data.get("next_page"):  # type: ignore
                    next_page = data["next_page"]  # type: ignore
                    next_url = f"{url}&next_page={next_page}"
                    data = await amake_request(next_url, session=session, **kwargs)
                    if "estimates" in data and len(data.get("estimates")) > 0:  # type: ignore
                        results.extend(data.get("estimates"))  # type: ignore
            return results

        url = f"{BASE_URL}&{query_str}&api_key={api_key}"

        results = await amake_request(url, response_callback=fetch_callback, **kwargs)  # type: ignore

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Set a valid key: `obb.user.credentials.intrinio_api_key = '...'` or export INTRINIO_API_KEY.
  2. Verify the key against Intrinio directly: curl 'https://api-v2.intrinio.com/zacks/forward_eps?api_key=KEY'.
  3. Confirm your Intrinio subscription includes Zacks estimates data; upgrade or switch provider if not.
  4. Check for stray whitespace/newlines in the stored credential.

Example fix

# before - no key configured
obb.equity.estimates.forward_eps(symbol='AAPL', provider='intrinio')

# after
obb.user.credentials.intrinio_api_key = os.environ['INTRINIO_API_KEY']
obb.equity.estimates.forward_eps(symbol='AAPL', provider='intrinio')
Defensive patterns

Strategy: validation

Validate before calling

import os, urllib.request, json
key = os.environ.get('INTRINIO_API_KEY', '')
assert key, 'INTRINIO_API_KEY not set'
# cheap credential probe before the real call
req = urllib.request.Request(f'https://api-v2.intrinio.com/data_point/AAPL/data_point/marketcap?api_key={key}')
with urllib.request.urlopen(req) as r:
    json.load(r)  # raises on auth failure

Try / catch

from openbb_core.provider.exceptions import UnauthorizedError
try:
    res = obb.equity.estimates.forward_eps(symbol='AAPL', provider='intrinio')
except UnauthorizedError as e:
    raise SystemExit(f'Fix Intrinio credentials: {e}') from e

Prevention

When it happens

Trigger: Calling equity/estimates/forward_eps with provider=intrinio while the intrinio_api_key credential is empty, expired, or a free-tier key not entitled to Zacks estimates data; Intrinio returns HTTP 200/4xx with a JSON body like {"error": ..., "message": "...API Key..."} and the callback converts it to UnauthorizedError.

Common situations: No intrinio_api_key set in OpenBB hub credentials or environment; key revoked or past its subscription; free/starter plan without Zacks forward EPS access; key copied with whitespace or truncated.

Understand the failure class

Related errors


AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14). Data as JSON: /api/errors/085d5f47849d98da. Report an issue: GitHub.