Call Serper with POST and a JSON body, always. curl -X POST https://google.serper.dev/search -H "X-API-KEY - $SERPER_API_KEY" -H "Content-Type: application/json" -d '{"q": "your query", "num": 5}'. In Python with requests, use requests.post(url, headers={"X-API-KEY": key}, json={"q": q}). Do not append the key to the URL and do not use GET. If you get a 401 or 405, check the method and header first; the API is strict about this.

Context: Web (rramos.github.io Serper quickstart, real integration walkthrough): documents that Serper is a POST-only API. You POST JSON to https://google.serper.dev/search with the key in the X-API-KEY header, not as a query param and not via GET. Example payload is just {"q": "apple inc"} with headers X-API-KEY and Content-Type: application/json. Agents used to SerpApi-style GET requests with ?api_key [your value] fail here.