# SERP API for multi-engine web search

> Multi-engine search. One ranked list. No flaky scrapers to write.

- Endpoint: `POST https://scrapenest.dev/v1/search`
- Price: 5 credits
- Category: Search & Discovery
- Reference: https://scrapenest.dev/docs#ep-search
- Web page: https://scrapenest.dev/catalog/search
- Updated: 2026-11-04

By default it queries Bing, DuckDuckGo and Brave in parallel (Google joins at `depth: "thorough"` and `"stealth"`, and `depth: "fast"` is Bing alone), dedups by URL, and re-ranks the merged set with an intent-aware scorer. You see one ranked list, not three. Every result carries a relevance score, position, and source attribution.

## The hard part

If you've ever wired a scraper against a public search engine, you know the rhythm: blocked IPs, captchas, rate-limit windows, and a different result schema every other Tuesday. Going broader with multiple engines means multiple parsers to maintain. You ask once and get back one ranked feed.

## SERP API: what you get

- Pin up to 8 of the 13 engines yourself (Google, Bing, DuckDuckGo, Brave, the Bing News and DuckDuckGo News verticals, plus research and code sources) or let `depth` choose the mix.
- Multi-engine attribution: every result lists the engines that surfaced it.
- `time_range=day|week|month|year` for fresh-only results. A dated query drops Bing from the default mix, because Bing's results ignore the date filter.
- Failures don't bill. Cache hits charge 1 credit instead of 5.
- `page=2` returns the next batch with no repeats; a page past the last result is empty and free.
- `topic` picks a vertical: `news` for current articles, `research` for papers with DOIs, `code` for GitHub, Stack Overflow, Hacker News and MDN.

## SERP API use cases

- **Ground an AI agent**: Give a model fresh results in one stable schema: title, URL, snippet, score and the engines that surfaced each URL.
- **Rank tracking and SEO checks**: Run the same query on a schedule, read `position` and `engines`, and page past the first ten with `page`.
- **News and research monitoring**: Use `time_range` or `start_date` for fresh results, `topic: "news"` for current articles and `topic: "research"` for papers.
- **Site-scoped search**: Keep results on the sites you care about with `include_domains` and `exclude_domains`, up to 15 each, or `site:` in the query.

## SERP API quickstart

Install an SDK with `pip install scrapenest` or `npm install scrapenest`, or call the HTTP API directly with your key in the `Authorization: Bearer` header. No key yet? Sign up free at https://scrapenest.dev/signup, verify your email, then create a key in your dashboard.

### Python SDK

```python
import os
from scrapenest import Client

client = Client(os.environ["SCRAPENEST_API_KEY"])
res = client.search("best wireless earbuds 2026", num_results=10, time_range="month")
for hit in res.results:
    print(hit.position, hit.title, hit.url, hit.engines)
```

### Node SDK

```javascript
import { ScrapeNest } from "scrapenest";

const client = new ScrapeNest({ apiKey: process.env.SCRAPENEST_API_KEY });
const res = await client.search({
  query: "best wireless earbuds 2026",
  num_results: 10,
  time_range: "month",
});
for (const hit of res.results) console.log(hit.position, hit.title, hit.url, hit.engines);
```

### curl

```bash
curl -X POST https://scrapenest.dev/v1/search \
  -H "Authorization: Bearer sn_••••" \
  -H "Content-Type: application/json" \
  -d '{
        "query": "best wireless earbuds 2026",
        "num_results": 10,
        "time_range": "month"
      }'
```

### Python (httpx)

```python
import httpx

r = httpx.post(
    "https://scrapenest.dev/v1/search",
    headers={"Authorization": "Bearer sn_••••"},
    json={
        "query": "best wireless earbuds 2026",
        "num_results": 10,
        "time_range": "month",
    },
    timeout=30,
)
r.raise_for_status()
for hit in r.json()["results"]:
    print(hit["title"], hit["url"])
```

### JavaScript (fetch)

```javascript
const r = await fetch("https://scrapenest.dev/v1/search", {
  method: "POST",
  headers: {
    "Authorization": "Bearer sn_••••",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: "best wireless earbuds 2026",
    num_results: 10,
    time_range: "month",
  }),
});
const data = await r.json();
console.log(data.results.length, "hits");
```

### Go

```go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
)

func main() {
    body, _ := json.Marshal(map[string]any{
        "query":       "best wireless earbuds 2026",
        "num_results": 10,
        "time_range":  "month",
    })
    req, _ := http.NewRequest("POST",
        "https://scrapenest.dev/v1/search", bytes.NewReader(body))
    req.Header.Set("Authorization", "Bearer sn_••••")
    req.Header.Set("Content-Type", "application/json")
    resp, err := http.DefaultClient.Do(req)
    if err != nil { panic(err) }
    defer resp.Body.Close()
    var out struct{ Results []map[string]any }
    json.NewDecoder(resp.Body).Decode(&out)
    fmt.Println(len(out.Results), "hits")
}
```

## SERP API request and response

### Request body

