API reference
13 endpoints on one host, authenticated with a header. Every successful request costs one credit, and failures cost nothing.
Authentication
Send your key in the x-api-key header. Keys are shown once when created, on the API keys page. Never ship a key in client-side code — anyone who can read it can spend your credits.
Making a request
Every endpoint takes GET with query string parameters or POST with a JSON body.
curl "https://api.serpdata.dev/google/search/web?q=best%20espresso%20machine" \
-H "x-api-key: $SEARCHAPI_KEY"curl -X POST "https://api.serpdata.dev/google/search/news" \
-H "x-api-key: $SEARCHAPI_KEY" \
-H "content-type: application/json" \
-d '{"q":"openai"}'City targeting
On /google/search/web, combine a canonical-name Google uule with the matching two-letter gl country code. Both search modes support location: mode=simple uses Google's Web results (udm=14), while mode=rich uses the full results page (no udm).
These examples target London, England, United Kingdom. For GET, use URL encoding so the plus sign survives transport. For a POST JSON body, paste the original w+…value. Do not paste an already percent-encoded value into JSON or the playground.
curl --get "https://api.serpdata.dev/google/search/web" \
-H "x-api-key: $SEARCHAPI_KEY" \
--data-urlencode "q=coffee shops near me" \
--data-urlencode "mode=simple" \
--data-urlencode "gl=gb" \
--data-urlencode "uule=w+CAIQICIdTG9uZG9uLEVuZ2xhbmQsVW5pdGVkIEtpbmdkb20="curl -X POST "https://api.serpdata.dev/google/search/web" \
-H "x-api-key: $SEARCHAPI_KEY" \
-H "content-type: application/json" \
-d '{"q":"coffee shops near me","mode":"rich","gl":"gb","uule":"w+CAIQICIdTG9uZG9uLEVuZ2xhbmQsVW5pdGVkIEtpbmdkb20="}'Supply a valid UULE encoded from a canonical name in Google's geographic-target dataset. Raw city names and coordinate-form a+ values are not accepted. Validation checks the value's syntax; it does not verify that the encoded city exists or matches your country. Successful responses echo gl and uule in searchParameters.
Location biases results toward the requested city; it does not exclude every result from elsewhere. In the playground, search for a city, region, or postal code in Location. Selecting a result sets UULE and its matching Country automatically. You can also paste a raw value into Location (UULE) under Advanced. Clear the location for a country-only search. The picker uses English names from Google’s location catalog. Suggestions are sorted by available population estimates from GeoNames, largest first. Locations without a matched population appear last.
Response
{ "searchParameters": { "q": "python asyncio", "type": "search", "engine": "google" }, "organic": [ { "title": "Python's asyncio: A Hands-On Walkthrough", "link": "https://realpython.com/async-io-python/", "snippet": "Python's asyncio library enables you to write concurrent code using the async and await keywords. The core building bloc…", "subtitle": "https://realpython.com › async-io-python", "position": 3, "date": "Jul 30, 2025", "source": "Real Python", "sitelinks": [ { "title": "Async I/O in Python With asyncio", "href": "https://realpython.com/async-io-python/#async-io-in-python-with-asyncio", "style": "chip" } ] } ], "latencyMs": 255, "credits": 1, "creditsRemaining": 2499}Results come back in Google's order. Every response carries your remaining balance as creditsRemaining; the search and vertical routes also carry the credits that call cost, which is always 1. Entities gain fields over time, so parse leniently and ignore what you do not recognize.
Endpoints
Base url https://api.serpdata.dev.
GET/google/search/web
Google web results. Add mode=rich for the full page.
| Name | Type | Description | |
|---|---|---|---|
| q | string | required | The search query. OR can appear at most once; a query with two or more is rejected. |
| mode | simple | rich | optional | simple (default) returns organic results only. rich also returns People Also Ask, top stories, the local pack, shopping, images, videos and related searches. It does not return a knowledge panel. |
| gl | string | optional | Two-letter country code, such as gb. Required when uule is set; choose the country containing that location. |
| uule | string | optional | Canonical-name Google UULE starting with w+. Biases results toward a city in either mode. Requires matching gl; coordinate-form a+ values are not supported. |
| start | string | number | optional | Offset into Google's results, a multiple of 10 up to 90. Each page holds ten results. |
| hl | string | optional | Google's interface language, such as en, de or pt-BR. It sets the page's labels and can change which results rank. |
| lr | string | optional | Only return pages written in these languages, such as lang_de. Join up to ten with |, as in lang_de|lang_fr. |
| tbs | string | optional | Date filter. qdr:d is the past day: use h, d, w, m or y for hour, day, week, month or year, with an optional count, as in qdr:m6. For a custom range, send cdr:1,cd_min:1/31/2026,cd_max:3/1/2026 (month/day/year); either end may be left out. |
| filter | 0 | 1 | optional | 0 also returns the similar results Google normally hides. 1, the default, hides them. |
| cr | string | optional | Only return pages from these countries, such as countryDE. Join up to ten with |, as in countryDE|countryAT. Unlike gl, which localizes results, this excludes pages from other countries. |
| safe | active | off | optional | active turns on SafeSearch, which hides explicit results. off turns it off. |
| nfpr | 0 | 1 | optional | 1 searches for the query exactly as typed, instead of Google's spelling correction. |
POST/google/search/videos
Google Videos results.
| Name | Type | Description | |
|---|---|---|---|
| q | string | required | The search query. OR can appear at most once; a query with two or more is rejected. |
POST/google/search/images
Google Images results.
| Name | Type | Description | |
|---|---|---|---|
| q | string | required | The search query. OR can appear at most once; a query with two or more is rejected. |
POST/google/search/news
Google News results.
| Name | Type | Description | |
|---|---|---|---|
| q | string | required | The search query. OR can appear at most once; a query with two or more is rejected. |
POST/google/search/shopping
Google Shopping results.
| Name | Type | Description | |
|---|---|---|---|
| q | string | required | The search query. OR can appear at most once; a query with two or more is rejected. |
GET/google/maps/place
One business by its Google CID, place ID or feature ID: address, rating, hours, phone, category.
| Name | Type | Description | |
|---|---|---|---|
| cid | string | optional | Google customer id, returned on every /places and /map result. Send one of cid, placeId or fid. |
| placeId | string | optional | Google place ID, such as ChIJwc3zxvNdeUgR7U9zwP-ov3A, the kind the Google Places API returns. Use instead of cid. |
| fid | string | optional | Google feature ID, such as 0x48795df3c6f3cdc1:0x70bfa8ffc0734fed, returned as fid on every /map result. Use instead of cid. |
GET/google/maps/place/reviews
Reviews for one business, page by page.
| Name | Type | Description | |
|---|---|---|---|
| cid | string | optional | Google customer id, returned on every /places and /map result. Send one of cid, placeId or fid. |
| placeId | string | optional | Google place ID, such as ChIJwc3zxvNdeUgR7U9zwP-ov3A, the kind the Google Places API returns. Use instead of cid. |
| fid | string | optional | Google feature ID, such as 0x48795df3c6f3cdc1:0x70bfa8ffc0734fed, returned as fid on every /map result. Use instead of cid. |
| pageToken | string | optional | The nextPageToken from a previous response. |
| sort | relevant | newest | highest | lowest | optional | Review order: relevant (default, Google's own order), newest first, highest rating first, or lowest rating first. Keep the same sort when passing a pageToken. |
| hl | string | optional | Two-letter language code, such as de. Reviews in other languages come back with textTranslated in this language. Defaults to en. |
GET/google/maps/place/photos
Photos for one business.
| Name | Type | Description | |
|---|---|---|---|
| cid | string | optional | Google customer id, returned on every /places and /map result. Send one of cid, placeId or fid. |
| placeId | string | optional | Google place ID, such as ChIJwc3zxvNdeUgR7U9zwP-ov3A, the kind the Google Places API returns. Use instead of cid. |
| fid | string | optional | Google feature ID, such as 0x48795df3c6f3cdc1:0x70bfa8ffc0734fed, returned as fid on every /map result. Use instead of cid. |
GET/google/maps/area/places
Businesses inside a map viewport.
| Name | Type | Description | |
|---|---|---|---|
| query | string | required | The search query. |
| lat | number | required | Latitude of the viewport's center. |
| lng | number | required | Longitude of the viewport's center. |
| zoom | number | optional | Google Maps zoom level. |
| offset | number | optional | Results to skip. |
| limit | number | optional | Results to return. |
POST/google/maps/search/places
Local business results for a query.
| Name | Type | Description | |
|---|---|---|---|
| q | string | required | The search query. |
| lat | number | optional | Latitude of the viewport's center. Omit lat and lng to search nationally. |
| lng | number | optional | Longitude of the viewport's center. |
| limit | number | optional | Results to return, 1 to 200. Defaults to 20. |
POST/google/trends
Google Trends keyword comparisons, geographic breakdowns, related searches and Trending Now.
| Name | Type | Description | |
|---|---|---|---|
| mode | "keyword" | "trending" | optional | Keyword analysis (default) or Trending Now country feed. |
| resolutions | COUNTRY | REGION | CITY | DMA[] | optional | Geographic breakdowns to fetch; empty uses Google’s default. DMA means US metro areas. Each resolution adds a Google request. |
| keywords | string[] | optional | Required in keyword mode; compare one to five keywords or topic IDs. |
| geo | string | optional | |
| time | string | optional | |
| category | number | optional | |
| property | | images | news | youtube | froogle | optional | |
| language | string | optional | |
| timezone | number | optional | |
| sections | interestOverTime | interestByRegion | relatedQueries | relatedTopics[] | optional | |
| hours | 4 | 24 | 48 | 168 | optional | |
| categories | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20[] | optional | Trending Now category IDs (different from Explore categories). Match any selected category; empty selects all. |
| limit | number | optional |
POST/google/autocomplete
The suggestions Google offers as a query is typed.
| Name | Type | Description | |
|---|---|---|---|
| q | string | required | The partial query. |
| gl | string | optional | Two-letter country code, such as gb. |
| hl | string | optional | Two-letter language code, such as en. |
POST/google/search/patents
Google Patents results.
| Name | Type | Description | |
|---|---|---|---|
| q | string | required | The search query. |
| page | number | optional | 1-based page number. |
Rate limits
API keys have no requests-per-second limit. Each request requires an active key and sufficient credits. Service capacity still applies: an overloaded service can return 503, and failed requests do not consume credits.
Errors
| Status | Meaning |
|---|---|
| 400 BAD_REQUEST | A parameter is missing or the wrong shape. Not charged. |
| 401 UNAUTHORIZED | The key is missing, unknown, or revoked. Not charged. |
| 402 INSUFFICIENT_CREDITS | Your balance is lower than the request costs. Top up on the billing page. |
| 404 NOT_FOUND | No such endpoint, or no place with that cid. The credit is returned. |
| 500 INTERNAL_SERVER_ERROR | Something failed on our side. The credit is returned. |
| 502 UPSTREAM_ERROR | The source site refused the request. The credit is returned. |
| 503 SERVICE_UNAVAILABLE | Capacity is temporarily exhausted. The credit is returned. Honor Retry-After. |
| 504 GATEWAY_TIMEOUT | The request outlived its deadline. The credit is returned and it can be retried. |
A 200 costs one credit, including one that finds nothing — an empty result is an answer we had to go and get. Every failure above either never took the credit or gives it back, so retrying a failure cannot drain a balance.
Client library
npm install @serpdata.dev/client gives you a typed client for every endpoint above. It is server-side only, for the same reason keys are: it carries your key.
OpenAPI
/openapi.json is generated from the same contract the API implements, so it cannot drift from what the endpoints above actually return. Import it into Postman or generate a client in your own language.
Search supports country targeting with gl and city targeting with uule. Autocomplete supports country (gl) and language (hl). See each endpoint's parameters above for supported options.