How to use Serper.dev API for Google search automation
How to use Serper Dev API for Google search automation
Google search data is the raw material behind competitive intelligence, content research, and market monitoring — but scraping Google directly is fragile, slow, and against their terms of service. The Serper Dev API offers a clean alternative: structured Google search results via a simple REST endpoint. At $0.001 per query with a generous free tier, it’s become the go-to choice for developers building search-powered workflows. A 2024 analysis by SimilarWeb found that over 8.5 billion Google searches happen daily — Serper Dev gives you programmatic access to that data stream.
CodeWords pairs naturally with Serper Dev. Build serverless Python workflows that query Google, process results through LLMs, and deliver insights — all deployed through conversation with Cody or through code, with 500+ integrations to route results wherever they need to go.
TL;DR
- Serper Dev provides Google search results as structured JSON — organic results, People Also Ask, knowledge graph, and more
- CodeWords lets you build full search automation pipelines: query → process → analyze → deliver
- Combine Serper Dev with LLMs on CodeWords for automated research, monitoring, and competitive intelligence
Unlike generic AI automation posts, this guide shows real CodeWords workflows — not just theory. You’ll build a working search automation pipeline by the end.
What is Serper Dev and how does it work?
Serper Dev is a Google Search API. You send a search query, it returns structured JSON with organic results, featured snippets, People Also Ask questions, knowledge graph data, images, news, and shopping results. No browser emulation, no proxy management, no HTML parsing.
The API is straightforward:
import requests
response = requests.post(
"https://google.serper.dev/search",
headers={"X-API-KEY": "your-api-key"},
json={"q": "best workflow automation tools 2026"}
)
results = response.json()
You get back structured data: titles, URLs, snippets, positions. Each result includes metadata that would take dozens of lines of scraping code to extract from raw HTML.
Serper Dev supports multiple search types — web, images, news, places, shopping — and parameters for location, language, pagination, and date filtering. This flexibility matters when you’re building workflows that need specific types of search data.
How do you build a search pipeline with CodeWords and Serper Dev?
The architecture follows the same pattern as any AI workflow tool: intake, process, analyze, deliver.
Step 1: Define your queries. Store a list of search queries in Airtable, Google Sheets, or a CodeWords Redis store. Each query includes the search term, search type (web, news, images), location, and frequency (daily, weekly, on-demand).
Step 2: Execute searches. A scheduled CodeWords workflow iterates through your query list, calls the Serper Dev API for each, and stores the raw results. Because CodeWords runs serverless FastAPI microservices, you can process hundreds of queries in a single execution window.
Step 3: Process with AI. Raw search results are data. Intelligence requires interpretation. Send results to OpenAI, Anthropic, or Google Gemini — all accessible on CodeWords without API key setup — to summarize trends, identify competitors, classify content types, or extract specific data points.
Step 4: Deliver insights. Push processed results to Slack channels, email digests, Airtable databases, Google Sheets dashboards, or a generated web UI at *.codewords.run. Use CodeWords’ native integrations for seamless delivery.
Browse CodeWords templates for pre-built search monitoring workflows you can customize.
What are the best use cases for Serper Dev API automation?
Five patterns that consistently deliver value:
Competitive monitoring. Track how competitors appear in search results for your target keywords. A daily CodeWords workflow queries your keyword list, records competitor positions, and surfaces changes in a Slack digest. You’ll know when a competitor launches a new page or drops in visibility — without manually searching.
Content research at scale. Before writing an article, you need to understand what already exists. A CodeWords workflow queries Serper Dev for your target keyword, pulls the top 10 results, scrapes each page using Firecrawl (built into CodeWords’ web scraping capabilities), and generates an AI-powered content brief summarizing what’s covered and what’s missing.
Lead generation. Search for companies matching specific criteria (“SaaS startups hiring remote engineers in Austin”) and extract contact information from the results. Combine with document loaders to process company websites and build enriched prospect profiles.
Brand monitoring. Track mentions of your brand, products, or key personnel across Google web and news results. A 2025 Meltwater report found that 67% of brand-damaging content is discovered by employees browsing — not by monitoring tools. Automated Serper Dev queries catch mentions faster.
Market research. Monitor search trends for product categories, emerging technologies, or industry terms. Aggregate weekly data to identify rising and falling topics. Feed trend data into LLMs for narrative analysis — “what’s changing in this market and why?”
How does Serper Dev compare to other search APIs?
The search API space includes several alternatives. Here’s how they stack up.
Serper Dev — Fastest and cheapest for Google search. $0.001/query, 2,500 free monthly queries. Returns structured JSON with organic, PAA, knowledge graph. Google-only. Simple API, fast response times.
SearchAPI.io — Multi-engine support (Google, Bing, YouTube, Google Maps). More features per query but higher cost. CodeWords integrates with SearchAPI.io natively through its integration layer.
SerpAPI — The original Google search API. Broader feature set, higher price point. Supports Google, Bing, Yahoo, and specialty searches. Better for teams needing multi-engine coverage.
Perplexity API — Not a traditional search API. Returns AI-summarized answers with citations instead of raw search results. Available on CodeWords as a native integration. Best for workflows that need answers, not raw data.
For most search automation workflows, Serper Dev offers the best value. Its speed and pricing make it practical for high-volume, daily monitoring — the kind of workflow that generates compound value over time.
How do you handle rate limits and error management?
Production search workflows need resilience. Serper Dev allows 100 queries per second on paid plans, but your workflow should handle edge cases.
Batch your queries. Instead of firing 500 individual API calls, group queries into batches of 10-20 with brief pauses between batches. CodeWords’ serverless execution handles this naturally — schedule batch processing workflows that run sequentially within a single execution.
Cache results. Store search results in Redis using CodeWords’ built-in state persistence. Before querying, check if you’ve already fetched results for the same query within your freshness window (e.g., 24 hours for daily monitoring, 1 hour for real-time tracking).
Handle failures gracefully. Wrap API calls in retry logic with exponential backoff. Log failures for review. CodeWords workflows include built-in error handling — a failed step doesn’t crash the entire pipeline.
Monitor costs. At $0.001/query, 10,000 queries per month costs $10. But costs can spike if workflows run more frequently than intended. Set up a CodeWords monitoring workflow that tracks your Serper Dev usage and alerts you in Slack when spending exceeds thresholds. Check CodeWords pricing separately for workflow execution costs.
What does a complete Serper Dev workflow look like in CodeWords?
Here’s a practical example: a daily competitive monitoring workflow.
from datetime import datetime
import requests
def monitor_competitors(keywords: list[str], api_key: str):
results = []
for keyword in keywords:
response = requests.post(
"https://google.serper.dev/search",
headers={"X-API-KEY": api_key},
json={"q": keyword, "num": 10}
)
data = response.json()
for item in data.get("organic", []):
results.append({
"keyword": keyword,
"position": item["position"],
"title": item["title"],
"url": item["link"],
"date": datetime.now().isoformat()
})
return results
This runs as a scheduled CodeWords microservice. Results feed into an LLM that generates a daily summary: new competitors, position changes, emerging content gaps. The summary posts to Slack automatically.
For advanced workflows, combine Serper Dev data with AI coding model analysis to evaluate how technical content performs in search results, or connect it to automated social media workflows that share insights.
Frequently asked questions
Is Serper Dev free to use?
Serper Dev offers 2,500 free queries per month. Paid plans start at $50/month for 50,000 queries. For most monitoring and research workflows, the free tier is sufficient to validate your pipeline before scaling.
Can I use Serper Dev for Google News and image search?
Yes. Serper Dev supports web, news, images, places, and shopping search types. Specify the type in your API request. Each type returns structured data specific to that search format.
How fast is the Serper Dev API?
Most queries return in under 1 second. Serper Dev consistently benchmarks as one of the fastest Google search APIs available, which matters for batch processing workflows that execute hundreds of queries.
Is using Serper Dev against Google’s terms of service?
Serper Dev handles compliance on their end — they provide the API as a service. You’re not scraping Google directly. Always review Serper Dev’s terms and ensure your use case aligns with their acceptable use policy.
Search data is infrastructure, not a one-off query
The teams that treat Google search data as a continuous signal — monitoring competitors, tracking trends, feeding AI research pipelines — gain a structural information advantage. Serper Dev makes that data accessible. CodeWords makes it actionable, turning raw search results into processed intelligence delivered exactly where your team needs it.
Build your first search automation workflow on CodeWords and start turning search data into a competitive asset.





