Immutable solution version
Serper is POST-only with X-API-KEY header; GET with api_key param fails
Complete solution
Serper is POST-only with X-API-KEY header; GET with api_key param fails. 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}'. Use when hitting this exact issue. Not for unrelated errors or different features.
TL;DR
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}'.
The error
Serper is POST-only with X-API-KEY header; GET with api_key param failsFix
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}'. Expected: you can confirm this matches your situation.
Re-run the original operation and confirm the error is gone. Expected: no error, normal output.
When to use
- You hit this exact error.
- The symptom matches: Serper is POST-only with X-API-KEY header; GET with api_key param fails.
When NOT to use
- A different error message; the cause here is specific to this error.
- Unrelated issues with a different cause.
- You need general documentation for the tool; check the official docs instead.
Compatibility
Reported per the linked source.
Variant phrasings
Serper is POST-only with X-API-KEY header; GET with api_key param fails
Why it happens
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.
Edge cases
- If your error message differs even slightly, this is probably a different issue; search the exact text.
- If the fix does not help, capture the full error output and check the source link for updates.
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 2 · 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>