# SERP API

> URL: https://foura.ai/docs/api/serp
> Updated: 2026-11-30
> Index: https://foura.ai/llms.txt

`POST /api/serp` runs a Google search and returns the result page as JSON: the organic results with the addresses they lead to, Google's AI Overview, ads, and the other blocks on the page. Your plan counts searches, not credits, and a failed search counts nothing.

## Request

`POST https://eu.api.foura.ai/api/serp`

Send your API key in the `X-API-Key` header, the same key the other endpoints take. See [Authentication](https://foura.ai/docs/getting-started/authentication).

```bash
curl -X POST https://eu.api.foura.ai/api/serp \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  --max-time 90 \
  -d '{"q": "coffee grinder", "country": "us", "language": "en", "timeout_ms": 85000}'
```

`--max-time 90` and `timeout_ms: 85000` follow the advice in [Timing and Timeouts](#timing-and-timeouts). A first search for a query takes tens of seconds, so set both.

### Request Fields

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `q` | string | Yes | - | The search, as you'd type it into Google, operators included (`site:`, quotes, `after:`). 1 to 2,048 characters. Alias: `query`. |
| `country` | string | No | `us` | Two-letter country code (ISO 3166-1), any case. The search is made from that country, and Google gets the code as `gl`. `uk` is accepted for the United Kingdom and comes back as `gb`. Alias: `gl`. |
| `language` | string | No | `en` | Language code such as `en`, `de` or `pt-BR`, sent to Google as `hl`. Alias: `hl`. |
| `page` | integer | No | `1` | Which page of results, `1` to `10`. Page 2 starts at the 11th result. |
| `filter` | integer | No | `1` | Google's similar-results filter. `1` hides results very similar to ones already shown, as Google does by default. `0` includes them, which often reaches pages that `1` leaves empty. `"0"` and `"1"` work as strings too. |
| `freshness` | string | No | - | Only results from the past `hour`, `day`, `week`, `month` or `year`. |
| `verbatim` | boolean | No | `false` | Search the words exactly as typed (Google's Verbatim). Alias: `strictQuery`. |
| `tbs` | string | No | - | Google's own `tbs` codes, for example `qdr:w2`, `li:1` or a date range `cdr:1,cd_min:1/1/2026,cd_max:1/31/2026` (month/day/year), merged with `freshness` and `verbatim`. Letters, digits and `_` `:` `.` `,` `-` `/` only, up to 200 characters. |
| `surface` | string | No | `all` | `all` is Google's All tab. `web` is Google's Web tab, which carries organic results and ads only. |
| `udm` | string | No | - | Google's view number, sent as `udm`, for example `14`. Overrides `surface`. A number works too. |
| `timeout_ms` | integer | No | `120000` | Time budget for the whole search in milliseconds, `30000` to `170000`. |
| `ai_overview` | boolean | No | `true` | Return Google's AI Overview when the page has one. `false` leaves it out and saves a few seconds on pages where Google loads the overview late. `search_information.ai_overview_state` still comes back. |
| `html` | boolean | No | `false` | Also return the result page as Google served it, in `html`. |
| `boost` | integer | No | `1` | `2` gets the result addresses faster and counts as two searches. `1` counts one. See [What Counts as a Search](#what-counts-as-a-search). |
| `exitState` | string | No | - | Narrows where the search is made from to a region of `country`. |
| `exitCity` | string | No | - | Narrows where the search is made from to a city of `country`. |
| `exitAsn` | string | No | - | Narrows where the search is made from to a network, by AS number, digits only (for example `8866`). A number works too. |
| `exitOs` | string | No | - | The kind of device the search is made from: `windows`, `android`, `ios` or `mac`. |

`exitState` and `exitCity` take one word each (letters, digits, `_` or `.`), the same words the Playground's SERP tab lists for each country. If FourA can't search from the place you name, the search fails and counts nothing.

Fields the API doesn't know are ignored. When you send both a name and its alias (`q` and `query`, say), the name wins.

### Controls Google Can't Combine

Google applies Verbatim or a time filter, never both. When you ask for both (`verbatim` or `li:1`, with `freshness` or a `qdr:` code), the time filter travels inside the query as `after:<date>`, counted in whole days back from today (UTC). `search_parameters.google_q` shows the query Google received.

These combinations are refused with a 400 instead of quietly dropping one control:

- Verbatim with the past hour (`freshness: "hour"` or `qdr:h`), which has no date form.
- Verbatim with two time filters at once.
- Verbatim with a time filter, on a query that already contains `after:`.
- Verbatim with a date range (`cdr:1` with `cd_min` or `cd_max`).
- A date range with another time filter (`freshness` or a `qdr:` code).

## Response

The HTTP status of an `/api/serp` response is the search's outcome: 200 for an answer, the error's own code otherwise (see [Errors](#errors)). A `status` in the body always carries the same number. Single, Proxy and Auto work differently: they answer HTTP 200 and carry the outcome in the body.

```json
{
  "status": 200,
  "search_parameters": {
    "q": "coffee grinder",
    "country": "us",
    "language": "en",
    "page": 1,
    "filter": 1,
    "boost": 1
  },
  "search_metadata": {
    "id": "8f3e2a14-7b6c-4d1a-9e2f-5a3b8c1d4e7f",
    "took_ms": 54210,
    "session": "reused",
    "attempts": 1,
    "credits": 0,
    "google_url": "https://www.google.com/search?q=coffee+grinder&hl=en&gl=us"
  },
  "search_information": {
    "organic_results_state": "results",
    "next_page": 2,
    "google_has_next": true,
    "end_reason": null,
    "omitted_similar_results": false,
    "links_unresolved": 0,
    "ai_overview_state": "present"
  },
  "ai_overview": {
    "text_blocks": [
      {
        "type": "paragraph",
        "text": "A burr grinder crushes beans between two plates, which gives a more even grind than a blade grinder.",
        "citations": [
          {
            "source": "Example Coffee",
            "link": "https://www.example.org/burr-vs-blade",
            "redirect_link": "https://www.google.com/...",
            "more_sources": 0,
            "sources": [
              {
                "source": "Example Coffee",
                "title": "Burr vs. Blade Grinders",
                "snippet": "...",
                "link": "https://www.example.org/burr-vs-blade",
                "redirect_link": "https://www.google.com/...",
                "cited": true
              }
            ],
            "sources_complete": true
          }
        ]
      }
    ],
    "sources": [
      {
        "source": "Example Coffee",
        "title": "Burr vs. Blade Grinders",
        "snippet": "...",
        "link": "https://www.example.org/burr-vs-blade",
        "redirect_link": "https://www.google.com/...",
        "cited": true
      }
    ],
    "citations_complete": true,
    "truncated": false,
    "loaded": "in_page",
    "links_unresolved": 0
  },
  "organic_results": [
    {
      "position": 1,
      "title": "The Best Coffee Grinders, Tested",
      "link": "https://www.example.com/reviews/coffee-grinders",
      "redirect_link": "https://www.google.com/...",
      "displayed_link": "https://www.example.com › reviews › coffee-grinders",
      "source": "Example Reviews",
      "snippet": "We ground the same beans in 20 burr and blade grinders ...",
      "date": "Oct 14, 2026",
      "page_position": 1
    }
  ],
  "ads": [],
  "shopping_ads": [],
  "related_searches": ["best burr coffee grinder", "coffee grinder for espresso"],
  "people_also_ask": ["Is a burr grinder worth it?"],
  "local_results": [],
  "knowledge_graph": null,
  "top_stories": []
}
```

### Top-Level Fields

| Field | Type | Description |
|-------|------|-------------|
| `status` | integer | `200` for an answer. The HTTP status carries the same number. |
| `search_parameters` | object | The request as applied. `q`, `country`, `language`, `page`, `filter` and `boost` always; `freshness`, `verbatim`, `surface` and `ai_overview` when they differ from the default; the four place fields when you send them; `tbs`, `udm` and `google_q` when your controls produced them. `boost` is the value you sent, so you can reconcile each search. |
| `search_metadata` | object | `id` is the request ID, the same as the `X-FourA-Request-Id` header. `took_ms` is how long the search took. `google_url` is the Google search the request maps to. `session` (`reused`, `new` or `none`) and `attempts` are for support. `credits` is `0`, like the `X-FourA-Credits` header, because a search is counted in searches. |
| `search_information` | object | Facts about this page of results. See [Search Information](#search-information). |
| `organic_results` | array | The results, in Google's order. Empty when Google found nothing or answered another query. See [Organic Result](#organic-result). |
| `rewritten_query_results` | array | Present only when Google answered a different query than yours. The rows Google showed for that other query, which aren't results of yours. |
| `ai_overview` | object | Google's AI Overview, when the page has one and you didn't send `ai_overview: false`. See [AI Overview](#ai-overview). |
| `ads` | array | Text ads above and below the results. |
| `shopping_ads` | array | Shopping ads. |
| `related_searches` | string[] | The searches Google suggests at the foot of the page. |
| `people_also_ask` | string[] | The questions under "People also ask". Google loads their answers on a click, so the page doesn't carry them. |
| `local_results` | array | Places in the local results. |
| `knowledge_graph` | object or null | The knowledge panel, or `null` when the page has none. |
| `top_stories` | array | Top stories. |
| `html` | string | The result page as Google served it, with `html: true`. |
| `ai_overview_html` | string | With `html: true`, the AI Overview's markup when Google loaded it after the page. |

When Google answers a different query than the one you asked, `ai_overview` and the blocks from `ads` to `top_stories` are left out, because they answer the other query.

### Search Information

| Field | Type | Description |
|-------|------|-------------|
| `organic_results_state` | string | `results` or `empty`. An empty page with status 200 is Google's answer, not a failure. |
| `next_page` | integer or null | The next page this API serves: pass it as `page`. `null` when there's none, and `end_reason` says why. |
| `google_has_next` | boolean | Google's page links a next page. |
| `end_reason` | string or null | `null` while `next_page` is set. `page_limit`: page 10 is the last page this API serves, though Google links more. `no_next_link`: Google showed no next-page link, which isn't always the end, so asking for the next page can still return results. `query_rewritten`: Google answered another query. |
| `omitted_similar_results` | boolean | Google left out results very similar to the ones shown. Send `filter: 0` to include them. |
| `organic_results_tab` | string | `web` when the organic results come from Google's Web tab while you asked for the All tab: on pages 2 to 10, on a `site:` query, and on a first page whose All tab list differed from the Web tab's. On a first page, everything else still comes from the All tab. Absent otherwise. |
| `links_unresolved` | integer | Organic results whose destination couldn't be found. Their `link` is `null`. |
| `ai_overview_state` | string | `present`; `pending` (Google loads the overview after the page, and this answer doesn't carry it); `unavailable` (Google says no overview is available); `absent` (Google offered none); `rewritten_query` (the overview answers `answered_query`, so it isn't given). |
| `query_rewritten` | boolean | `true` when Google answered another query, such as your query without its quotes or with its spelling corrected. |
| `answered_query` | string | The query Google answered instead, present with `query_rewritten`. |
| `site_scope` | object | On a `site:` query: `sites` (the sites asked for), `in_scope`, `out_of_scope` and `unknown` (organic results by where they lead), and `retried_on_fresh_session` (the search was run once more because its results led outside the site). |

### Organic Result

| Field | Type | Description |
|-------|------|-------------|
| `position` | integer | Place in the whole search: `(page - 1) x 10 + page_position`. |
| `page_position` | integer | Place on this page, from 1. |
| `title` | string | The result's title. |
| `link` | string or null | The address the result leads to. `null` when it couldn't be found, counted in `links_unresolved`. |
| `redirect_link` | string | The result's address on Google's page, a Google redirect. |
| `displayed_link` | string or null | The address as Google shows it, such as `https://www.example.com › reviews`. |
| `source` | string or null | The site's name as Google shows it. |
| `snippet` | string or null | The text under the title. |
| `date` | string or null | The date or age Google shows, such as `Apr 28, 2026` or `3 days ago`, exactly as shown and in the page's language. Never guessed. |
| `missing_terms` | string[] | Present when Google says the result doesn't contain some of your words: those words. |
| `in_scope` | boolean or null | On a `site:` query: whether `link` leads inside the site you asked for. `null` when `link` is `null`. |

### AI Overview

| Field | Type | Description |
|-------|------|-------------|
| `text_blocks` | array | The answer, in order. Each block has `type` (`paragraph`, `heading` or `list`), then `text` for a paragraph or heading, or `items` for a list. `citations` lists the source chips inside the block, and a list adds `item_citations`, each item's own chips. |
| `sources` | array | Every source of the answer: `source`, `title`, `snippet`, `link`, `redirect_link`, and `cited: true` when a chip in the answer cites it. |
| `product_cards` | array | Product tiles in the answer (`source`, `title`, `snippet`). They carry no address, so they aren't in `sources`. |
| `citations_complete` | boolean | `false` when a chip counts more sources than the page carried. |
| `truncated` | boolean | Only the start of the answer was in the page. |
| `loaded` | string | `in_page`, or `async` when Google filled the overview in after the page loaded. |
| `links_unresolved` | integer | Sources and citations whose destination couldn't be found. |

A citation has `source`, `link`, `redirect_link`, `more_sources` (the "+N" on the chip), `sources` (every source the chip stands for, each also in `ai_overview.sources`) and `sources_complete`.

### Other Blocks

| Block | Fields |
|-------|--------|
| `ads` | `position` (among the ads of its block, from 1), `block` (`top` or `bottom`), `title`, `advertiser`, `displayed_link`, `domain`, `link` (the page the ad lands on, as the ad carries it, or `null`), `description`, `sitelinks` (each with `title`, `description`, `link`) |
| `shopping_ads` | `position`, `price`, `merchant`, `domain` |
| `local_results` | `position`, `title`, `rating` (a number), `reviews` (as shown), `details` (the lines under the name: kind, address, hours), `place_id` |
| `knowledge_graph` | `title`, `subtitle`, `description`, `attributes` (each with `key`, `label`, `value`) |
| `top_stories` | `position`, `title`, `source`, `published_at` (Unix seconds), `link`, `redirect_link` |

FourA reads ads and shopping ads from the page and never follows their links. A shopping ad has no product name or landing address because the page doesn't carry them.

## Paging Through Results

Each page is a search of its own and counts on its own. Follow `search_information.next_page` until it's `null`:

```python
import requests

API = "https://eu.api.foura.ai/api/serp"
H = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}

page = 1
while page:
    r = requests.post(API, headers=H, timeout=90, json={
        "q": "coffee grinder",
        "country": "us",
        "page": page,
        "timeout_ms": 85000,
    })
    body = r.json()
    if r.status_code != 200:
        print(page, r.status_code, body.get("error"))
        break
    for row in body["organic_results"]:
        print(row["position"], row["link"] or row["redirect_link"], row["title"])
    page = body["search_information"]["next_page"]
```

With `filter: 1`, many queries run out of results after a few pages. Send `filter: 0` when you need the deeper pages.

## What Counts as a Search

A search counts when we answer it, or when you close the connection after it has reached Google. A search sent with `boost: 2` counts as two.

- **Counted:** an answer with HTTP 200, including one with no results and one where Google answered another query.
- **Counted:** a search you leave by closing the connection after it reached Google, before its `timeout_ms` ran out.
- **Not counted:** a failed search (any 4xx or 5xx), including a refusal by your plan's limits, and a search FourA ends because its `timeout_ms` ran out.
- **`boost`:** `boost: 2` counts as two searches every time it counts, however fast the answer came. `boost: 1`, or no `boost`, counts one. `boost: 3` is refused with a 400.

A search spends nothing else from your plan: no credits and no traffic. The **Searches this period** card on **Billing** shows what you've used, and the **SERP** switch on Overview, Metrics and Activity shows your searches.

## Plans, Packs and Limits

The public plans include searches each month:

| Plan | Searches included a month |
|------|---------------------------|
| Free | 100 |
| Developer | 1,000 |
| Startup | 10,000 |
| Business | 30,000 |

Extra searches come in packs of 1,000, priced by your plan (see [Pricing](https://foura.ai/prices)). Buy them with **Buy searches** on the **Searches this period** card, under **Billing > Plan & Usage**. A pack is usable for 12 months and appears in the **Top-ups** table. Each month your plan's own searches go first, and only what you go over draws on packs. [Automatic Top-Up](https://foura.ai/docs/dashboard/automatic-top-up) can buy searches too. The Free plan doesn't sell packs. See [Billing & Subscriptions](https://foura.ai/docs/dashboard/billing).

When your searches run out, new searches are refused with a 429 until the next month or until you buy more. Searches already running finish and count.

Your plan also sets how many searches run at once and how many start in a minute. Searches use the numbers your plan sets for Browser requests at once and for Single requests a minute, counted apart from those requests. See [Pricing](https://foura.ai/prices) for each plan's numbers.

## Timing and Timeouts

A first search for a query typically takes about 50 to 70 seconds today. With `boost: 2`, about half of them finish in under 25 seconds. A query searched again within a day usually comes back faster. These are today's figures, not a guarantee.

Set a client timeout of at least 90 seconds and send `timeout_ms: 85000`. The default `timeout_ms` is `120000`, longer than a 90-second client timeout, so send it every time.

Keep `timeout_ms` a few seconds under your client's own timeout. A search FourA ends on its `timeout_ms` counts nothing. A search your client gives up on after it reached Google still counts.

## Try It in the Playground

The dashboard's [Playground](https://foura.ai/docs/dashboard/playground) has a **SERP** tab that sends every field on this page and shows the curl for the request. `boost` is on there by default, so a Playground search counts as two.

## Errors

Read the HTTP status first. A failed search also carries `status` and `error` in the body, with the same number, and one that failed after it started returns `search_parameters` too (and `search_metadata`, except on a 500). A refusal before the search starts (a missing or invalid key, a limit of your plan) carries `error` without `status`, and a 413 isn't JSON. None of these counts as a search.

| Code | Meaning |
|------|---------|
| 400 | A field failed validation, or the controls can't be combined. `error` names the field: `<field>: <reason>`. |
| 401 | Missing or invalid API key. |
| 413 | The JSON request body is over 100 KB. |
| 429 with `X-FourA-Limit` | Your plan's limit: searches for the month, searches at once, or searches a minute. |
| 429 without `X-FourA-Limit` | Google refused this search. Retry. |
| 500 | Something went wrong on our side. Retry. |
| 502 | Most of the result links couldn't be followed, or the search got no result page from Google within its time budget. Retry. |
| 503 | FourA couldn't take the search for a moment. Retry after `Retry-After` when it's set. |
| 504 | `Upstream timeout`: the search didn't finish within its time budget. Retry. |

Another 4xx or 5xx in a search's body is the status Google answered with. Retry later.

### 400 Examples

```json
{ "status": 400, "error": "boost: boost must be 1 or 2" }
```

```json
{ "status": 400, "error": "page: Too big: expected number to be <=10" }
```

```json
{ "status": 400, "error": "country: country must be a two-letter code (ISO 3166-1), e.g. us, de" }
```

```json
{ "status": 400, "error": "Google cannot combine verbatim with the past hour: ask for verbatim, or for the past hour, or freshness \"day\"" }
```

### 429 From Your Plan

A plan limit sets `X-FourA-Limit` and `Retry-After`, and the body has the shape described in [Rate Limits](https://foura.ai/docs/api/rate-limits), with no `status` field:

```json
{
  "error": "Search limit reached: 1,000 of 1,000 searches used this billing period. Buy more or wait for the next period.",
  "reason": "plan_limit_serp",
  "documentation": "https://foura.ai/prices",
  "used": 1000,
  "allowance": 1000,
  "retry_after_seconds": 86400,
  "resets_at": "2026-12-14T09:12:00.000Z"
}
```

| `reason` | Refused because | Extra fields | What to do |
|----------|-----------------|--------------|------------|
| `plan_limit_serp` | Your searches for the month are used. A plan with none included reads `Your plan includes no searches. Buy searches or upgrade to search.` | `used`, `allowance`, `retry_after_seconds`, `resets_at` | Buy a pack, upgrade, or wait for `resets_at`. |
| `plan_limit_concurrency` | As many searches as your plan allows are already running. | `limit`, `in_flight`, `retry_after_seconds` | Keep fewer searches open at once. |
| `plan_limit_rate` | Your plan's searches a minute are spent. | `limit_per_minute`, `current_rate`, `retry_after_seconds` | Wait `Retry-After`, then slow down. |

### 502: Result Links Not Followed

When most of a page's result links couldn't be followed, the search fails instead of returning rows you can't open:

```json
{
  "status": 502,
  "error": "Google's result links could not be followed (6 of 10); ask again",
  "search_parameters": { "q": "coffee grinder", "country": "us", "language": "en", "page": 1, "filter": 1, "boost": 1 },
  "search_metadata": { "id": "...", "took_ms": 81240, "session": "new", "attempts": 1, "credits": 0, "google_url": "https://www.google.com/search?q=coffee+grinder&hl=en&gl=us" }
}
```

When only a few links are missing, the search is answered: those rows have `link: null`, and `search_information.links_unresolved` counts them.

## Related

- [API Endpoints](https://foura.ai/docs/api/endpoints): Single, Proxy, Browser and Auto
- [Rate Limits](https://foura.ai/docs/api/rate-limits): How plan limits refuse a request
- [API Errors](https://foura.ai/docs/api/errors): Error handling and retries
- [Billing & Subscriptions](https://foura.ai/docs/dashboard/billing): Buying more of an allowance
- [Automatic Top-Up](https://foura.ai/docs/dashboard/automatic-top-up): Buying before you run out
- [Playground](https://foura.ai/docs/dashboard/playground): Running requests from the dashboard
- [Activity Log](https://foura.ai/docs/dashboard/activity-log): Your recent requests, searches included
