# Walmart Product API

The `Walmart Product API` endpoint returns detailed information about a Walmart product.

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

```bash
curl --request GET \
--url "https://api.scraperapi.com/structured/walmart/product?\
api_key=API_KEY&product_id=PRODUCT_ID&country_code=COUNTRY_CODE&tld=TLD"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

payload = {
    "api_key": "API_KEY",
    "product_id": "PRODUCT_ID",
    "country_code": "COUNTRY_CODE",
    "tld": "TLD"
}

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

print(r.text)

```

{% endtab %}

{% tab title="NodeJS" %}

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

fetch(
  'https://api.scraperapi.com/structured/walmart/product?api_key=API_KEY&product_id=PRODUCT_ID&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/walmart/product?api_key=API_KEY&product_id=PRODUCT_ID&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",
  :product_id => "PRODUCT_ID",
  :country_code => "COUNTRY_CODE",
  :tld => "TLD"
}

uri = URI('https://api.scraperapi.com/structured/walmart/product')
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 product_id   = "PRODUCT_ID";
            String country_code = "COUNTRY_CODE";
            String tld = "TLD";

            String urlStr = "https://api.scraperapi.com/structured/walmart/product?api_key=" 
                            + apiKey + "&product_id=" + product_id + "&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 %}

**Supported Parameters**

<table><thead><tr><th width="397">Parameters</th><th>Details</th></tr></thead><tbody><tr><td><code>API_KEY</code> (required)</td><td>Your API Key.</td></tr><tr><td><code>PRODUCT_ID</code> (required)</td><td>Walmart Product id. You can find the product ID in the URL. Example: <code>5253396052 (/ip/5253396052)</code></td></tr><tr><td><code>TLD</code></td><td>Top-level Walmart domain to scrape:<br><strong>com</strong> (walmart.com)<br><strong>ca</strong> (walmart.ca)</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.). You can find the full list here.</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>

### Sample Response

```json
{
  "product_name": "AT&T Samsung Galaxy S24 Ultra Titanium Violet 512GB",
  "product_description": "Do more with the most epic Galaxy yet. Capture every detail of your candlelight meal with impressive Nightography and zoom in to see the live violinist playing across the room.Once you’re back in your hotel, elevate your pics from good to great right on your Galaxy S24 Ultra. You can even use your built in S Pen to add fun doodles before posting. Unleash new ways to create, connect and more with Galaxy S24 Ultra. Epic, just like that.",
  "brand": "SAMSUNG",
  "image": "https://i5.walmartimages.com/seo/AT-T-Samsung-Galaxy-S24-Ultra-Titanium-Violet-512GB_784b47ee-bfb7-4543-af9d-5406c37ffed5.fa51da09222008a396f35c6e245e2e2a.jpeg",
  "offers": [
    {
      "url": "https://www.walmart.com/ip/AT-T-Samsung-Galaxy-S24-Ultra-Titanium-Violet-512GB/5253396052",
      "availability": "InStock",
      "available_delivery_method": "OnSitePickup",
      "item_condition": "NewCondition"
    }
  ]
}
```


---

# 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/e-commerce/walmart/walmart-product-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.
