---
title: "Google Gemini API"
description: "Use SerpApi's Google Gemini API to scrape Google Gemini answers: text blocks, references, places, products, images, follow-up questions, multi-turn conversations, and more."
url: https://serpapi.com/google-gemini-api
site: "SerpApi – Real-time search engine results API"
signup: https://serpapi.com/users/sign_up
engine: "google_gemini"
docs:
  pricing: https://serpapi.com/pricing.md
  integrations: https://serpapi.com/integrations.md
---

# Google Gemini API

Use SerpApi's Google Gemini API to scrape Google Gemini answers: text blocks, references, places, products, images, follow-up questions, multi-turn conversations, and more.

## Example Request

```
GET https://serpapi.com/search?api_key=YOUR_API_KEY&engine=google_gemini&q=QUERY
```

## API parameters

### Search Query

| Parameter | Required | Description |
|-----------|----------|-------------|
| `q` | **Yes** | Parameter defines the prompt you want to send to Google Gemini. |

### Subsequent request

| Parameter | Required | Description |
|-----------|----------|-------------|
| `subsequent_request_token` | No | Parameter defines the token used to continue a Google Gemini conversation. Pass this token with a new `q` to send a follow-up prompt that includes the previous prompts and answers as context (multi-turn).  The token is returned by SerpApi from your previous request using our [Google Gemini API](https://serpapi.com/google-gemini-api).   Gemini keeps a conversation only for a limited time, so the token **expires**: send the follow-up soon after the previous request. |

### SerpApi parameters

| Parameter | Required | Description |
|-----------|----------|-------------|
| `engine` | **Yes** | Set parameter to `google_gemini` to use the Google Gemini API engine. |
| `no_cache` | No | Parameter will force SerpApi to fetch the Google Gemini results even if a cached version is already present. A cache is served only if the query and all parameters are exactly the same. Cache expires after 1h. Cached searches are free, and are not counted towards your searches per month. It can be set to `false` (default) to allow results from the cache, or `true` to disallow results from the cache. `no_cache` and `async` parameters should not be used together. |
| `async` | No | Parameter defines the way you want to submit your search to SerpApi. It can be set to `false` (default) to open an HTTP connection and keep it open until you got your search results, or `true` to just submit your search to SerpApi and retrieve them later. In this case, you'll need to use our [Searches Archive API](https://serpapi.com/search-archive-api) to retrieve your results. `async` and `no_cache` parameters should not be used together. `async` should not be used on accounts with [Ludicrous Speed](https://serpapi.com/plan) enabled. |
| `zero_trace` | No | Enterprise only. Parameter enables [ZeroTrace mode](https://serpapi.com/zero-trace-mode). It can be set to `false` (default) or `true`. Enable this mode to skip storing search parameters, search files, and search metadata on our servers. This may make debugging more difficult. |
| `api_key` | **Yes** | Parameter defines the SerpApi private key to use. |
| `output` | No | Parameter defines the format of the result. It can be set to `json` (default) to get a structured JSON of the results, `html` to get the raw HTML retrieved, or `md` to get a Markdown-formatted version optimized for LLMs and AI agents. |
| `json_restrictor` | No | Parameter defines the fields you want to include in the output, reducing payload size for faster response. See the [JSON Restrictor documentation](https://serpapi.com/json-restrictor) for more details. |

## Response Example

Truncated sample response. URLs are illustrative and not accessible.

```json
{
  "search_information": {
    "location_detected": "Iowa, USA"
  },
  "text_blocks": [
    {
      "type": "paragraph",
      "snippet": "Coffee is grown around the world in a specific geographical belt known as the Coffee Belt or Bean...",
      "snippet_highlighted_words": [
        "Coffee Belt"
      ]
    }
  ],
  "reconstructed_markdown": "Coffee is grown around the world in a specific geographical belt known as the **Coffee Belt** or ...",
  "subsequent_request_token": "..."
}
```

