SerpApi Search
Search any engine via a single REST endpoint. Each API call costs one search credit.
Important: Always use Bash(curl ...) to call the SerpApi REST API. Do not use WebFetch, WebSearch, or any other HTTP tool.
Setup
The API key must be set as an environment variable:
export SERPAPI_API_KEY="your_key_here"
If SERPAPI_API_KEY is not set, tell the user:
Set your SerpApi API key: export SERPAPI_API_KEY="your_key" — get one free at https://serpapi.com/manage-api-key
API Pattern
Every search follows the same pattern regardless of engine:
curl -s "https://serpapi.com/search.json?engine=ENGINE&QUERY_PARAM=QUERY&api_key=$SERPAPI_API_KEY"
The only things that vary per engine are:
- The
engine value
- The query parameter name (
q, k, query, etc.)
- Engine-specific optional parameters
Engine Selection
Pick the engine based on user intent:
Default to google_light for general web searches — it's faster and cheaper than google. Use google only when you need knowledge graph, ads, or advanced SERP features.
Engine Parameters
Each engine has its own parameters documented in a JSON schema file at engines/<engine_name>.json relative to this plugin's root directory. Read the relevant file when you need engine-specific parameter details.
The JSON schema structure:
params: engine-specific parameters (query, filters, pagination, etc.)
common_params: shared SerpApi parameters (api_key, device, no_cache, etc.)
- Each param has
description, optional required, type, options, and group fields.
Common Parameters
These work across most engines:
| Param |
Description |
location |
Search origin (city-level recommended). E.g., Austin, Texas, United States |
gl |
Country code. E.g., us, uk, fr |
hl |
Language code. E.g., en, es, de |
device |
desktop (default), tablet, or mobile |
no_cache |
true to force fresh results (costs a credit; cached results are free) |
num |
Number of results (where supported) |
start / page |
Pagination. Google uses start (0, 10, 20...), Amazon/Walmart use page (1, 2, 3...) |
json_restrictor |
Restrict response fields for smaller payloads. E.g., organic_results.title,organic_results.link |
Response Handling
SerpApi returns structured JSON. Key top-level fields vary by engine:
- Web search:
organic_results, knowledge_graph, answer_box, related_questions, local_results
- Shopping:
shopping_results or organic_results (with price, rating, etc.)
- Maps:
local_results (with address, rating, GPS coordinates, phone)
- Scholar:
organic_results (with citation_id, cited_by count, PDF links)
- News:
news_results
- Images:
images_results
- Flights:
best_flights, other_flights, price_insights
- Jobs:
jobs_results
- Finance:
summary, financials, graph
Always summarize results for the user. Never dump raw JSON unless explicitly asked.
Use json_restrictor to reduce response size when you only need specific fields.
Multi-Engine Comparison
For price comparisons or cross-engine research, query multiple engines sequentially:
# Compare prices across Amazon, Walmart, and Google Shopping
curl -s "https://serpapi.com/search.json?engine=amazon&k=airpods+pro&api_key=$SERPAPI_API_KEY"
curl -s "https://serpapi.com/search.json?engine=walmart&query=airpods+pro&api_key=$SERPAPI_API_KEY"
curl -s "https://serpapi.com/search.json?engine=google_shopping&q=airpods+pro&api_key=$SERPAPI_API_KEY"
Consolidate and compare the results for the user.
Rules
- Always use
curl via Bash. Never use WebFetch, WebSearch, or other HTTP tools. The allowed-tools header restricts this skill to Bash(curl *) and Read.
- Confirm before searching when the query or engine choice is ambiguous. Each non-cached call costs one credit.
- Show the curl command before executing so the user sees exactly what's being called.
- Prefer
google_light over google for simple web searches.
- Use
no_cache=false (the default) to benefit from free cached results.
- URL-encode query parameters properly. Spaces become
+ or %20.
- Read the engine schema from
engines/<engine>.json when you need to look up available parameters for a specific engine.
Additional Resources
1---2name: search3description: Search Google, Bing, Amazon, Walmart, YouTube, Google Maps, Google Scholar, and 100+ other engines via the SerpApi REST API. Calls the API using curl. Use when the user wants to search the web, find products or prices, look up local businesses, research academic papers, check news, find jobs, compare flights or hotels, analyze SERPs, or retrieve any search engine results.4---56# SerpApi Search78Search any engine via a single REST endpoint. Each API call costs one search credit.910**Important:** Always use `Bash(curl ...)` to call the SerpApi REST API. Do not use WebFetch, WebSearch, or any other HTTP tool.1112## Setup1314The API key must be set as an environment variable:1516```bash17export SERPAPI_API_KEY="your_key_here"18```1920If `SERPAPI_API_KEY` is not set, tell the user:21> Set your SerpApi API key: `export SERPAPI_API_KEY="your_key"` — get one free at https://serpapi.com/manage-api-key2223## API Pattern2425Every search follows the same pattern regardless of engine:2627```bash28curl -s "https://serpapi.com/search.json?engine=ENGINE&QUERY_PARAM=QUERY&api_key=$SERPAPI_API_KEY"29```3031The only things that vary per engine are:321. The `engine` value332. The query parameter name (`q`, `k`, `query`, etc.)343. Engine-specific optional parameters3536## Engine Selection3738Pick the engine based on user intent:3940| Intent | Engine | Query param | Docs |41|--------|--------|-------------|------|42| **Web search** | `google_light` | `q` | https://serpapi.com/google-light-api |43| Web search (full features) | `google` | `q` | https://serpapi.com/search-api |44| Bing search | `bing` | `q` | https://serpapi.com/bing-search-api |45| DuckDuckGo search | `duckduckgo` | `q` | https://serpapi.com/duckduckgo-search-api |46| Yahoo search | `yahoo` | `p` | https://serpapi.com/yahoo-search-api |47| Yandex search | `yandex` | `text` | https://serpapi.com/yandex-search-api |48| Baidu search | `baidu` | `q` | https://serpapi.com/baidu-search-api |49| **AI search** | `google_ai_mode` | `q` | https://serpapi.com/google-ai-mode-api |50| AI overview | `google_ai_overview` | `q` | https://serpapi.com/google-ai-overview-api |51| Bing Copilot | `bing_copilot` | `q` | https://serpapi.com/bing-copilot-api |52| Brave AI | `brave_ai_mode` | `q` | https://serpapi.com/brave-ai-mode-api |53| **Amazon products** | `amazon` | `k` | https://serpapi.com/amazon-search-api |54| Walmart products | `walmart` | `query` | https://serpapi.com/walmart-search-api |55| eBay products | `ebay` | `_nkw` | https://serpapi.com/ebay-search-api |56| Google Shopping | `google_shopping` | `q` | https://serpapi.com/google-shopping-api |57| Home Depot | `home_depot` | `q` | https://serpapi.com/home-depot-search-api |58| **Google Maps / local** | `google_maps` | `q` | https://serpapi.com/google-maps-api |59| Google Local | `google_local` | `q` | https://serpapi.com/google-local-api |60| Yelp | `yelp` | `find_desc` | https://serpapi.com/yelp-search-api |61| TripAdvisor | `tripadvisor` | `q` | https://serpapi.com/tripadvisor-search-api |62| OpenTable reviews | `open_table_reviews` | `restaurant_id` | https://serpapi.com/open-table-reviews-api |63| **Google Scholar** | `google_scholar` | `q` | https://serpapi.com/google-scholar-api |64| Google Patents | `google_patents` | `q` | https://serpapi.com/google-patents-api |65| **Google News** | `google_news` | `q` | https://serpapi.com/google-news-api |66| Google Trends | `google_trends` | `q` | https://serpapi.com/google-trends-api |67| **Google Images** | `google_images` | `q` | https://serpapi.com/google-images-api |68| Google Videos | `google_videos` | `q` | https://serpapi.com/google-videos-api |69| Google Lens | `google_lens` | `url` | https://serpapi.com/google-lens-api |70| YouTube | `youtube` | `search_query` | https://serpapi.com/youtube-search-api |71| **Google Flights** | `google_flights` | (see params) | https://serpapi.com/google-flights-api |72| Google Hotels | `google_hotels` | `q` | https://serpapi.com/google-hotels-api |73| Google Travel | `google_travel_explore` | (see params) | https://serpapi.com/google-travel-explore-api |74| **Google Jobs** | `google_jobs` | `q` | https://serpapi.com/google-jobs-api |75| **Google Finance** | `google_finance` | `q` | https://serpapi.com/google-finance-api |76| Google Play | `google_play` | `q` | https://serpapi.com/google-play-api |77| Apple App Store | `apple_app_store` | `term` | https://serpapi.com/apple-app-store |78| **Google Autocomplete** | `google_autocomplete` | `q` | https://serpapi.com/google-autocomplete-api |79| Naver | `naver` | `query` | https://serpapi.com/naver-search-api |8081**Default to `google_light` for general web searches** — it's faster and cheaper than `google`. Use `google` only when you need knowledge graph, ads, or advanced SERP features.8283## Engine Parameters8485Each engine has its own parameters documented in a JSON schema file at `engines/<engine_name>.json` relative to this plugin's root directory. Read the relevant file when you need engine-specific parameter details.8687The JSON schema structure:88- `params`: engine-specific parameters (query, filters, pagination, etc.)89- `common_params`: shared SerpApi parameters (api_key, device, no_cache, etc.)90- Each param has `description`, optional `required`, `type`, `options`, and `group` fields.9192## Common Parameters9394These work across most engines:9596| Param | Description |97|-------|-------------|98| `location` | Search origin (city-level recommended). E.g., `Austin, Texas, United States` |99| `gl` | Country code. E.g., `us`, `uk`, `fr` |100| `hl` | Language code. E.g., `en`, `es`, `de` |101| `device` | `desktop` (default), `tablet`, or `mobile` |102| `no_cache` | `true` to force fresh results (costs a credit; cached results are free) |103| `num` | Number of results (where supported) |104| `start` / `page` | Pagination. Google uses `start` (0, 10, 20...), Amazon/Walmart use `page` (1, 2, 3...) |105| `json_restrictor` | Restrict response fields for smaller payloads. E.g., `organic_results.title,organic_results.link` |106107## Response Handling108109SerpApi returns structured JSON. Key top-level fields vary by engine:110111- **Web search**: `organic_results`, `knowledge_graph`, `answer_box`, `related_questions`, `local_results`112- **Shopping**: `shopping_results` or `organic_results` (with price, rating, etc.)113- **Maps**: `local_results` (with address, rating, GPS coordinates, phone)114- **Scholar**: `organic_results` (with citation_id, cited_by count, PDF links)115- **News**: `news_results`116- **Images**: `images_results`117- **Flights**: `best_flights`, `other_flights`, `price_insights`118- **Jobs**: `jobs_results`119- **Finance**: `summary`, `financials`, `graph`120121Always summarize results for the user. Never dump raw JSON unless explicitly asked.122123Use `json_restrictor` to reduce response size when you only need specific fields.124125## Multi-Engine Comparison126127For price comparisons or cross-engine research, query multiple engines sequentially:128129```bash130# Compare prices across Amazon, Walmart, and Google Shopping131curl -s "https://serpapi.com/search.json?engine=amazon&k=airpods+pro&api_key=$SERPAPI_API_KEY"132curl -s "https://serpapi.com/search.json?engine=walmart&query=airpods+pro&api_key=$SERPAPI_API_KEY"133curl -s "https://serpapi.com/search.json?engine=google_shopping&q=airpods+pro&api_key=$SERPAPI_API_KEY"134```135136Consolidate and compare the results for the user.137138## Rules1391401. **Always use `curl` via Bash.** Never use WebFetch, WebSearch, or other HTTP tools. The `allowed-tools` header restricts this skill to `Bash(curl *)` and `Read`.1412. **Confirm before searching** when the query or engine choice is ambiguous. Each non-cached call costs one credit.1423. **Show the curl command** before executing so the user sees exactly what's being called.1434. **Prefer `google_light`** over `google` for simple web searches.1445. **Use `no_cache=false`** (the default) to benefit from free cached results.1456. **URL-encode query parameters** properly. Spaces become `+` or `%20`.1467. **Read the engine schema** from `engines/<engine>.json` when you need to look up available parameters for a specific engine.147148## Additional Resources149150- For practical curl examples, see [examples.md](examples.md)151- Interactive playground: https://serpapi.com/playground152- Full API docs: https://serpapi.com/search-api153- Account & usage: https://serpapi.com/account-api