> Documentation index: https://docs.scrapier.io/llms.txt
> Auth: header `X-API-Key: <key>` · Base: https://api.scrapier.io/api/v2 · Synchronous; paginate with `cursor` ← `data.next_cursor`.

# Google Maps Places

Search Google Maps for places matching a keyword around a location and get names, ratings, addresses and place IDs.

`GET|POST https://api.scrapier.io/api/v2/google-maps/` · 1 credit per successful call · Cursor-paginated

## Overview

Send a keyword such as "coffee shops" in `queries` and a city or address in `location`. You get a page of matching places, each with `place_id`, name, rating and address.

Each page holds 20 places and no place_id repeats across pages. Pass `next_cursor` back as `cursor` to get the next page; `location` and `language` stay the same for every page.

## Use cases

- Build lead lists of local businesses in a city.
- Map competitors around an address.
- Collect ratings for places in a category and area.

## Request

```bash
curl -G "https://api.scrapier.io/api/v2/google-maps/" \
  -H "X-API-Key: YOUR_API_KEY" \
  --data-urlencode "queries=coffee shops" \
  --data-urlencode "location=Houston,Texas" \
  --max-time 210
```

```python
import requests

resp = requests.get(
    "https://api.scrapier.io/api/v2/google-maps/",
    headers={"X-API-Key": "YOUR_API_KEY"},
    params={"queries": "coffee shops", "location": "Houston,Texas"},
    timeout=210,
)
body = resp.json()
if not resp.ok:
    raise RuntimeError(body.get("error") or body.get("detail"))

print(body["data"]["places"])
```

POST with a JSON body works too (same parameters; the body is merged over the query string).

## Parameters

| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| `X-API-Key` (header) | string | yes | — | Your API key. |
| `queries` | string | yes | e.g. `coffee shops` | Place search keyword. Required first call. 20 places per page, no duplicate place_ids across pages. |
| `cursor` | string | no | — | Pagination cursor returned in the previous response's `next_cursor`. Pass it back unchanged to fetch the next page. When `next_cursor` is null, you have reached the last page. |
| `location` | string | no | `Houston,Texas` | Geocode anchor for the search (city or address). Locked in cursor. |
| `language` | string | no | `en` | Result language (Google hl code). Locked in cursor. |
| `country` | string | no | `us` | Ignored -- country bias is derived from the geocoded location. |
| `use_proxy` | boolean | no | `true` | Route the request through Scrapier's residential proxy pool. Default: `true`. Leave as is unless support tells you otherwise. |
| `raw_data` | boolean | no | `false` | When true, the response carries the full raw upstream payload(s) the scraper received (GraphQL / JSON API bodies, HTML, embedded JSON-LD -- exactly as the platform returned them) under `raw_responses`, in place of the formatted items. When false (default) you get the formatted output. Pagination (`cursor` / `next_cursor`) works the same in both modes. |

## Response

HTTP 200. Results are in `data.places`. Sample from the live catalog, arrays trimmed to 3 items.

```json
{
  "success": true,
  "data": {
    "queries": "coffee shops",
    "page": 1,
    "page_size": 20,
    "places": [
      {
        "place_id": "ChIJ...",
        "name": "Blue Bottle Coffee",
        "rating": 4.4,
        "address": "66 Mint St, San Francisco, CA"
      }
    ],
    "next_cursor": "eyJpIjoicXVlcnkiLCJwIjoyfQ"
  }
}
```

## Response fields

| Field | Type | Example | Description |
|---|---|---|---|
| `queries` | string | `coffee shops` |  |
| `page` | integer | `1` |  |
| `page_size` | integer | `20` |  |
| `places` | array | `[1 item]` | The results. |
| `next_cursor` | string | `eyJpIjoicXVlcnkiLCJwIjoyfQ` | Pass back as `cursor` for the next page. `null` on the last page. |
| `places[].place_id` | string | `ChIJ...` | Google's ID for the place, unique across pages of the same search. |
| `places[].name` | string | `Blue Bottle Coffee` |  |
| `places[].rating` | number | `4.4` | Average star rating. |
| `places[].address` | string | `66 Mint St, San Francisco, CA` | Formatted address of the place. |

## Pagination

Pass `data.next_cursor` back as `cursor` until it is `null`. Required inputs are ignored once a cursor is sent. Each page is one billed call.

```python
import requests

URL = "https://api.scrapier.io/api/v2/google-maps/"
HEADERS = {"X-API-Key": "YOUR_API_KEY"}
params = {"queries": "coffee shops", "location": "Houston,Texas"}
items = []

for _ in range(10):  # each page is one billed call
    resp = requests.get(URL, headers=HEADERS, params=params, timeout=210)
    resp.raise_for_status()
    data = resp.json()["data"]
    items.extend(data.get("places") or [])
    if not data.get("next_cursor"):  # None = last page
        break
    params = {"cursor": data["next_cursor"]}
```

## Errors

Failed calls are free. Branch on HTTP status; the message is in `error` (or `detail`). See https://docs.scrapier.io/errors.md

- **400** Bad input. The exact message varies by endpoint. `{"success":false,"error":"…"}`
- **402** Balance below the endpoint's price. `{"error":"Insufficient credits. Buy more to scrape more.","balance":1,"required":2}`
- **403** Invalid or unknown API key. `{"detail":"Authentication service unavailable or invalid API key."}`
- **429** Throttled — wait for Retry-After. `{"detail":"Request was throttled. Expected available in N seconds."}`
- **404** unknown slug · **503** busy (retry after `Retry-After`) · **5xx** upstream failure or timeout (retry with backoff).

## Notes

- `country` is ignored: the country bias comes from the geocoded `location`.
- `language` takes a Google hl code such as en.
- `queries` takes one keyword per call.
- Locked into the cursor: `location`, `language`. Set them on the first call; later pages reuse them.

## Related

- [Google Search](https://docs.scrapier.io/api-reference/google/google-search.md): Structured Google data: send `queries`. Single lookup, 1 credit per successful call.
- [Google Autocomplete](https://docs.scrapier.io/api-reference/google/google-autocomplete.md): Structured Google data: send `queries`. Cursor-paginated, 1 credit per successful call.
