OpenBB-finance/OpenBB · error · UnauthorizedError
Unauthorized Biztoc request -> {res['message']}
Error message
Unauthorized Biztoc request -> {res['message']} What it means
Raised by the Biztoc world_news response_callback when the RapidAPI response is a dict containing a 'message' key whose text includes 'subscribed'. Biztoc signals subscription/plan problems through this message field, and the callback maps it to UnauthorizedError. Root cause is the RapidAPI key's Biztoc subscription, not the query parameters.
Source
Thrown at openbb_platform/providers/biztoc/openbb_biztoc/models/world_news.py:97
if params.get("start_date") or params.get("end_date"):
warn("start_date and end_date are not supported for this endpoint.")
return BiztocWorldNewsQueryParams(**params)
@staticmethod
async def aextract_data(
query: BiztocWorldNewsQueryParams,
credentials: dict[str, str] | None,
**kwargs: Any,
) -> list[dict]:
"""Extract the data from the Biztoc endpoint."""
# pylint: disable=import-outside-toplevel
from openbb_core.provider.utils.helpers import amake_request, make_request
async def response_callback(response, _):
res = await response.json()
if isinstance(res, dict) and "message" in res:
if "subscribed" in res["message"].lower():
raise UnauthorizedError(
f"Unauthorized Biztoc request -> {res['message']}"
)
raise OpenBBError(res["message"])
return await response.json()
api_key = credentials.get("biztoc_api_key") if credentials else ""
headers = {
"X-RapidAPI-Key": f"{api_key}",
"X-RapidAPI-Host": "biztoc.p.rapidapi.com",
"Accept": "application/json",
"Accept-Encoding": "gzip",
}
base_url = "https://biztoc.p.rapidapi.com/"
url = ""
response: list | dict = []
if query.term:
query.term = query.term.replace(" ", "%20")View on GitHub (pinned to 3e071fcc2c)
Solutions
- Subscribe to Biztoc on RapidAPI and use that product's key
- Set the key: obb.user.credentials.biztoc_api_key = 'your_rapidapi_key'
- Verify the subscription tier supports the endpoint (free vs premium feeds)
- Test the key with a direct curl to biztoc.p.rapidapi.com to isolate OpenBB from RapidAPI
Example fix
// before obb.news(provider='biztoc') # UnauthorizedError // after obb.user.credentials.biztoc_api_key = 'CORRECT_RAPIDAPI_BIZTOC_KEY' obb.news(provider='biztoc')
Defensive patterns
Strategy: validation
Validate before calling
def biztoc_key_ok(key: str) -> bool:
import requests
r = requests.get('https://biztoc.p.rapidapi.com/news/latest',
headers={'X-RapidAPI-Key': key,
'X-RapidAPI-Host': 'biztoc.p.rapidapi.com'})
return r.status_code == 200 and 'message' not in r.json() Try / catch
from openbb_core.provider.utils.errors import UnauthorizedError
try:
news = obb.news(provider='biztoc')
except UnauthorizedError as e:
print('Subscribe to Biztoc on RapidAPI and set biztoc_api_key:', e) Prevention
- Confirm the RapidAPI key is subscribed specifically to the Biztoc product
- Smoke-test RapidAPI keys at app startup before batch fetching
- Keep keys per-product; RapidAPI keys are not cross-product
When it happens
Trigger: Calling obb.news(provider='biztoc') with a missing or invalid X-RapidAPI-Key, a key not subscribed to Biztoc on RapidAPI, or a free-tier key hitting a premium endpoint; the API replies {"message": "You are not subscribed to this plan..."}.
Common situations: Developer forgot to subscribe to Biztoc on RapidAPI marketplace (keys are per-product), copied a key from another RapidAPI product, or the subscription expired/downgraded.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- {query.source} not a valid source. Valid sources: {sources}
- [Error] -> {e}
- The request was returned empty.
- Unauthorized Benzinga request -> {results[0]}
- {error.get('code', '')} -> {error.get('message', '')}
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/a658943988724224.
Report an issue: GitHub.