Short answer: wrap the phrase in double quotes inside q: "best budget mechanical keyboard". In JSON that means escaping the quotes. Google then looks for the words in that order, and you can check the match on every result yourself.
The request
curl -X POST 'https://api.serpbase.dev/google/search' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: YOUR_API_KEY' \
-d '{"q":"\"best budget mechanical keyboard\"","gl":"us","hl":"en","device":"desktop"}'
What came back
We sent the quoted phrase on 2 December 2026 with both layouts and checked whether each result's title or snippet contains it:
| Layout | Organic results | Phrase visible in title or snippet |
|---|---|---|
| desktop | 10 | 9 |
| phone | 10 | 7 |
The desktop page was led by forum threads (Reddit r/buildapc, Tom's Hardware forums, overclock.net) and also carried discussions, inline_videos, shopping_results and an ai_overview. The phone page opened with rtings.com, then nytimes.com and arstechnica.com further down.
The results without the phrase in their visible text were close variants ("budget mechanical keyboards that sound…", "best $50 mechanical keyboard"). Google can match words in the page body that the snippet does not show, so a missing phrase in the snippet is not proof the page lacks it.
Python: build the query safely and verify
import json, requests
phrase = "best budget mechanical keyboard"
r = requests.post(
"https://api.serpbase.dev/google/search",
headers={"X-API-Key": "YOUR_API_KEY"},
json={"q": f'"{phrase}"', "gl": "us", "hl": "en", "device": "desktop"},
timeout=60,
).json()
if r["status"] != 0:
raise SystemExit(r.get("error"))
for item in r.get("organic", []):
text = (item["title"] + " " + (item.get("snippet") or "")).lower()
print("exact" if phrase in text else "close", item["rank"], item["title"])
Letting your HTTP library build the JSON (json= in requests) avoids hand-escaping the quotes.
Things that trip people up
- Escaping. In a shell, the quotes inside
qneed a backslash; in code, let the JSON encoder do it. - Spelling correction. For a rare phrase Google may still "fix" your words. Send
"nfpr":"1"to stop that — see nfpr. - Combine with operators.
"phrase" site:example.comchecks one site;"phrase" -site:example.comfinds everyone else using it. - Layouts differ. Desktop and phone answers are separate pages; compare like with like.
Related
Cost and docs
A Google search is 1 credit, with or without operators. Failed requests are not charged, and new accounts get 500 free credits.
- All response fields: Google Web Search docs
- Try it in the browser: Google Search API
- Credit packs: pricing