{"record":{"id":"a658943988724224","repo":"OpenBB-finance/OpenBB","slug":"unauthorized-biztoc-request-res-message","errorCode":null,"errorMessage":"Unauthorized Biztoc request -> {res['message']}","messagePattern":"Unauthorized Biztoc request -> (.+?)","errorType":"exception","errorClass":"UnauthorizedError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/biztoc/openbb_biztoc/models/world_news.py","lineNumber":97,"sourceCode":"        if params.get(\"start_date\") or params.get(\"end_date\"):\n            warn(\"start_date and end_date are not supported for this endpoint.\")\n        return BiztocWorldNewsQueryParams(**params)\n\n    @staticmethod\n    async def aextract_data(\n        query: BiztocWorldNewsQueryParams,\n        credentials: dict[str, str] | None,\n        **kwargs: Any,\n    ) -> list[dict]:\n        \"\"\"Extract the data from the Biztoc endpoint.\"\"\"\n        # pylint: disable=import-outside-toplevel\n        from openbb_core.provider.utils.helpers import amake_request, make_request\n\n        async def response_callback(response, _):\n            res = await response.json()\n            if isinstance(res, dict) and \"message\" in res:\n                if \"subscribed\" in res[\"message\"].lower():\n                    raise UnauthorizedError(\n                        f\"Unauthorized Biztoc request -> {res['message']}\"\n                    )\n                raise OpenBBError(res[\"message\"])\n\n            return await response.json()\n\n        api_key = credentials.get(\"biztoc_api_key\") if credentials else \"\"\n        headers = {\n            \"X-RapidAPI-Key\": f\"{api_key}\",\n            \"X-RapidAPI-Host\": \"biztoc.p.rapidapi.com\",\n            \"Accept\": \"application/json\",\n            \"Accept-Encoding\": \"gzip\",\n        }\n        base_url = \"https://biztoc.p.rapidapi.com/\"\n        url = \"\"\n        response: list | dict = []\n        if query.term:\n            query.term = query.term.replace(\" \", \"%20\")","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/biztoc/openbb_biztoc/models/world_news.py#L79-L115","documentation":"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.","triggerScenarios":"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...\"}.","commonSituations":"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.","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"],"exampleFix":"// before\nobb.news(provider='biztoc')  # UnauthorizedError\n\n// after\nobb.user.credentials.biztoc_api_key = 'CORRECT_RAPIDAPI_BIZTOC_KEY'\nobb.news(provider='biztoc')","handlingStrategy":"validation","validationCode":"def biztoc_key_ok(key: str) -> bool:\n    import requests\n    r = requests.get('https://biztoc.p.rapidapi.com/news/latest',\n                     headers={'X-RapidAPI-Key': key,\n                              'X-RapidAPI-Host': 'biztoc.p.rapidapi.com'})\n    return r.status_code == 200 and 'message' not in r.json()","typeGuard":null,"tryCatchPattern":"from openbb_core.provider.utils.errors import UnauthorizedError\ntry:\n    news = obb.news(provider='biztoc')\nexcept UnauthorizedError as e:\n    print('Subscribe to Biztoc on RapidAPI and set biztoc_api_key:', e)","preventionTips":["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"],"tags":["biztoc","rapidapi","auth","subscription","news"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}