Parameters
The query parameters for every JustSERP endpoint, and how to encode them: shared fields, Google search inputs, AI question and location, reviews profiles and place ids.
Every endpoint is a GET and takes its fields as query parameters. Fields an endpoint does not use are ignored. A parameter that is missing or refused answers 400 with {"error": "..."} and must not be retried. The per-field limits and 400 messages are in each endpoint's page in the API Reference.
Query parameters
The fields on this page are query parameters, for example ?q=coffee&gl=us.
- Values must be URL-encoded:
location=Austin%2CTexas%2CUnited%20States. In curl,-Gwith--data-urlencodedoes it for you.URLSearchParams(JavaScript),params=inrequests(Python) andhttp_build_query(PHP) do too. - A number or
true/falseis read as the type the field takes. - A list repeats its parameter:
include=a&include=b. - An object field is sent as
field[key]=value:business[name]=Joe. - A list or an object can also be sent as one JSON string.
curl -G "https://api.justserp.com/v1/google/maps/place" \
-H "X-API-Key: YOUR_API_KEY" \
--data-urlencode "place_id=ChIJ..." \
--data-urlencode "include=hours" \
--data-urlencode "include=photos"Two request forms
Many endpoints accept two sets of parameters: their own, described on this page, and a document form that uses common SERP-API names (for example q where the first form has query). Both are answered as the document. A request takes one form: sending query together with q is a 400. Each endpoint's page in the API Reference lists both forms and says which fields select the document form.
Google Search has only the document form, described below.
Fields shared by every endpoint
Prop
Type
Google Search
GET /v1/google/search. One request is one results page, answered as the document.
Send q or kgmid. Place the search with at most one of location, uule, or latitude with longitude.
Prop
Type
api_version (v1 or v2) is deprecated. Sending it selects the earlier call, which takes google_domain, start and tbs and answers in an envelope with the result in data. Leave it out to get the document.
Reference: Google Search. For a lighter answer with fewer blocks, see Google Light.
Google Maps, Trends and places
- Maps search (
qrequired;latitudeandlongitudeare sent together or not at all;zoom3 to 21, default 14; leavehlaten;glis the country): Google Maps. A search that matches exactly one place answers that place, not a list. In the document form, sendqwithll(@latitude,longitude,zoom) instead oflatitude,longitudeandzoom. - Trends (
qfor a keyword's related queries and topics,geoalone for a region's trending searches; at least one is required;dateis Explore's time range such astoday 12-m; leavehlaten): Google Trends. - Place details and Google reviews name a place by one of
place_id,data_idordata_cid. Place details takes them in that order and also takescountryandinclude: Maps place. Google reviews also accepts aprofile_urlthis path returned before: Maps reviews.
| Id | Form |
|---|---|
place_id | A Google place id, ChIJ..., 16 to 300 characters. |
data_id | The hex feature id, 0x...:0x.... |
data_cid | The decimal customer id, as a string (it overflows a 53-bit number). |
Refused ids answer 400 with place_id is not a Google place id, data_id is not a feature id (0x...:0x...) or data_cid is not a CID (a whole number).
include on place details lists the sections to return: hours, attributes, services, photos, questions, social. The default is all. A section left out is null ("not loaded"), and an unknown name is refused.
AI answers
Google AI Overview, Google AI Mode and ChatGPT share one request: a query and an optional location.
curl -G "https://api.justserp.com/v1/google/ai-overview" \
-H "X-API-Key: YOUR_API_KEY" \
--data-urlencode "query=Who has the best pizza near Chelsea, New York, NY?" \
--data-urlencode "location[latitude]=40.7455" \
--data-urlencode "location[longitude]=-74.0083" \
--data-urlencode "location[name]=New York, NY" \
--data-urlencode "location[country]=us" \
--data-urlencode "location[language]=en"query is required, 1 to 2000 characters after trimming (query is too long (2000 characters at most)).
location is an object whose every part is optional; a part left out, null or "" is not an error. latitude and longitude are sent together or not at all.
location field | Rules | 400 message |
|---|---|---|
latitude | A number or numeric string, -90 to 90. | location.latitude must be between -90 and 90 |
longitude | A number or numeric string, -180 to 180. | location.longitude must be between -180 and 180 |
name | A label for your own use. Not read; name the town in query. | |
country | Two letters. Google's paths: gl, default us. ChatGPT: the country the question is asked from. | location.country must be a two-letter country code, e.g. us |
language | A language tag such as en or pt-BR. hl on Google's paths (default en); not read by ChatGPT. | location.language must be a language tag, e.g. en or pt-BR |
A location that is not an object answers location must be an object; one with only one of latitude and longitude answers location.latitude and location.longitude must be sent together.
For ChatGPT, name the town in query: a "near me" question is answered for wherever the request was made from.
In the document form, send the question as q instead of query. Google AI Overview and AI Mode then take location, uule or latitude with longitude like Google Search, and ChatGPT takes country. Each endpoint's page lists the rest.
Reference: AI Overview, AI Mode, ChatGPT. Bing Copilot takes its own parameters; see its page.
Reviews
Every review endpoint takes a profile_url (Google takes a place id instead, see above) plus these shared options:
Prop
Type
A profile that does not exist answers 404 profile_not_found.
| Site | profile_url form | Reference |
|---|---|---|
place_id, data_id, data_cid or a google.com/maps... profile_url | Reviews | |
| Yelp | yelp.com/biz/<alias> | Reviews |
facebook.com/<page name>, profile.php?id=<number>, people/<Name>/<number>, p/<Name>-<number> or pages/<Name>/<number> | Reviews | |
| Trustpilot | trustpilot.com/review/<domain>, or the domain alone | Reviews |
| BBB | bbb.org/us/<state>/<city>/profile/<category>/<name>-<id> | Reviews |
| Angi | angi.com/companylist/...-reviews-<id>.htm | Reviews |
| Yellow Pages | yellowpages.com/<city-state>/mip/<name>-<listing id> | Reviews |
| Healthgrades | a provider page (/physician/..., /providers/...) or a group practice page | Reviews |
| Tripadvisor | /Restaurant_Review-g<n>-d<n>-Reviews-..., /Hotel_Review-... or /Attraction_Review-... | Reviews |
A profile_url that does not match its site answers 400, e.g. profile_url must be a Facebook page, profile_url must be a bbb.org business profile, profile_url must be a Yelp business page.
Finding a profile
Where there is a "find" endpoint, send the business and the endpoint returns up to 5 candidate profiles to use as profile_url.
curl -G "https://api.justserp.com/v1/google/maps/reviews/find" \
-H "X-API-Key: YOUR_API_KEY" \
--data-urlencode "business[name]=Joe's Pizza Broadway" \
--data-urlencode "business[address]=1435 Broadway, New York, NY 10018" \
--data-urlencode "business[phone]=+1 212-366-1182" \
--data-urlencode "business[website]=http://joespizzanyc.com/" \
--data-urlencode "business[latitude]=40.7546795" \
--data-urlencode "business[longitude]=-73.9870291" \
--data-urlencode "country=us"business.name is required. How each site uses the rest:
- Google: searches Maps for
nameandaddress, aroundlatitudeandlongitudewhen given. - Trustpilot: searches by the domain of
websitewhen sent, else byname. - BBB:
nameand the town fromaddress.countrycasearches Canada, anything else the USA. - Yellow Pages:
nameand "City, ST" fromaddress. - Healthgrades:
nameas "who" and the town fromaddressas "where". The candidates are providers. - Facebook: Facebook has no search a visitor can use, so this reads
websitefor links to the page.load_candidates(defaultfalse) opens up to 3 pages found to fill inname,addressandphone.
phone is not searched with; it is for your own matching. Angi, Tripadvisor and Yelp have no find.
Yelp
- Yelp search:
locationis required (location is required: the place to search, e.g. "Austin, TX"), and one ofqueryorcategory(query (or category) is required in the request body). Optional:start(0 to 1000, default 0, 10 for the second page),sort_by(recommended,ratingorreview_count),attrs,country. In the document form, sendqandlocationwithpage(1 to 24) instead. - Yelp business page:
place_id(Yelp's id or alias, which search returns inplace_ids) orprofile_url, pluscountry. Addyelp_domain: "yelp.com"for the document form. - Yelp reviews:
profile_urland the shared review options. In the document form, send Yelp's 22-characterplace_idand noprofile_url.
Cancelling
GET /v1/cancel takes ?cancel_token=.... See Errors & billing.
Authentication
Authenticate JustSERP API requests with your API key in the X-API-Key header, as an Authorization Bearer token or as the apikey query parameter, and see the 401 and 403 responses.
Errors & billing
Every JustSERP API status code and failure reason, which responses to retry, how to cancel a request, and which responses are charged.