```json
{
  "query": "best wireless earbuds 2026",
  "num_results": 10,
  "time_range": "month",
  "language": "en"
}
```

### Response

```json
{
  "query": "best wireless earbuds 2026",
  "results": [
    {
      "position": 1,
      "url": "https://rtings.com/headphones/reviews/best/wireless-earbuds",
      "title": "The 6 Best Wireless Earbuds, Fall 2026",
      "snippet": "Our pick is the Sony WF-1000XM6 …",
      "engine": "duckduckgo",
      "engines": ["brave", "duckduckgo"],
      "score": 0.98,
      "published_at": "2026-10-22T00:00:00Z"
    }
  ],
  "took_ms": 1380,
  "cache_hit": false,
  "credits_charged": 5,
  "unresponsive_engines": [],
  "engine_status": {
    "duckduckgo": { "status": "ok", "results": 10 },
    "brave": { "status": "ok", "results": 10 }
  },
  "partial": false
}
```

Fields with no value are left out of the JSON rather than sent as `null`, so read optional fields defensively.

## SERP API pricing

5 credits per call. Cache hits bill at 1 credit. 0 credits when nothing is delivered. Image results add +5 (bing) / +40 (brave).

- Pair with /v1/search/deep when you need the body text alongside the SERP: one round-trip instead of fanning out fetches yourself.

## SERP API limits

- `query`: 1 to 400 characters. `num_results`: 1 to 50, default 10.
- `page`: 1 to 20. The engines return at most 50 results for one query, so a page past the last result is empty and bills 0.
- `engines`: 1 to 8 of the 13 accepted values. An explicit list is honoured exactly, with no other engine added or retried in its place.
- `timeout_seconds`: 0.1 to 20, default 5 (6 at `thorough` and `stealth`). When no engine answers in time the call returns 200 with `partial: true` and 0 credits.
- `include_domains` and `exclude_domains`: up to 15 each. `country`: an ISO 3166-1 alpha-2 code.
- Rate limits follow your plan, from 30 requests a minute on Free to 600 on Scale.

## SERP API error codes

| HTTP | Code | Meaning |
| --- | --- | --- |
| 422 | `validation_error` | A field is missing or out of range, such as an unknown engine or more than 8 of them; `details[]` names the field. |
| 503 | `upstream_failed` | The engines failed well inside the time budget. Not billed; retry with backoff. |
| 200 (in body) | `search_deadline_exceeded` | Set as `error` when the budget ran out before any engine answered: empty `results`, `partial: true`, 0 credits. |

Every endpoint can also return `401 unauthorized` (missing or wrong key), `402 insufficient_credits` (balance used up), `403 email_not_verified` (an email signup must verify its address before its key works) and `429 rate_limited` or `concurrency_limit_exceeded`. All errors share one JSON envelope; see the [error reference](https://scrapenest.dev/docs#errors).

## SERP API FAQ

### Which search engines does the SERP API use?

At the default `depth: "balanced"`, Bing, DuckDuckGo and Brave run in parallel and their results are merged into one ranked list. `fast` is Bing alone, and `thorough` and `stealth` add Google. A `time_range` drops Bing from the mix. Pass `engines` to choose the sources yourself from the 13 accepted values.

### How much does a search cost?

5 credits per call. A repeat inside the cache window bills 1 credit, and a call that delivers nothing (no results, a page past the last result, or a deadline hit) bills 0. Image results add 5 credits for Bing images and 40 for Brave images, and only when that source returns at least one image.

### Can I get more than 10 results per query?

Yes. `num_results` takes 1 to 50, and `page` (1 to 20) returns the next batch with no repeats. The engines return at most 50 results for one query, so a page past that comes back empty and free.

### Can I search news, papers or code instead of the whole web?

Set `topic`: `news` searches the news vertical, `research` returns papers with DOIs, and `code` adds GitHub, Stack Overflow, Hacker News and MDN to the web engines. Left out, news is blended in automatically when a query reads like a current event, holding at most half of the results.

### Does the response include the page text?

No, this endpoint returns the SERP only: titles, URLs, snippets, scores and engines. The Deep Search API (`/v1/search/deep`) adds the cleaned text of the top pages in the same call, and the AI Answer API writes a cited answer from them.

## Related endpoints

- [Deep Search API for RAG](https://scrapenest.dev/catalog/search-deep.md): `POST /v1/search/deep`. Search plus auto-fetch the top N pages with extracted text. One round-trip for RAG.
- [AI answer API with citations](https://scrapenest.dev/catalog/search-answer.md): `POST /v1/search/answer`. RAG-style. Search, fetch, summarise with numbered [1][2] citations.
- [Web scraping API for any URL](https://scrapenest.dev/catalog/scrape-url.md): `POST /v1/scrape/url`. Point us at a page. We get past the wall and hand back the rendered HTML and clean text.

## Get 1,000 free credits

Every account starts on the Free plan: 1,000 credits a month, no card. Verify your email, then mint an API key and make this call. Sign up at https://scrapenest.dev/signup.
