{"record":{"id":"ff3ef26c93c0f768","repo":"OpenBB-finance/OpenBB","slug":"unauthorized-intrinio-request-message-err","errorCode":null,"errorMessage":"Unauthorized Intrinio request -> {message} -> {error}","messagePattern":"Unauthorized Intrinio request -> (.+?) -> (.+?)","errorType":"exception","errorClass":"UnauthorizedError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/intrinio/openbb_intrinio/models/forward_pe_estimates.py","lineNumber":129,"sourceCode":"                if not results:\n                    raise EmptyDataError(\n                        f\"There were no results found for any of the given symbols. -> {symbols}\"\n                    )\n                return results\n            except Exception as e:\n                raise OpenBBError(\n                    f\"Error in Intrinio request -> {e} -> {symbols}\"\n                ) from e\n\n        async def fetch_callback(response, session):\n            \"\"\"Use callback for pagination.\"\"\"\n            data = await response.json()\n            error = data.get(\"error\", None)\n\n            if error:\n                message = data.get(\"message\", \"\")\n                if \"api key\" in message.lower() or \"view this data\" in error.lower():\n                    raise UnauthorizedError(\n                        f\"Unauthorized Intrinio request -> {message} -> {error}\"\n                    )\n                raise OpenBBError(f\"Error: {error} -> {message}\")\n\n            forward_pe = data.get(\"forward_pe\")\n\n            if forward_pe and len(forward_pe) > 0:  # type: ignore\n                results.extend(forward_pe)  # type: ignore\n\n            return results\n\n        url = f\"{BASE_URL}?page_size=10000&api_key={api_key}\"\n        results = await amake_request(url, response_callback=fetch_callback, **kwargs)  # type: ignore\n\n        if not results:\n            raise EmptyDataError(\"The request was successful but was returned empty.\")\n\n        return results","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/intrinio/openbb_intrinio/models/forward_pe_estimates.py#L111-L147","documentation":"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.","triggerScenarios":"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.","commonSituations":"Free-tier Intrinio keys attempting Zacks endpoints; expired or mis-copied credentials; sandbox vs production key confusion; subscription downgraded.","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."],"exampleFix":"# before\nobb.equity.estimates.forward_pe(symbol='AAPL', provider='intrinio')  # raises UnauthorizedError on free tier\n\n# after\nobb.user.credentials.intrinio_api_key = os.environ['INTRINIO_API_KEY']  # entitled key\ndf = obb.equity.estimates.forward_pe(symbol='AAPL', provider='intrinio').to_df()","handlingStrategy":"validation","validationCode":"import os, urllib.request, json\nkey = os.environ['INTRINIO_API_KEY']\nurl = f'https://api-v2.intrinio.com/zacks/forward_pe/AAPL?api_key={key}'\nwith urllib.request.urlopen(url) as r:  # raises HTTPError on 401/403 entitlement\n    json.load(r)","typeGuard":null,"tryCatchPattern":"from openbb_core.provider.exceptions import UnauthorizedError\ntry:\n    res = obb.equity.estimates.forward_pe(symbol='AAPL', provider='intrinio')\nexcept UnauthorizedError:\n    switch_provider('fmp')  # or prompt for an entitled key","preventionTips":["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"],"tags":["intrinio","auth","entitlement","estimates"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}