# Google Maps Search (`maps.search`)

Search Google Maps for places matching a query in a free-text location and get up to 20 normalised places with rating, address, phone, website and coordinates.

Docs: https://primaryapi.com/docs/api-reference/maps/search

- Endpoint: `POST https://api.primaryapi.com/v1/run/maps.search`
- Category: Search & SEO · Platform: `maps` · Kind: search · Status: live
- Price: 2 credits per call; up to 75 credits if a call is retried elsewhere. A quote’s `maxCredits` is the most a given call can cost.
- Billing unit: per successful call
- Reliability: routed to a healthy upstream and retried automatically when an attempt fails; live 30-day status: `GET https://api.primaryapi.com/v1/status/apis?sku=maps.search`
- Execution: synchronous (answers 202 only if it outlives the wait window)

## Input

| Field | Type | Required | Default | Constraints | Description |
|---|---|---|---|---|---|
| `query` | string | yes |  | max 500 chars | What you would type in the Google Maps search bar, for example "coffee shop". |
| `location` | string | yes |  | max 200 chars | Free-text location to search in, ideally city plus country, for example "Austin, USA" or "London, UK". |
| `language` | string | no | "en" | max 10 chars | Two-letter language code for the results, for example "en" (default) or "de". |
| `limit` | integer | no | 20 | 1–20 | Maximum number of results to return (1-20, default 20). |
| `categoryFilterWords` | string[] | no |  | max 20 items; items max 100 chars | Optional Google Maps category names to keep (lowercase, as shown on Google Maps, e.g. ["coffee shop", "cafe"]). A place matches when one of its categories equals a word or contains all of its words. Applied to the first page of up to 20 places, so fewer results may come back. |
| `placeMinimumStars` | enum | no |  | one of: two, twoAndHalf, three, threeAndHalf, four, fourAndHalf | Only return places with at least this average rating: two (2+), twoAndHalf (2.5+), three (3+), threeAndHalf (3.5+), four (4+) or fourAndHalf (4.5+). Places without reviews are skipped. |
| `website` | enum | no |  | one of: allPlaces, withWebsite, withoutWebsite | Filter on whether a place lists a website: allPlaces (default), withWebsite or withoutWebsite. |

Unknown fields are rejected with `400 invalid_input`. The routing controls `preferLatencyUnderMs` and `maxCredits` may be sent in the same JSON body.

## Output

When `output.found` is `true`, `output.data` has this shape:

| Field | Type | Description |
|---|---|---|
| `items` | object[] |  |
| `items[].rank` | integer \| null | Position in the upstream result list (1-based). |
| `items[].name` | string |  |
| `items[].placeId` | string \| null | Google place id (ChIJ...). |
| `items[].cid` | string \| null | Google customer id (CID), unsigned decimal string. |
| `items[].dataId` | string \| null | Google data id ("0x...:0x..."), accepted by some reviews endpoints. |
| `items[].address` | string \| null |  |
| `items[].street` | string \| null |  |
| `items[].city` | string \| null |  |
| `items[].state` | string \| null |  |
| `items[].postalCode` | string \| null |  |
| `items[].countryCode` | string \| null |  |
| `items[].neighborhood` | string \| null |  |
| `items[].latitude` | number \| null |  |
| `items[].longitude` | number \| null |  |
| `items[].rating` | number \| null |  |
| `items[].reviewCount` | integer \| null |  |
| `items[].category` | string \| null |  |
| `items[].categories` | string[] |  |
| `items[].phone` | string \| null |  |
| `items[].website` | string \| null |  |
| `items[].domain` | string \| null |  |
| `items[].description` | string \| null |  |
| `items[].hours` | object[] \| null |  |
| `items[].hours[].day` | string |  |
| `items[].hours[].hours` | string |  |
| `items[].priceLevel` | string \| null |  |
| `items[].permanentlyClosed` | boolean \| null |  |
| `items[].image` | string \| null |  |
| `items[].url` | string \| null |  |
| `nextCursor` | string \| null |  |

When the thing you asked about does not exist (or a search matches nothing) the call still succeeds: `output.found` is `false`, `output.data` is `null` and `output.reason` says why (`not_found`, `private`, `no_results`, …). Misses are free unless the notes below say misses are billed.

## Example request

```bash
curl -sS -X POST "https://api.primaryapi.com/v1/run/maps.search" \
  -H "Authorization: Bearer $PRIMARYAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"coffee shop","location":"New York, NY","limit":20}'
```

## Example response

_Values are placeholders that follow the output schema; `credits` is what this call would cost at the usual price._

```json
{
  "output": {
    "found": true,
    "data": {
      "items": [
        {
          "rank": 0,
          "name": "string",
          "placeId": "string",
          "cid": "string",
          "dataId": "string",
          "address": "string",
          "street": "string",
          "city": "string",
          "state": "string",
          "postalCode": "string",
          "countryCode": "string",
          "neighborhood": "string",
          "latitude": 0,
          "longitude": 0,
          "rating": 0,
          "reviewCount": 0,
          "category": "string",
          "categories": [
            "string"
          ],
          "phone": "string",
          "website": "string",
          "domain": "string",
          "description": "string",
          "hours": [
            {
              "day": "string",
              "hours": "string"
            }
          ],
          "priceLevel": "string",
          "permanentlyClosed": true,
          "image": "string",
          "url": "https://example.com"
        }
      ],
      "nextCursor": null
    }
  },
  "provider": "PrimaryAPI",
  "credits": 2,
  "items": 1,
  "requestId": "req_01JBXK6Y2N9V8T4R3Q2P1M0A7Z",
  "nextCursor": null
}
```

## Pricing and reliability

- Usual price: 2 credits per call
- Price ceiling: up to 75 credits if a call is retried elsewhere. A quote’s `maxCredits` is the most a given call can cost; the `maxCredits` routing control caps it per call
- Live 30-day status, success rate, uptime and latency: `GET https://api.primaryapi.com/v1/status/apis?sku=maps.search`

## Errors to handle

`invalid_input`, `unauthorized`, `insufficient_balance`, `key_limit_reached`, `trial_cap_reached`, `forbidden`, `not_found`, `idempotency_conflict`, `rate_limited`, `all_sources_failed`, `service_unavailable`, `timeout`. See https://primaryapi.com/docs/errors.

## Legal

Google Maps terms forbid automated collection. Customers are responsible for lawful use.

