GET
# Google Maps Search API

Find places by category and area or by name, and get a data\_id for each one.

## Overview

Search Google Maps for places of any kind (restaurants, cafes, attractions, shops, hotels) by free text, 20 ranked places per page.

#### Contract note

Sponsored results are not returned. position is the rank across pages (page 2 starts at 21). has\_more is true when the page was full; a page past the end returns results: [] and has\_more: false, and page 1 with no match returns 404. Pages can overlap slightly (Google re-ranks between calls), so de-duplicate results by data\_id if you merge pages. open\_state is Google's live status line at request time, and hours\_today is today's hours in the place's local time.

### Endpoint URL

GET https://api.stayapi.com/v1/google\_maps/search 

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| query | string | Required | Free text: a category and area (pizza near Times Square) or a name (Eiffel Tower). |
| location | string | Optional | lat,lng to search around, a city-sized area (for example 40.758,-73.9855). Without it the query text decides the area. Invalid values return 400. |
| page | integer | Optional | 1 to 10. Default: 1. 20 results per page. |
| hl | string | Optional | UI language code. Default: en. |
| gl | string | Optional | Region or country code. Default: us. |

## Response schema

| Field | Type | Description |
| --- | --- | --- |
| query / location / page | mixed | The submitted search and page. |
| has\_more | boolean | True when this page was full and Google likely has more. |
| results | array | Up to 20 places, each with position, data\_id, place\_id, name, categories, address, latitude, longitude, rating, reviews\_count, phone, website, hours\_today, open\_state, and thumbnail. Fields Google does not show are null (lists are []). |
| results[].data\_id | string | Google Maps data\_id (0x…:0x…) for Place details or Google reviews. |
| search\_metadata.provider | string | Always google\_maps. |

## Errors

Errors use RFC 7807 Problem Details (`application/problem+json`) with an `error_code`. Successful responses are always 2xx.

| Status | error\_code | When |
| --- | --- | --- |
| 400 | INVALID\_PARAMETERS | data\_id is not a Google Maps data\_id, query is empty, or location is not lat,lng. |
| 404 | NO\_RESULTS | Unknown data\_id, or no place matches the query (page 1). |
| 422 | VALIDATION\_ERROR | A required parameter is missing, or page is outside 1 to 10. |
| 502 | SCHEMA\_DRIFT / UPSTREAM\_ERROR | Google's answer could not be read. Retry later. |
| 503 | SERVICE\_UNAVAILABLE | Temporarily unavailable. Honour the Retry-After header. |
| 504 | GATEWAY\_TIMEOUT / UPSTREAM\_TIMEOUT | Google did not answer in time. |

## Identifier workflow

#### Search once, reuse the data\_id

Every Search result carries a data\_id. Pass it to Place for details, or to the Google Reviews endpoint (/v1/google\_reviews/reviews) for the place's reviews.

## Related Google Maps endpoints

[Google Maps Place](/docs/endpoints/google-maps/place)

Request

```curl
curl -G "https://api.stayapi.com/v1/google_maps/search" \
  -H "X-API-Key: YOUR_API_KEY" \
  --data-urlencode "query=pizza near Times Square" \
  --data-urlencode "location=40.758,-73.9855" \
  --data-urlencode "page=1" \
  --data-urlencode "hl=en" \
  --data-urlencode "gl=us"
```

Response

```json
{
  "success": true,
  "query": "pizza near Times Square",
  "location": "40.758,-73.9855",
  "page": 1,
  "has_more": true,
  "results": [
    {
      "position": 1,
      "data_id": "0x89c259ab3c1ef289:0x3b67a41175949f55",
      "place_id": "ChIJifIePKtZwokRVZ-UdRGkZzs",
      "name": "Joe's Pizza Broadway",
      "categories": [
        "Pizza restaurant",
        "Pizza delivery",
        "Restaurant"
      ],
      "address": "1435 Broadway, New York, NY 10018",
      "latitude": 40.7546795,
      "longitude": -73.9870291,
      "rating": 4.4,
      "reviews_count": 27370,
      "phone": "(646) 559-4878",
      "website": "https://www.joespizzanyc.com/",
      "hours_today": "10 AM–3 AM",
      "open_state": "Closed · Opens 10 AM",
      "thumbnail": "https://lh3.googleusercontent.com/grass-cs/example=w131-h86-k-no"
    }
  ],
  "search_metadata": {
    "datetime": "2026-10-21T09:56:28",
    "provider": "google_maps"
  }
}
```
