{"record":{"id":"49cdac688f6fdc9a","repo":"OpenBB-finance/OpenBB","slug":"the-temporary-econdb-token-could-not-be-retrieved","errorCode":null,"errorMessage":"The temporary EconDB token could not be retrieved. Please try again later or provide your own token. Sign-up at: https://www.econdb.com/ Your IP address may have been flagged by Cloudflare.","messagePattern":"The temporary EconDB token could not be retrieved\\. Please try again later or provide your own token\\. Sign-up at: https://www\\.econdb\\.com/ Your IP address may have been flagged by Cloudflare\\.","errorType":"exception","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/econdb/openbb_econdb/utils/helpers.py","lineNumber":402,"sourceCode":"    if unit == \"trillions\":\n        return 1000000000000\n    return 1\n\n\ndef get_indicator_countries(indicator: str) -> list[str]:\n    \"\"\"Get the list of countries for a given indicator.\"\"\"\n    return INDICATOR_COUNTRIES.get(indicator, [])\n\n\nasync def create_token(use_cache: bool = True) -> str:\n    \"\"\"Create a temporary token for the EconDB API.\"\"\"\n\n    async def _callback(_response, _):\n        \"\"\"Response callback function.\"\"\"\n        try:\n            return await _response.json()\n        except Exception as e:\n            raise OpenBBError(\n                \"The temporary EconDB token could not be retrieved.\"\n                + \" Please try again later or provide your own token.\"\n                + \" Sign-up at: https://www.econdb.com/\"\n                + \" Your IP address may have been flagged by Cloudflare.\"\n            ) from e\n\n    response: dict | list[dict] = {}\n    url = \"https://www.econdb.com/user/create_token/?reset=0\"\n    if use_cache:\n        cache_dir = f\"{get_user_cache_directory()}/http/econdb_indicators_temp_token\"\n        async with CachedSession(\n            cache=SQLiteBackend(cache_dir, expire_after=3600 * 12)\n        ) as session:\n            try:\n                response = await amake_request(\n                    url,\n                    response_callback=_callback,\n                    session=session,  # type: ignore","sourceCodeStart":384,"sourceCodeEnd":420,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/econdb/openbb_econdb/utils/helpers.py#L384-L420","documentation":"create_token fetches a free temporary token from https://www.econdb.com/user/create_token/ so unauthenticated calls can proceed; the response callback tries response.json() and raises OpenBBError when parsing fails. A non-JSON body at this endpoint is almost always a Cloudflare challenge/block page, meaning your IP has been flagged or EconDB is refusing automated token creation.","triggerScenarios":"Any econdb fetcher call (yield_curve, economy/econdb series endpoints) without an econdb_api_key credential while the token endpoint returns HTML — datacenter IPs, VPNs, and high request volume are frequently flagged. The token is cached for 12h, so failures can repeat until the cache entry expires or the block lifts.","commonSituations":"CI runners and cloud servers on shared IPs; aggressive scraping triggering Cloudflare; users who never registered a key relying on the temp-token path.","solutions":["Register at https://www.econdb.com/ and set your own key as the 'econdb_api_key' credential for the provider.","Retry later from the same IP once the Cloudflare flag expires, or from a different network.","Clear the cached token dir (~/.cache/openbb/http/econdb_indicators_temp_token) so a stale bad response is not reused.","Route automated workloads through a residential/office IP instead of a datacenter IP."],"exampleFix":"# before - relies on temp token (Cloudflare-blocked on datacenter IP)\nobb.economy.yield_curve(provider='econdb', country='united_states')\n\n# after - supply your own key once\nobb.user.credentials.put('econdb_api_key', '<your-key-from-econdb.com>')\nobb.economy.yield_curve(provider='econdb', country='united_states')","handlingStrategy":"retry","validationCode":"from openbb_core.app.provider.object import get_credentials  # or read your config\nif not (obb.user.credentials.get('econdb_api_key')):\n    logger.warning('no econdb_api_key set - temp-token path may hit Cloudflare blocks')","typeGuard":null,"tryCatchPattern":"from openbb_core.app.model.obbject import OpenBBError\ntry:\n    res = obb.economy.yield_curve(provider='econdb', country='united_states', use_cache=False)\nexcept OpenBBError as e:\n    if 'temporary EconDB token' in str(e):\n        # register at econdb.com and set your own key, then retry\n        raise RuntimeError('set obb.user.credentials econdb_api_key') from e\n    raise","preventionTips":["Register a free econdb.com account and store econdb_api_key - removes the temp-token dependency.","Pass use_cache=False when retying after a token failure.","Avoid datacenter IPs for token creation; cache the token (12h) instead of re-requesting."],"tags":["auth","cloudflare","rate-limit","econdb","network"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}