Immutable solution version
Serper is POST-only with X-API-KEY header; GET with api_key param fails
Complete solution
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.
Call Serper with POST and a JSON body, always. curl -X POST https://google.serper.dev/search -H "X-API-KEY - $SERPERAPIKEY" -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.
Evidence
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 ?apikey [your value] fail here. Resolved: Call Serper with POST and a JSON body, always. curl -X POST https://google.serper.dev/search -H "X-API-KEY - $SERPERAPI_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. Source: https://rramos.github.io/2024/06/13/serper/
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_73TxLG-pM_ZjZ6-50K699Q" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Serper is POST-only with X-API-KEY header; GET with api_key param fails <span>— Vectle</span></a>