# GoogleSearchAPIWrapper

> **Class** in `langchain_google_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-google-community/search/GoogleSearchAPIWrapper)

Wrapper for Google Custom Search API.

Performs web searches using Google Custom Search API and returns results
with snippets, titles, and links.

!!! note "Setup Required"

    1. Enable [Custom Search API](https://console.cloud.google.com/apis/library/customsearch.googleapis.com)
    2. Create API key in [Google Cloud Console](https://console.cloud.google.com/apis/credentials)
    3. Create custom search engine at [Programmable Search Engine](https://programmablesearchengine.google.com)
    4. Set `GOOGLE_API_KEY` and `GOOGLE_CSE_ID` environment variables

## Signature

```python
GoogleSearchAPIWrapper()
```

## Extends

- `BaseModel`

## Properties

- `search_engine`
- `google_api_key`
- `google_cse_id`
- `k`
- `siterestrict`
- `model_config`

## Methods

- [`validate_environment()`](https://reference.langchain.com/python/langchain-google-community/search/GoogleSearchAPIWrapper/validate_environment)
- [`run()`](https://reference.langchain.com/python/langchain-google-community/search/GoogleSearchAPIWrapper/run)
- [`results()`](https://reference.langchain.com/python/langchain-google-community/search/GoogleSearchAPIWrapper/results)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-google/blob/a3f016b2a6c4af535df275545f76fa7424aa39e5/libs/community/langchain_google_community/search.py#L11)