Code Examples
Copy-paste examples in cURL, Python and JavaScript. Replace key_your_api_key with your key, or set the SCRAPEMAPSAPI_API_KEY environment variable. Prefer a client library? See the SDKs.
Search places
Find restaurants around the centre of Florence. Each call costs 1 credit and returns up to 20 places.
curl -G "https://api.scrapemapsapi.com/v1/places/search" \
-H "X-API-Key: key_your_api_key" \
--data-urlencode "q=trattoria in Florence" \
-d region=it -d lat=43.7696 -d lng=11.2558 -d radius_km=2 -d limit=20Get place details
Opening hours, contacts, attributes and photos of one place, by place ID, CID or feature ID. 1 credit.
curl "https://api.scrapemapsapi.com/v1/places/ChIJ8cLgoQNUKhMReGlaTjwrH40?language=en" \
-H "X-API-Key: key_your_api_key"Download every review
Page through all reviews with cursors until has_more is false. Each page of up to 20 reviews is one call (1 credit); authors come as pseudonymous IDs only.
# First page
curl "https://api.scrapemapsapi.com/v1/places/ChIJ8cLgoQNUKhMReGlaTjwrH40/reviews?sort=newest&limit=20" \
-H "X-API-Key: key_your_api_key"
# Next page: pass pagination.next_cursor as cursor
curl -G "https://api.scrapemapsapi.com/v1/places/ChIJ8cLgoQNUKhMReGlaTjwrH40/reviews" \
-H "X-API-Key: key_your_api_key" \
-d sort=newest -d limit=20 --data-urlencode "cursor=NEXT_CURSOR"Only reviews in one language, translated
Keep the reviews originally written in Italian, with Google's English translation in translated_text.
curl "https://api.scrapemapsapi.com/v1/places/ChIJ8cLgoQNUKhMReGlaTjwrH40/reviews?original_language=it&language=en&sort=lowest&limit=20" \
-H "X-API-Key: key_your_api_key"Resolve a Google Maps link
Users paste links like maps.app.goo.gl/…: resolve them to a place ID first. Each conversion costs 1 credit.
curl -G "https://api.scrapemapsapi.com/v1/places/resolve" \
-H "X-API-Key: key_your_api_key" \
--data-urlencode "input=https://maps.app.goo.gl/x7Qp2Nf9TzVb8LkE6"Handle errors and retry
Retry 429, 502 and 503 with backoff and honour Retry-After; other errors need a fix in the request. Failed calls are never billed.
import time
def get(path, params=None, retries=5):
for attempt in range(retries):
r = requests.get(f"{API}{path}", headers=HEADERS, params=params, timeout=60)
if r.status_code == 200:
return r.json()
if r.status_code in (429, 502, 503):
time.sleep(int(r.headers.get("Retry-After", 2 ** attempt)))
continue
detail = r.json()["detail"]
raise RuntimeError(f"{r.status_code}: {detail}")
raise RuntimeError("still failing after retries")
place = get("/places/ChIJ8cLgoQNUKhMReGlaTjwrH40")["data"]From example to production
The examples above are complete programs, but a script that runs every day needs a few more habits. Keep the API key in an environment variable or a secret manager, never in the code you commit, and call the API from your server rather than from a browser.
Control what you spend: every successful call costs 1 credit, whatever it returns, so ask for full pages (limit=20) and stop paging when you have what you need. Each response reports what it cost in meta.credits_used and in the X-Credits-Used header, with the balance left in X-Credits-Remaining. Errors are free.
To collect only new reviews, sort by newest and stop paging at the first review ID you already stored. Store the place ID (or the CID) of the places you follow, so later calls skip the search and the resolve step. Retry only 429, 502 and 503, waiting for the Retry-After header when it is there; every other error means the request itself has to change.
Each endpoint also has its own page with a sample response and the full list of fields: the Places API, the Place Details API and the Reviews API.