{"record":{"id":"109f9caf3190a093","repo":"assafelovic/gpt-researcher","slug":"getxapi-api-key-not-found-please-set-the-getxapi","errorCode":null,"errorMessage":"GetXAPI API key not found. Please set the GETXAPI_API_KEY environment variable. Get a key at https://getxapi.com","messagePattern":"GetXAPI API key not found\\. Please set the GETXAPI_API_KEY environment variable\\. Get a key at https://getxapi\\.com","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"gpt_researcher/retrievers/getxapi/getxapi.py","lineNumber":28,"sourceCode":"    \"\"\"\n    GetXAPI X/Twitter search retriever.\n\n    Searches tweets via the GetXAPI REST API and returns results in the\n    standard {title, href, body} format used by all GPT Researcher retrievers.\n\n    Set GETXAPI_API_KEY in your environment. Get one at https://getxapi.com\n    \"\"\"\n\n    def __init__(self, query, query_domains=None, **kwargs):\n        self.query = query\n        self.query_domains = query_domains\n        self.api_key = self.get_api_key()\n\n    def get_api_key(self):\n        try:\n            api_key = os.environ[\"GETXAPI_API_KEY\"]\n        except KeyError:\n            raise Exception(\n                \"GetXAPI API key not found. Please set the GETXAPI_API_KEY \"\n                \"environment variable. Get a key at https://getxapi.com\"\n            )\n        return api_key\n\n    def search(self, max_results=10):\n        \"\"\"\n        Search X/Twitter via GetXAPI advanced search.\n\n        Returns:\n            list: Search results as [{title, href, body}, ...]\n        \"\"\"\n        print(f\"Searching X/Twitter with query: {self.query}...\")\n\n        try:\n            results = self._search_tweets(max_results)\n            return results\n        except Exception as e:","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/assafelovic/gpt-researcher/blob/6f998577d547b1e54ec662dac63583aa11e3b84b/gpt_researcher/retrievers/getxapi/getxapi.py#L10-L46","documentation":"Exception raised by the GetXAPI retriever when the GETXAPI_API_KEY environment variable is missing (KeyError caught and re-raised with this message). The key is required to authenticate against the getxapi.com search API.","triggerScenarios":"Instantiating the getxapi retriever, whose __init__ calls get_api_key(), with GETXAPI_API_KEY unset.","commonSituations":"Env var never set, .env file not loaded in the runtime process, or deployment environment missing the injected secret.","solutions":["export GETXAPI_API_KEY=<key> (get one at https://getxapi.com).","Add it to .env / secrets and confirm it loads before creating the retriever.","Verify the variable name spelling in compose/CI configs."],"exampleFix":"# before\nretriever = GetXAPI(query=\"...\")\n\n# after\nimport os\nassert os.environ.get(\"GETXAPI_API_KEY\"), \"Set GETXAPI_API_KEY\"\nretriever = GetXAPI(query=\"...\")","handlingStrategy":"validation","validationCode":"import os\nif not os.environ.get(\"GETXAPI_API_KEY\"):\n    raise SystemExit(\"Set GETXAPI_API_KEY (https://getxapi.com)\")","typeGuard":"null","tryCatchPattern":"try:\n    retriever = GetXAPI(query)\nexcept Exception as e:\n    if \"GETXAPI_API_KEY\" in str(e):\n        sys.exit(str(e))\n    raise","preventionTips":["Preflight-check env vars for chosen retrievers at boot.","Keep retriever credential names in one documented place."],"tags":["getxapi","missing-env-var","api-key","retriever"],"backgroundTag":"missing-env-var","analyzedSha":"6f998577d547b1e54ec662dac63583aa11e3b84b","analyzedAt":"2026-08-28T17:50:07.383Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}