> For the complete documentation index, see [llms.txt](https://docs.scraperapi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.scraperapi.com/structured-data-endpoints/search-and-insights/google/google-shopping-api.md).

# 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.

Each item in `shopping_results` includes a `link` field **only when you opt in** by sending `session_number`, `use_session_cookie=true` and `gl`/`hl` with your search. Requesting that `link` (with your API key appended) returns the JSON containing product details, sellers, and offer data. Searches without these parameters do not return a `link` field. See [Product links](#product-links) below.
{% 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><tr><td><code>SESSION_NUMBER</code></td><td>Any number you choose. Required, together with <code>use_session_cookie=true</code> and <code>gl</code>/<code>hl</code>, to receive a working <code>link</code> for each product. Use a <strong>new</strong> <code>session_number</code> for every search; do not reuse one across searches. See <a href="#product-links">Product links</a>.</td></tr><tr><td><code>USE_SESSION_COOKIE</code></td><td>Set to <code>true</code> to keep the Google session cookie tied to the <code>session_number</code>, which is what makes the returned product <code>link</code>s work. Required for product links.</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>. Required when requesting product links (e.g. <code>hl=en</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>. Required when requesting product links (e.g. <code>gl=us</code>).</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>Offset of the first result. Google Shopping returns up to 40 results per page, so use <code>start=40</code> for page 2, <code>start=80</code> for page 3, and so on. Defaults to <code>0</code>. See <a href="#pagination">Pagination</a>.</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,
			"link": "http://api.scraperapi.com/?url=https%3A%2F%2Fwww.google.com%2Fasync%2Foapv%3Fgl%3Dus%26hl%3Den...&autoparse=true&session_number=5672&use_session_cookie=true&api_key="
		},
		{
			"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": {
		"pages_count": 2,
		"current_page": 1,
		"next_page_url": "http://api.scraperapi.com/?url=https%3A%2F%2Fwww.google.com%2Fsearch%3Ftbm%3Dshop%26tbs%3Dvw%253Ag%26q%3Dskateboards%26hl%3Den%26gl%3Dus%26start%3D40&autoparse=true&tld=com&session_number=5672&use_session_cookie=true"
	}
}
```

{% hint style="info" %}
The `link` field appears in `shopping_results` only for searches that include `session_number`, `use_session_cookie=true` and `gl`/`hl`. The sample item above is shown with a `link`; the value is shortened for readability.
{% endhint %}

### Pagination

Google Shopping returns up to 40 results per page. To get the next page, send the same search with `start` increased by 40 (`start=40`, `start=80`, ...). Positions continue across pages, so page 2 starts at position 41.

The `pagination` object in each response describes the current page:

* `current_page` - the page number for this response.
* `pages_count` - the current page, plus one when a next page is offered.
* `next_page_url` - returned when the page has 40 results. Google may have fewer results, or none, on that next page.
* `prev_page_url` - returned on pages after the first.

`next_page_url` and `prev_page_url` do not include your API key. Append `&api_key=API_KEY` before requesting them. For searches that use product links, they keep the same `session_number` and `use_session_cookie=true`, so the next page's results include links too.

### Product links

To get product details, sellers and offers for a result, run the search with the product-link parameters, then request the `link` of the item you want.

**Step 1 - Search with a session**

Use a new `SESSION_NUMBER` for every search.

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

```bash
curl --request GET --url "https://api.scraperapi.com/structured/google/shopping?api_key=API_KEY&query=QUERY&session_number=SESSION_NUMBER&use_session_cookie=true&gl=us&hl=en"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

payload = {
    "api_key": "API_KEY",
    "query": "QUERY",
    "session_number": "SESSION_NUMBER",
    "use_session_cookie": "true",
    "gl": "us",
    "hl": "en"
}

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&session_number=SESSION_NUMBER&use_session_cookie=true&gl=us&hl=en`)
  .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&session_number=SESSION_NUMBER&use_session_cookie=true&gl=us&hl=en";

$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",
  :session_number => "SESSION_NUMBER",
  :use_session_cookie => "true",
  :gl => "us",
  :hl => "en"
}

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 sessionNumber = "SESSION_NUMBER";

            String urlStr = "https://api.scraperapi.com/structured/google/shopping?api_key="
                            + apiKey + "&query=" + query + "&session_number=" + sessionNumber
                            + "&use_session_cookie=true&gl=us&hl=en";

            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 %}

**Step 2 - Request a product `link`**

Every `link` already ends in `&api_key=` with an empty value. Append your API key directly to the end of the link, and request it within 15 minutes:

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

```bash
curl --request GET --url "LINK_FROM_SHOPPING_RESULTSAPI_KEY"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

link = "LINK_FROM_SHOPPING_RESULTS"

r = requests.get(link + "API_KEY")

print(r.text)
```

{% endtab %}

{% tab title="NodeJS" %}

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

const link = 'LINK_FROM_SHOPPING_RESULTS';

fetch(link + 'API_KEY')
  .then(response => response.json())
  .then(data => {
    console.log(data);
  })
  .catch(error => {
    console.error(error);
  });
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$link = "LINK_FROM_SHOPPING_RESULTS";
$url = $link . "API_KEY";

$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'

link = "LINK_FROM_SHOPPING_RESULTS"

uri = URI(link + "API_KEY")

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 link = "LINK_FROM_SHOPPING_RESULTS";

            String urlStr = link + apiKey;

            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 %}

Notes:

* `session_number`, `use_session_cookie=true` and `gl`/`hl` are all required to receive product links. Without them, results do not include a `link` field.
* The session is already embedded in each `link`, so you do not need to send `session_number` again.
* Use a new `session_number` for every search. Reusing one can make earlier links stop working.
* A link expires 15 minutes after the last successful request in its session.
* Requests that use `use_session_cookie=true` do not use fallback routing, so success rates can differ from searches without it.
* Each product link request costs 25 API credits, the same as a standard Google request.

**Product response**

```json
{
	"name": "Tony Hawk Series 31-Inch Skateboard Designed for Beginners and First-Time Skateboarders",
	"brand": "Tony Hawk",
	"description": "The Tony Hawk first time level one skateboard comes with an eye-catching hawk design...",
	"resellers": [
		{
			"name": "Walmart",
			"seller_icon": "https://encrypted-tbn3.gstatic.com/faviconV2?url=https://www.walmart.com&client=SHOPPING&size=32&type=FAVICON&fallback_opts=TYPE,SIZE,URL",
			"url": "https://www.walmart.com/ip/GOOD-TONY-HAWK/15040700420?wmlspartner=wlpa&selectedSellerId=0&veh=seo_fpl&cn=google",
			"price": "$14.96"
		},
		{
			"name": "Poshmark",
			"seller_icon": "https://encrypted-tbn3.gstatic.com/faviconV2?url=https://poshmark.com&client=SHOPPING&size=32&type=FAVICON&fallback_opts=TYPE,SIZE,URL",
			"url": "https://poshmark.com/listing/Tony-Hawk-Signature-Series-Level-One-Beginner-Skateboard-31-x-75-6aa43ec564399b35559235b9",
			"price": "$51.00"
		}
	],
	"images": [
		"https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcQb5mc4jBsusN3bvUl-_io722nRqNsENLMiFdhmAxl5Mnl0xPrMl_8kRHkohopXFIZfX88VMaUyIbkcuXAmhuWtM54HE7mMOWEtbZffSW-4Tt_gJ5lRr9-O"
	]
}
```

Each reseller `url` points directly to the retailer's listing.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
