# Google Shopping API

The `Google Shopping API` endpoint returns shopping data from a Google shopping results page and transform it into usable JSON.

{% tabs %}
{% tab title="cURL" %}

```bash
curl --request GET \
--url "https://api.scraperapi.com/structured/google/shopping?api_key=API_KEY&\
query=QUERY&country_code=COUNTRY_CODE&tld=TLD"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

payload = {
    "api_key": "API_KEY",
    "query": "QUERY",
    "country_code": "COUNTRY_CODE",
    "tld": "TLD"
}

r = requests.get('https://api.scraperapi.com/structured/google/shopping', params=payload)

print(r.text)
```

{% endtab %}

{% tab title="NodeJS" %}

```javascript
import fetch from 'node-fetch';

fetch(`https://api.scraperapi.com/structured/google/shopping?api_key=API_KEY&query=QUERY&country_code=COUNTRY_CODE&tld=TLD`)
  .then(response => response.json())
  .then(data => {
    console.log(data);
  })
  .catch(error => {
    console.error(error);
  });
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$url = "https://api.scraperapi.com/structured/google/shopping?api_key=API_KEY&query=QUERY&country_code=COUNTRY_CODE&tld=TLD";

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);

$response = curl_exec($ch);
curl_close($ch);

print_r($response);
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'net/http'
require 'json'

params = {
  :api_key => "API_KEY",
  :query => "QUERY",
  :country_code => "COUNTRY_CODE",
  :tld => "TLD"
}

uri = URI('https://api.scraperapi.com/structured/google/shopping')
uri.query = URI.encode_www_form(params)

