OpenBB-finance/OpenBB · error · UnauthorizedError

Unauthorized Intrinio request -> {message}

Error message

Unauthorized Intrinio request -> {message}

What it means

UnauthorizedError from the forward sales estimates fetch callback when the Intrinio body error's message contains 'api key'. Identical pattern to the EPS variant: the zacks/forward_sales endpoint rejected the credential, and the provider surfaces it as UnauthorizedError so the router maps it to an auth failure.

Source

Thrown at openbb_platform/providers/intrinio/openbb_intrinio/models/forward_sales_estimates.py:189

            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

        if not results:

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Configure a valid key via obb.user.credentials.intrinio_api_key or INTRINIO_API_KEY.
  2. Validate the key directly: curl 'https://api-v2.intrinio.com/zacks/forward_sales?api_key=KEY'.
  3. Confirm plan entitlement for Zacks estimates data.
  4. Re-enter the key cleanly, avoiding trailing newline.
Defensive patterns

Strategy: validation

Validate before calling

key = os.environ.get('INTRINIO_API_KEY')
if not key or len(key.strip()) < 10:
    raise RuntimeError('INTRINIO_API_KEY missing or obviously malformed')

Try / catch

from openbb_core.provider.exceptions import UnauthorizedError
try:
    res = obb.equity.estimates.forward_sales(symbol=sym, provider='intrinio')
except UnauthorizedError:
    refresh_intrinio_credentials()

Prevention

When it happens

Trigger: equity/estimates/forward_sales with provider='intrinio' with missing/invalid/expired intrinio_api_key, or a key without the Zacks sales estimates entitlement; Intrinio returns body JSON with error plus a message mentioning the API key.

Common situations: Credentials never configured in the OpenBB hub; expired key; free tier; key corrupted by whitespace in env var or config file.

Understand the failure class

Related errors


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