SERP API
Google Maps
The same /v1/search endpoint with engine=google_maps returns Google Maps places as JSON: discover businesses near a point, or collect one place from its Google Maps URL.
Send the API key in the X-API-Key header, or as the api_key query parameter (Authentication). Google Maps searches can also run as async tasks with pingback_url.
Parameters
| Field | Type | Description |
|---|---|---|
engine | string | required Set it to google_maps.Values:google_maps |
type | string | optional discover: businesses near a point. collect: one place from its Google Maps URL. Any other value answers 400 invalid_type.Values:discovercollectDefault: discover |
q | string | optional type=discover: what to look for, like restaurants, dentist or hotels. Required for discover.Example: pizza |
lat | number | optional type=discover: latitude of the centre of the search, from -90 to 90. Required for discover.Example: 40.7128 |
lon | number | optional type=discover: longitude of the centre of the search, from -180 to 180. Required for discover.Example: -74.006 |
zoom | integer | optional type=discover: how wide to search, like the Google Maps zoom: 10 is about 150 km, 12 about 40 km, 14 about 10 km, 16 about 2.5 km, 18 about 0.6 km. Google may widen a search that finds too few places.Default: 14 |
distance_max | number | optional type=discover: the search radius in km (above 0, up to 200), instead of zoom. When both are sent, zoom wins.Example: 5 |
num | integer | optional type=discover: the most places to return, from 1 to 200.Default: 200 |
url | string | optional type=collect: a Google Maps place URL: a place link (with @lat,lon), ?cid=, place_id:, maps.app.goo.gl or goo.gl/maps. Required for collect.Example: https://www.google.com/maps/place/Taj+Mahal/@27.1751448,78.0421422,17z |
hl | string | optional Language of names, categories, addresses and opening hours, as a code (en, hi, ja, de, fr, ko, pt, es, ar, zh...).Default: en |
gl | string | optional Country, as a two-letter code. It changes how Google ranks the places.Default: us |
response_type | string | optional json: the places. html: Google's raw answer as text in html, without places. both: the places and html.Values:jsonhtmlbothDefault: json |
pingback_url | string | optional Queue the search and get the answer later; see Async tasks. |
One call
page and num_pages are not used: one call returns up to 200 places, or one place by URL.What comes back
| Field | Type | Description |
|---|---|---|
search_metadata | object | About this request. |
id | string | A unique id for the search. |
status | string | Success when Google Maps answered. |
created_at | string | When the search ran, in ISO 8601 (UTC). |
pages | integer | Always 1. |
credits_charged | integer | Credits this request cost: 1. |
task_id | string | Only for async tasks: the task the result belongs to. |
search_parameters | object | What the search used: engine, type, q, lat, lon, zoom or distance_max, num (discover) or url (collect), hl, gl and response_type. |
search_information | object | type=discover: query_displayed and total_results (how many places came back). |
local_results | array | type=discover: the places, each with position (1, 2, 3...) and the fields below. |
name, category, all_categories | string / array | The business name, its main category and every category Google gives it. |
address, location_info | string | The full address, and extra place text when Google shows it (like "Agra, Uttar Pradesh, India"). |
phone_number, open_website | string | The phone number and the website, when the business lists them (empty otherwise). |
lat, lon | number | Where the place is. |
rating, reviews_count | number / integer | The average star rating (0.0 means no ratings yet) and the number of Google reviews. |
review_distribution | object / null | Reviews by stars: 1_star_reviews to 5_star_reviews. They add up to reviews_count. |
open_hours | object / null | Opening hours by day, Monday to Sunday ("10:00 AM - 2:00 AM" or "Closed"); null when Google shows none. |
place_id, cid, fid_location | string | Google's ids for the place: place_id for other Google APIs, cid for https://maps.google.com/?cid=<cid>. |
url | string | The place on Google Maps. |
country_code, country | string | The two-letter country code and the country's name. |
description, thumbnail | string | Google's short description and a photo of the place, when there are some (empty otherwise). |
is_claimed, permanently_closed, temporarily_closed | boolean | Whether the owner manages the listing, and whether the place is closed. |
place_results | object | type=collect: the one place, with the same fields. |
html | string | response_type html or both: Google's raw answer, as text. |
Collect one place from its URL
Request
curl -G "https://api.scraperdata.com/v1/search" \
-H "X-API-Key: YOUR_API_KEY" \
--data-urlencode "engine=google_maps" \
--data-urlencode "type=collect" \
--data-urlencode "url=https://www.google.com/maps/place/Taj+Mahal/@27.1751448,78.0421422,17z"200 OK
{
"search_parameters": {
"engine": "google_maps",
"type": "collect",
"url": "https://www.google.com/maps/place/Taj+Mahal/@27.1751448,78.0421422,17z",
"hl": "en",
"gl": "us",
"response_type": "json"
},
"place_results": {
"name": "Taj Mahal",
"category": "Monument",
"all_categories": ["Monument", "Historical place", "Tourist attraction"],
"address": "Taj Mahal, Dharmapuri, Forest Colony, Tajganj, Agra, Uttar Pradesh 282001, India",
"phone_number": "+91 562 222 6431",
"rating": 4.6,
"reviews_count": 253756,
"place_id": "ChIJbf8C1yFxdDkR3n12P4DkKt0",
"country_code": "IN",
"country": "India",
"open_hours": null,
"review_distribution": { "1_star_reviews": 9856, "2_star_reviews": 3771, "3_star_reviews": 9890, "4_star_reviews": 31012, "5_star_reviews": 199227 },
"location_info": "Agra, Uttar Pradesh, India"
}
}Errors
Errors never cost credits. Every error code is on the Errors page; these are the Google Maps ones:
| Field | Type | Description |
|---|---|---|
invalid_type | 400 | type is not discover or collect. |
missing_query | 400 | type=discover without q. |
missing_location, invalid_location | 400 | type=discover without lat and lon, or with values out of range. |
invalid_zoom, invalid_distance, invalid_num | 400 | zoom is not 10 to 18, distance_max is not above 0 and up to 200, or num is not 1 to 200. |
missing_url, invalid_url | 400 | type=collect without url, or a URL that is not a Google Maps place. |
invalid_response_type | 400 | response_type is not json, html or both. |
place_not_found | 404 | The URL was read, but Google Maps has no such place (an old or deleted link). |
upstream_error, upstream_unavailable, upstream_timeout | 502 / 503 / 504 | Google Maps could not be reached in time. Retry in a few seconds. |
400 Bad Request
{
"error": {
"code": "missing_location",
"message": "Google Maps discover needs lat and lon: the centre of the search, like lat=40.7128&lon=-74.006."
},
"charged": false
}Credits
Each call costs one credit, discover or collect, whatever the number of places. Failed searches and places that are not found are free.