# Google Search (`justserpapi/google-search`) Actor

Powerful Google Search SERP API to scrape organic search results, ads, knowledge panels, and more. Monitor keyword rankings and analyze competitor strategies across different countries and languages with built-in anti-bot protection.

- **URL**: https://apify.com/justserpapi/google-search.md
- **Developed by:** [Just Serp API](https://apify.com/justserpapi) (community)
- **Categories:** Developer tools, SEO tools, Agents
- **Stats:** 8 total users, 2 monthly users, 96.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$10.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Google Search

Run standard Google Search queries and return structured SERP data. The Actor uses the configured upstream `/api/v1/google/search` endpoint and preserves the upstream JSON response shape.

### Input

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `query` | string | Yes | The search query for Google Search (e.g., 'coffee shops', 'how to bake a cake'). |
| `page` | integer | No | The results page number. Use 0 for the first page, 1 for the second, and so on. |
| `html` | boolean | No | Set to true to return the raw HTML of the Google search results page alongside the structured data. |
| `language` | string | No | Set the language for the results using its two-letter code (e.g., 'en' for English, 'fr' for French). See Google Language. |
| `lr` | string | No | Restrict results to one or more languages using the 'lang\_{language\_code}' format (e.g., 'lang\_en'). See Google LR Language. |
| `domain` | string | No | The Google domain to use for the search (e.g., 'google.com', 'google.co.uk'). See Google Domains. |
| `country` | string | No | Set the target country code (e.g., 'us', 'uk') to localize results. See Google Countries. |
| `cr` | string | No | Limits results to search results from specific countries. Format: 'countryXX'. See Google CR Countries. |
| `uule` | string | No | Encoded location string (UULE) used to precisely localize Google search results. This is an advanced/technical parameter — if you’re not familiar with it, you can leave it empty and omit it. |
| `location` | string | No | The textual location name (e.g., 'New York, NY') to localize the search results. |
| `ludocid` | string | No | Google local business CID (place identifier). Used to target a specific Google Business Profile / local listing. Advanced parameter — if you don’t know it, you can omit it. |
| `lsig` | string | No | Signature parameter (lsig) sometimes required for certain Knowledge Graph / local map view features. This is an advanced technical parameter — if you’re not familiar with it, you can leave it empty. |
| `kgmid` | string | No | Knowledge Graph entity/listing ID (KGMID) used to retrieve details for a specific entity. This is an advanced technical parameter — if you’re not familiar with it, you can leave it empty. |
| `si` | string | No | Cached search context parameter (si) used to reproduce specific Google search result views/context (e.g. some Knowledge Graph tabs). This is an advanced technical parameter — if you’re not familiar with it, you can leave it empty. |
| `ibp` | string | No | Parameter (ibp) used to control certain Google UI expansions or rendering modes (commonly in local/business result views). This is an advanced technical parameter — if you’re not familiar with it, you can leave it empty. |
| `uds` | string | No | Advanced filter token (uds) used for specific Google search sub-filters. This is an advanced technical parameter, usually provided by Google in filter options/results — if you’re not familiar with it, you can leave it empty. |
| `tbs` | string | No | Advanced search filter parameter (tbs) used to apply Google result filters (e.g. time range). This is an advanced parameter — if you’re not familiar with it, you can leave it empty. |
| `safe` | string | No | SafeSearch filter setting. Set to 'active' to filter adult content, or 'off' to disable it. |
| `nfpr` | string | No | Controls Google's auto-correction. Set to '1' to exclude corrected results, '0' to include them. |
| `filter` | string | No | Toggle 'Similar Results' and 'Omitted Results' filters. Set to '1' (default) to enable, '0' to disable. |

### Example Input

```json
{
  "query": "coffee",
  "html": false,
  "language": "en",
  "domain": "google.com",
  "country": "us",
  "page": 0
}
```

### Output

The Actor pushes the upstream JSON object to the default dataset and stores the same object under the `OUTPUT` key in the default key-value store.

### Upstream Authentication

- `BACKEND_BASE_URL`: Optional. Defaults to `https://api.justserpapi.com`.
- `BACKEND_API_KEY`: Optional but typically required. Sent as `X-API-Key`.
- `BACKEND_TURNSTILE_TOKEN`: Optional. Sent as `X-Turnstile-Token`.
- `BACKEND_TIMEOUT_MS`: Optional request timeout in milliseconds. Defaults to `30000`.
- `BACKEND_MAX_RETRIES`: Optional retry count for transient failures. Defaults to `2`.

### Monetization

If you use pay-per-event pricing and want to bill only successful results, configure Publication > Monetization like this:

- Remove the synthetic `apify-actor-start` event. Otherwise failed starts can still be billed.
- Remove the synthetic `apify-default-dataset-item` event if you want fully manual charging.
- Add a custom `successful-result` event and price it per successful result.

The runtime checks the remaining budget before the upstream call and charges only after a successful result is written to the default dataset.

# Actor input Schema

## `query` (type: `string`):

The search query for Google Search (e.g., 'coffee shops', 'how to bake a cake').

## `page` (type: `integer`):

The results page number. Use 0 for the first page, 1 for the second, and so on.

## `html` (type: `boolean`):

Set to true to return the raw HTML of the Google search results page alongside the structured data.

## `language` (type: `string`):

Set the language for the results using its two-letter code (e.g., 'en' for English, 'fr' for French). See Google Language.

## `lr` (type: `string`):

Restrict results to one or more languages using the 'lang\_{language\_code}' format (e.g., 'lang\_en'). See Google LR Language.

## `domain` (type: `string`):

The Google domain to use for the search (e.g., 'google.com', 'google.co.uk'). See Google Domains.

## `country` (type: `string`):

Set the target country code (e.g., 'us', 'uk') to localize results. See Google Countries.

## `cr` (type: `string`):

Limits results to search results from specific countries. Format: 'countryXX'. See Google CR Countries.

## `uule` (type: `string`):

Encoded location string (UULE) used to precisely localize Google search results. This is an advanced/technical parameter — if you’re not familiar with it, you can leave it empty and omit it.

## `location` (type: `string`):

The textual location name (e.g., 'New York, NY') to localize the search results.

## `ludocid` (type: `string`):

Google local business CID (place identifier). Used to target a specific Google Business Profile / local listing. Advanced parameter — if you don’t know it, you can omit it.

## `lsig` (type: `string`):

Signature parameter (lsig) sometimes required for certain Knowledge Graph / local map view features. This is an advanced technical parameter — if you’re not familiar with it, you can leave it empty.

## `kgmid` (type: `string`):

Knowledge Graph entity/listing ID (KGMID) used to retrieve details for a specific entity. This is an advanced technical parameter — if you’re not familiar with it, you can leave it empty.

## `si` (type: `string`):

Cached search context parameter (si) used to reproduce specific Google search result views/context (e.g. some Knowledge Graph tabs). This is an advanced technical parameter — if you’re not familiar with it, you can leave it empty.

## `ibp` (type: `string`):

Parameter (ibp) used to control certain Google UI expansions or rendering modes (commonly in local/business result views). This is an advanced technical parameter — if you’re not familiar with it, you can leave it empty.

## `uds` (type: `string`):

Advanced filter token (uds) used for specific Google search sub-filters. This is an advanced technical parameter, usually provided by Google in filter options/results — if you’re not familiar with it, you can leave it empty.

## `tbs` (type: `string`):

Advanced search filter parameter (tbs) used to apply Google result filters (e.g. time range). This is an advanced parameter — if you’re not familiar with it, you can leave it empty.

## `safe` (type: `string`):

SafeSearch filter setting. Set to 'active' to filter adult content, or 'off' to disable it.

## `nfpr` (type: `string`):

Controls Google's auto-correction. Set to '1' to exclude corrected results, '0' to include them.

## `filter` (type: `string`):

Toggle 'Similar Results' and 'Omitted Results' filters. Set to '1' (default) to enable, '0' to disable.

## Actor input object example

```json
{
  "query": "coffee",
  "language": "en",
  "domain": "google.com",
  "country": "us",
  "safe": "off",
  "nfpr": "0"
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "query": "coffee",
    "page": 0,
    "html": false,
    "language": "en",
    "domain": "google.com",
    "country": "us",
    "safe": "off",
    "nfpr": "0"
};

// Run the Actor and wait for it to finish
const run = await client.actor("justserpapi/google-search").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "query": "coffee",
    "page": 0,
    "html": False,
    "language": "en",
    "domain": "google.com",
    "country": "us",
    "safe": "off",
    "nfpr": "0",
}

# Run the Actor and wait for it to finish
run = client.actor("justserpapi/google-search").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "query": "coffee",
  "page": 0,
  "html": false,
  "language": "en",
  "domain": "google.com",
  "country": "us",
  "safe": "off",
  "nfpr": "0"
}' |
apify call justserpapi/google-search --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,justserpapi/google-search"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/1a6NlfLzNUbBUTttX/builds/xex3z2GQle0ub8fOF/openapi.json
