POST /v1/search
Runs a Google search and scrapes each result, returning clean Markdown for every page. One API call gives your LLM full web context for any query.
Cost: 2 credits per result
Request
curl -X POST https://www.webglean.com/v1/search \
-H "Authorization: Bearer wg_your_key" \
-H "Content-Type: application/json" \
-d '{
"query": "best web scraping libraries 2025",
"numResults": 5
}'
Body parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
query | string | required | The search query |
numResults | number | 5 | Number of results to scrape (1–10) |
Response
{
"success": true,
"data": [
{
"url": "https://example.com/scraping-guide",
"title": "Top 10 Web Scraping Libraries in 2025",
"snippet": "A rundown of the best scraping libraries...",
"markdown": "# Top 10 Web Scraping Libraries\n\n...",
"error": null
},
{
"url": "https://another.com/article",
"title": "Web Scraping in Python: Complete Guide",
"snippet": "Everything you need to know about scraping in Python...",
"markdown": null,
"error": "Page failed to load"
}
]
}
If Serper returns zero results for the query, data is an empty array and you are not charged.
Use cases
- Give your LLM current web context before answering a question
- Build a research agent that searches and synthesizes web content
- Monitor competitor mentions across the web
- Gather data from multiple sources in one call
Notes
- Search results come from Google via Serper.dev
- Results are scraped in parallel — total latency is roughly 1 result's scrape time, not N × scrape time
- If a result page fails to scrape, its
markdownisnullanderrorexplains why — it still appears indataand still counts toward your credit charge, since you're charged per search result returned, not per successful scrape - You're only charged for results Serper actually returns, not the
numResultsyou requested — if you ask for 10 and only get 6, you're charged for 6
Errors
| Code | Reason |
|---|---|
401 | Invalid API key |
402 | Insufficient credits for the requested number of results |
429 | Rate limit exceeded |
400 | Missing or empty query |
502 | Search provider (Serper) error |
504 | Search timed out — try again |
500 | Search failed |
WebGlean