> ## Documentation Index
> Fetch the complete documentation index at: https://slatehq.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Search API

> Fetch live search engine results from Google or Bing for any query.

## Overview

The Search API block retrieves search engine results pages (SERPs) for a query through SearchAPI.io. Use it to pull organic results, related searches, and other SERP data into a workflow. Choose Google or Bing and target a specific country.

***

## Configuration

### Search Query (Required)

The text to search for.

**Example:**

```
best project management software
```

You can reference placeholders from previous steps: `{{step_1.output}}`

***

### Search Engine

Select which search engine to query.

**Default:** Google Search

**Options:**

| Value | Description |
| - | - |
| **Google Search** | Query Google's SERP |
| **Bing Search** | Query Bing's SERP |

***

### Country

Choose which country to search from. Results reflect local ranking and language for that market.

**Default:** United States (`us`)

You can switch the country to a variable for dynamic mapping. The system auto-maps country names and codes.

**Example:** `{{step_1.output.country}}`

***

### Page

Which page of results to return.

**Default:** 1

Increase the page number to fetch deeper results. Page 2 returns the next set of organic results after page 1.

**Example:** `2`

***

## Error Handling

Define what happens if the block fails to retrieve results.

**Options:**

1. **Terminate workflow**: Stop execution immediately.
2. **Continue execution**: Proceed to the next step despite the error.
3. **Retry**: Run the block again until it succeeds, up to the **Number of retries** you choose (1–5). If every retry fails, the workflow stops at this block.

Select based on whether later steps require the search data.

***

## Output Data

The block returns the raw SERP JSON from the provider, with internal metadata fields removed. The exact keys depend on the search engine and query.

### organic\_results

An array of organic result objects, each with a `title`, `link`, and `snippet`.

**Example:** `{{step_1.output.organic_results[0].link}}`

### related\_searches

Related query suggestions returned by the engine, when available.

***

## Sample Output

```json theme={null}
{
  "organic_results": [
    {
      "position": 1,
      "title": "The 11 Best Project Management Software in 2026",
      "link": "https://example.com/best-project-management-software",
      "snippet": "We tested 30 tools to find the best project management software for teams of every size..."
    },
    {
      "position": 2,
      "title": "Top Project Management Tools Compared",
      "link": "https://competitor.com/pm-tools",
      "snippet": "A side-by-side comparison of popular project management platforms..."
    }
  ],
  "related_searches": [
    { "query": "free project management software" },
    { "query": "project management software for small business" }
  ]
}
```

***

## Best Practices

* Extract URLs from `organic_results[].link` before looping over them.
* Set the country to match your target market for accurate local rankings.
* Reference previous step output in the query to run dynamic searches.
* Increase the page number to collect more results across multiple runs.
* Pair with a Code block to flatten `organic_results` into a clean URL list.

***

## Common Use Cases

| Use Case | Configuration | Next Steps |
| - | - | - |
| Competitor SERP research | Brand or product query | Scrape top results |
| Content gap analysis | Topic keyword | Analyze ranking pages with LLM |
| Localized search | Set Country per market | Compare results across regions |
| Link discovery | Broad query | Loop through `organic_results[].link` |
| Bing vs Google comparison | Same query, both engines | Compare result sets |

***

## What's Next

* Scrape result pages with the [Web Scrape Block](https://slatehq.com/docs/workflows/blocks/data-sources/web-scrape.md)
* Compare with the [Google Search Block](https://slatehq.com/docs/workflows/blocks/data-sources/google-search.md)
* Process multiple results in a [Loop Block](https://slatehq.com/docs/workflows/blocks/flow/loop.md)
* Analyze results in the [LLM Block](https://slatehq.com/docs/workflows/blocks/ai/llm.md)
* Learn about [Variable Referencing](https://slatehq.com/docs/workflows/variable-referencing.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.