Google Search API
With our Google Search API you can scrape Google Search Result Pages (SERP) with a single API call.
Each successful Google Search API request costs 25 credits
1. Quickstart
The Google Search API endpoint is https://scraperbox.com/api/google
You can send a GET
or POST
request.
Note that you should replace YOUR_API_TOKEN
with your API token.
2. Authentication
Add the token
field to the request to authenticate yourself.
https://scraperbox.com/api/google?token=YOUR_API_TOKEN
Alternatively you can set your token in the Authorization
header.
Authorization: YOUR_API_TOKEN
3. Parameters
Parameter | Type | Default | Description |
---|---|---|---|
q |
string |
'' |
The search query |
proxy_location |
string |
'all' |
The location to use. Use a 2 letter country code, see alpha-2 for a complete list. |
results |
number |
10 |
The number of results to return. Must be between 10 and 100 . |
offset |
number |
0 |
The offset of search results. For example: use offset=10 te search the second page. |
return_html |
boolean |
false |
If true then the endpoint will add a html field to the response with the HTML of the Google search result page. |
4. API Response
The API will return the following JSON response.
{
"organic_results": [
{
"position": 0,
"title": "Undetectable Web Scraping API | ScraperBox",
"link": "https://scraperbox.com",
"displayed_link": "scraperbox.com",
"snippet": "We make scraping fun with our easy to use web scraping API."
},
// etc...
],
// If no ads are found this is omitted.
"ads": [
{
"position": 0,
"title": "A Paid Advertisement Title",
"link": "https://mypaidwebsite.com",
"displayed_link": "mypaidwebsite.com",
"snippet": "Click on this paid ad!",
"block_position": "top" // top or bottom
},
// etc...
],
// If no local_results are found this is omitted.
"local_results": [
{
"position": 0,
"title": "Pizzeria ScraperBox",
"address": "221B Baker Street",
"review_score": 4.3
},
// etc...
],
"search_information": {
"total_results": 100000
},
// Only added if return_html is true
"html": "The HTML of the search result page."
}
5. Errors
If the API fails it will return a 4xx
or 500
status,
along with a JSON error response.
For example, if you supplied the wrong API token, the API returns the following.
{
"errors": {
"token": "Invalid API token provided."
}
}