website_content = Net::HTTP.get(uri)
print(website_content)
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class Main {
    public static void main(String[] args) {
        try {
            String apiKey = "API_KEY";
            String query   = "QUERY";
            String country_code = "COUNTRY_CODE";
            String tld = "TLD";

            String urlStr = "https://api.scraperapi.com/structured/google/shopping?api_key=" 
                            + apiKey + "&query=" + query + "&country_code=" + country_code + "&tld=" + tld;

            URL url = new URL(urlStr);
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setRequestMethod("GET");

            int responseCode = conn.getResponseCode();
            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
                StringBuilder response = new StringBuilder();
                String line;
                while ((line = in.readLine()) != null) {
                    response.append(line);
                }
                in.close();
                System.out.println(response.toString());
            } else {
                System.out.println("Error in API Call. Response code: " + responseCode);
            }

        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
Google has deprecated the legacy Google Shopping **product** endpoint and now serves product and seller offer data through its immersive API. Individual product links no longer resolve to standalone product pages and instead load seller offerings dynamically via an AJAX request. As a result, the `link` value returned by the Google Shopping SDE now points to a ScraperAPI URL that must be requested separately to retrieve the JSON containing product details, sellers, and offer data.
{% endhint %}

**Supported Parameters**

<table><thead><tr><th width="264">Parameter</th><th>Details</th></tr></thead><tbody><tr><td><code>API_KEY</code>(required)</td><td>Your API Key.</td></tr><tr><td><code>QUERY</code>(required)</td><td>Example: Skateboards</td></tr><tr><td><code>TLD</code></td><td>Country of Google domain to scrape. This is an optional argument and defaults to “com” (google.com). Valid values include:<br><strong>com</strong> (google.com)<br><strong>co.uk</strong> (google.co.uk)<br><strong>ca</strong> (google.ca)<br><strong>de</strong> (google.de)<br><strong>es</strong> (google.es)<br><strong>fr</strong> (google.fr)<br><strong>it</strong> (google.it)<br><strong>co.jp</strong> (google.co.jp)<br><strong>in</strong> (google.in)<br><strong>cn</strong> (google.cn)<br><strong>com.sg</strong> (google.com.sg)<br><strong>com.mx</strong> (google.com.mx)<br><strong>ae</strong> (google.ae)<br><strong>com.br</strong> (google.com.br)<br><strong>nl</strong> (google.nl)<br><strong>com.au</strong> (google.com.au)<br><strong>com.tr</strong> (google.com.tr)<br><strong>sa</strong> (google.sa)<br><strong>se</strong> (google.se)<br><strong>pl</strong> (google.pl)</td></tr><tr><td><code>COUNTRY_CODE</code></td><td>Valid values are two letter country codes for which we offer Geo Targeting (e.g. “<strong>au</strong>”, “<strong>es</strong>”, “<strong>it</strong>”, etc.). Where a Google domain needs to be scraped from another country (e.g. scraping google.com from Canada), both <strong>TLD</strong> and <strong>COUNTRY_CODE</strong> parameters must be specified.</td></tr><tr><td><code>OUTPUT_FORMAT</code></td><td><p>For structured data methods we offer CSV and JSON output. JSON is default if parameter is not added. Options:</p><ul><li>csv</li><li>json (default)</li></ul></td></tr></tbody></table>

### **Google parameters supported by this endpoint** <a href="#google-parameters-supported-by-this-endpoint" id="google-parameters-supported-by-this-endpoint"></a>

<table><thead><tr><th width="205">Google Parameters</th><th>Details</th></tr></thead><tbody><tr><td><code>UULE</code></td><td>Set a region for a search. For example: w+CAIQICINUGFyaXMsIEZyYW5jZQ. You can find an online UULE generator <a href="https://site-analyzer.pro/services-seo/uule/">here</a>.</td></tr><tr><td><code>HL</code></td><td>Host Language. For example: <code>DE</code></td></tr><tr><td><code>GL</code></td><td>Boosts matches whose country of origin matches the parameter value. For example: <code>DE</code></td></tr><tr><td><code>TBS</code></td><td><p>Limits results to a specific time range. For example: <code>tbs=d</code> returns results from the past day. Possible values:<br><code>tbs=h</code> - Hour</p><p><code>tbs=d</code> - Day</p><p><code>tbs=w</code> - Week</p><p><code>tbs=m</code> - Month</p><p><code>tbs=y</code> - Year</p></td></tr><tr><td><code>IE</code></td><td>Character encoding how the engine interpret the query string. For example: <code>UTF8</code></td></tr><tr><td><code>OE</code></td><td>Character encoding used for the results. For example: <code>UTF8</code></td></tr><tr><td><code>START</code></td><td>Set the starting offset in the result list. When <code>start=10</code> set the first element in the result list will be the 10th search result. (meaning it starts with page 2 of results if the "num" is 10)</td></tr></tbody></table>

### Sample Response

```json
{
	"search_information": {},
	"ads": [],
	"shopping_results": [
		{
		.............
	{
			"position": 11,
			"title": "Madd Gear Beginner Skateboard",
			"source": "Walmart",
			"price": "$20.23",
			"extracted_price": 20.23,
			"thumbnail": "https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcQeYA58_jM8TimGqMSgoIUyZ1nr9LbaTvLmmp4nqk_SZCcZlgqjkTFO6wTypzAc8cG7oNu2NwNBraeukpCIieX0Z2ZtX3aS3roKZGsF-6dUwhpgLIm77Fik"
		},
		{
			"position": 12,
			"title": "Santa Cruz Screaming Hand Complete Skateboard",
			"source": "NHS Skate Direct",
			"price": "$122.95",
			"extracted_price": 122.95,
			"thumbnail": "https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcQrGP4cRumkK9lkXiEHBbcbvmv_eb-00Qrjus2UJASB6LDvZ1chfOZstkZxiUh9oZjKnjhR5NP5b9DC21miFjweLaj-BIYQpTsqHlJj85i9YNXe_WU6LB82",
			"delivery_options": "Free delivery by Fri",
			"delivery_options_extracted_price": 0
		},
		{
			"position": 13,
			"title": "Haters Skateboard",
			"source": "dgk.com",
			"price": "$130.00",
			"extracted_price": 130,
			"thumbnail": "https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcTYZq59PrqlLndr6mWaqN3-SIjlTxCOAJpR50MNaSnN5NnMS2Uy4vN9a4yjbCD4bsIu4X-KR-Giyu_gD0TdLUwH0YohXHmP7IkUE2qVs3xY-fW0PpAIXQFsHQ",
			"delivery_options": "Free delivery",
			"delivery_options_extracted_price": 0
		},
		{
			"position": 14,
			"title": "SK8MAFIA Twisted Kremer Skateboard",
			"source": "Zumiez",
			"price": "$129.95",
			"extracted_price": 129.95,
			"thumbnail": "https://encrypted-tbn0.gstatic.com/shopping?q=tbn:ANd9GcT45JMIe1Dqtk4iIhG7RQYwdetZwBO1egQJ_GtcfzWNv6M9R8xw7BZA6eCGJzZiubNRxJsOmhJtjdQnchQPfrsxQQ0TTujCERb3YQAZ9xqGaHdv1ScCy4ijcg"
		},
		{
			"position": 15,
			"title": "CCS Logo Skateboard Complete - Black",
			"source": "CCS",
			"price": "$89.95",
			"extracted_price": 89.95,
			"thumbnail": "https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcQjqUpXF56QFSqjmk_zKLG-rjy3gUWlLV3cc55fJVQ0hsFI8hwH-9vMj-yTAhElD3iOmoUJYWNRSJdmEAaQIGfmodmFjzulu3ZW2AtuuicGFDjU8W20vQ4",
			"delivery_options": "Free next-day delivery",
			"delivery_options_extracted_price": 0
		},
		{
			"position": 16,
			"title": "Santa Cruz Screaming Big Mouth Full Complete Skateboard",
			"source": "Skate Warehouse",
			"price": "$122.95",
			"extracted_price": 122.95,
			"thumbnail": "https://encrypted-tbn0.gstatic.com/shopping?q=tbn:ANd9GcQwpVTJCKOERuJ5-kSkyDixnTIZxVaLSVKu2PzgkfTYYV6C_wXUbe0hH1jiF_BrTRL7zCHILfwzs1BK3M5bH7CWwKGDm3-d5RxaVFboix7ktzldB2vJb7eM",
			"delivery_options": "Free delivery by Wed",
			"delivery_options_extracted_price": 0
		},
		{
			"position": 17,
			"title": "Tony Hawk Series 1 Skateboard",
			"source": "DICK'S Sporting Goods",
			"price": "$27.99",
			"extracted_price": 27.99,
			"thumbnail": "https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcTNH3a9G-5HXpqUUJYicxVM_mN-9aIbezqVbissrpY6SJiOMhsRy9t8c9PpDivyAm5v8NVV2rgorVMW-RMkSu54YoQfuwqqx448iyteINIrulbeZqjoBPgsEA"
		},
		{
			"position": 18,
			"title": "Santa Cruz Screaming Hand Premium Complete Skateboard",
			"source": "Santa Cruz Skateboards",
			"price": "$155.95",
			"extracted_price": 155.95,
			"thumbnail": "https://encrypted-tbn1.gstatic.com/shopping?q=tbn:ANd9GcQRocaXOYnELvnSZvveaDMJns2rOBw0-dPtj-lan8GnwjZyXOc8w6RWECa7l72KcXSO7FLl-SI6pG_lHDgJbDfjB_PjEoE-PmLnWC5HqTIrVYavgTMEsEU",
			"delivery_options": "Free delivery by Thu",
			"delivery_options_extracted_price": 0
		},
],
	"top_features": [],
	"filtered_results": [],
	"related_searches": [],
	"pagination": {
		"load_more_url": "http://api.scraperapi.com/?url=https%3A%2F%2Fwww.google.com%2Fsearch%3Fq%3DSkateboards%26sca_esv%3Df73b742cd81453a2%26gl%3DUS%26hl%3Den%26udm%3D28%26prmd%3Divnsmb%26ei%3DPLM2aa2GBJ3wwPAP58aP0A8%26start%3D10%26sa%3DN&autoparse=true&tld=com",
		"pages_count": 1
	}
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.scraperapi.com/structured-data-endpoints/search-and-insights/google/google-shopping-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
