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

# Search and AI answers

> Search Google, News, Images, Scholar and Patents, ask Google AI Mode a question, and read what people search for. You get results and cited sources.

Search Google, News, Images, Scholar and Patents, ask Google AI Mode a question, and read what people search for. You get results and cited sources. See every field in the [Search and AI answers reference](/api-reference/endpoint/google-search), or try it in the [playground](https://stophy.dev/playground).

## Scrape Google Search results

<CodeGroup>
  ```typescript TypeScript icon="https://mintcdn.com/sirathic/7E4w9-IC4ysabjfc/images/icons/typescript.svg?fit=max&auto=format&n=7E4w9-IC4ysabjfc&q=85&s=d8272a85e64145620f1fbbfcf7932986" theme={null}
  import { Stophy } from "stophy";

  const stophy = new Stophy({ apiKey: process.env.STOPHY_API_KEY });
  const result = await stophy.google.search({ query: "best project management software" });
  console.log(result.data.results);
  ```

  ```python Python icon="python" theme={null}
  from stophy import Stophy

  stophy = Stophy()  # reads STOPHY_API_KEY
  result = stophy.google.search(query="best project management software")
  print(result["data"]["results"])
  ```

  ```bash cURL icon="terminal" theme={null}
  curl -X POST https://api.stophy.dev/v1/google/search \
    -H "Authorization: Bearer $STOPHY_API_KEY" \
    -H "content-type: application/json" \
    -d '{"query":"best project management software"}'
  ```

  ```bash CLI icon="square-terminal" theme={null}
  stophy google search "best project management software"
  ```
</CodeGroup>

The response:

```json theme={null}
{
  "success": true,
  "data": {
    "results": [
      {
        "url": "https://bun.com/",
        "title": "Bun — A fast all-in-one JavaScript runtime",
        "description": "Bun is a fast JavaScript runtime & toolkit. All in one. Runtime, package manager, test runner and bundler in a single binary. Use bun install or bun test in an ...",
        "position": 1
      },
      {
        "url": "https://github.com/oven-sh/bun",
        "title": "oven-sh/bun: Incredibly fast JavaScript runtime, bundler ...",
        "description": "At its core is the Bun runtime, a fast JavaScript runtime designed as a drop-in replacement for Node.js. It's written in Rust and powered by JavaScriptCore ...",
        "position": 2
      }
    ]
  },
  "creditsUsed": 0,
  "requestId": "44eea069-e571-4dd8-95b4-cd56e641701a"
}
```

## Endpoints

| Endpoint | Cost |
| - | - |
| [Scrape Google Search results](/api-reference/endpoint/google-search) | From 1 credit (no key needed) |
| [Scrape Google News results and headlines](/api-reference/endpoint/google-news) | 1 credit (no key needed) |
| [Scrape Google Images results](/api-reference/endpoint/google-images) | From 1 credit |
| [Scrape Google Scholar search results](/api-reference/endpoint/google-scholar) | 1 credit |
| [Scrape Google Patents search results](/api-reference/endpoint/google-patents) | 1 credit (no key needed) |
| [Scrape Google AI Mode answers with their sources](/api-reference/endpoint/google-aiMode) | 2 credits |
| [Scrape Google search suggestions](/api-reference/endpoint/google-suggest) | 1 credit (no key needed) |
| [Scrape Google Trends related searches](/api-reference/endpoint/google-trends-related) | 1 credit |
| [Scrape what is trending on Google now](/api-reference/endpoint/google-trends-trending) | 1 credit |
| [Scrape Google Trends interest over time](/api-reference/endpoint/google-trends-interest) | 1 credit |
| [Scrape Google Trends interest by region](/api-reference/endpoint/google-trends-regions) | 1 credit |

## More ways to call it

### Scrape Google News results and headlines

<CodeGroup>
  ```typescript TypeScript icon="https://mintcdn.com/sirathic/7E4w9-IC4ysabjfc/images/icons/typescript.svg?fit=max&auto=format&n=7E4w9-IC4ysabjfc&q=85&s=d8272a85e64145620f1fbbfcf7932986" theme={null}
  import { Stophy } from "stophy";

  const stophy = new Stophy({ apiKey: process.env.STOPHY_API_KEY });
  const result = await stophy.google.news({ query: "nvidia" });
  console.log(result.data.results);
  ```

  ```python Python icon="python" theme={null}
  from stophy import Stophy

  stophy = Stophy()  # reads STOPHY_API_KEY
  result = stophy.google.news(query="nvidia")
  print(result["data"]["results"])
  ```

  ```bash cURL icon="terminal" theme={null}
  curl -X POST https://api.stophy.dev/v1/google/news \
    -H "Authorization: Bearer $STOPHY_API_KEY" \
    -H "content-type: application/json" \
    -d '{"query":"nvidia"}'
  ```

  ```bash CLI icon="square-terminal" theme={null}
  stophy google news nvidia
  ```
</CodeGroup>

### Scrape Google Scholar search results

<CodeGroup>
  ```typescript TypeScript icon="https://mintcdn.com/sirathic/7E4w9-IC4ysabjfc/images/icons/typescript.svg?fit=max&auto=format&n=7E4w9-IC4ysabjfc&q=85&s=d8272a85e64145620f1fbbfcf7932986" theme={null}
  import { Stophy } from "stophy";

  const stophy = new Stophy({ apiKey: process.env.STOPHY_API_KEY });
  const result = await stophy.google.scholar({ query: "malaria vaccine efficacy" });
  console.log(result.data.results);
  ```

  ```python Python icon="python" theme={null}
  from stophy import Stophy

  stophy = Stophy()  # reads STOPHY_API_KEY
  result = stophy.google.scholar(query="malaria vaccine efficacy")
  print(result["data"]["results"])
  ```

  ```bash cURL icon="terminal" theme={null}
  curl -X POST https://api.stophy.dev/v1/google/scholar \
    -H "Authorization: Bearer $STOPHY_API_KEY" \
    -H "content-type: application/json" \
    -d '{"query":"malaria vaccine efficacy"}'
  ```

  ```bash CLI icon="square-terminal" theme={null}
  stophy google scholar "malaria vaccine efficacy"
  ```
</CodeGroup>

<Tip>Google search, News, suggestions and Patents work without a key, for the first page only. Google AI Mode costs 2 credits and Google Images costs 1 credit per 10 images. Turn on `scrapeResults` in Google search to read the top pages in the same call. Every other endpoint costs 1 credit.</Tip>


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