# Walmart Category API

The `Walmart Category API` endpoint returns a list of products for a specified product category.

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

```bash
curl --request GET \
--url "https://api.scraperapi.com/structured/walmart/category?api_key=API_KEY&\
category=CATEGORY&country_code=COUNTRY_CODE&tld=TLD&page=PAGE"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

payload = {
    "api_key": "APIKEY",
    "category": "CATEGORY",
    "country_code": "COUNTRY_CODE",
    "tld": "TLD",
    "page": "PAGE"
}

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

print(r.text)
```

{% endtab %}

{% tab title="NodeJS" %}

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

fetch(`https://api.scraperapi.com/structured/walmart/category?api_key=API_KEY&category=CATEGORY&country_code=COUNTRY_CODE&tld=TLD&page=PAGE`)
  .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/category?api_key=API_KEY&category=CATEGORY&country_code=COUNTRY_CODE&tld=TLD&page=PAGE";

$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",
  :category => "CATEGORY",
  :country_code => "COUNTRY_CODE",
  :tld => "TLD",
  :page => "PAGE"
}

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

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

            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>User's normal API Key</td></tr><tr><td><code>CATEGORY</code> (required)</td><td><p>Walmart category ID as identifier. You can find the walmart category ID in the URL. Example: <code>3944_1089430_37807</code></p><p><code>(/browse/3944_1089430_37807)</code></p></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>PAGE</code></td><td>Page number.</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
{
  "items": [
    {
      "availability": "In stock",
      "id": "3J43T201K1LI",
      "image": "https://i5.walmartimages.com/seo/HP-Smart-Tank-5000-Wireless-All-in-One-Supertank-Color-Home-Inkjet-Printer-with-up-to-2-Years-of-Ink_3a18e497-8a50-4be3-9012-415ad1094da0.4528c76422642a0564c8d84803c20dbd.jpeg?odnHeight=180&odnWidth=180&odnBg=FFFFFF",
      "name": "HP Smart Tank 5000 Wireless All-in-One Supertank Color Home Inkjet Printer with up to 2 Years of Ink",
      "price": 159,
      "rating": {
        "average_rating": 4.2,
        "number_of_reviews": 143
      },
      "seller": "Walmart.com",
      "url": "https://www.walmart.com/ip/HP-Smart-Tank-5000-Wireless-All-in-One-Supertank-Color-Home-Inkjet-Printer-with-up-to-2-Years-of-Ink/2754784122"
    },
    {
      "availability": "In stock",
      "id": "12YCBWOTEZ5J",
      "image": "https://i5.walmartimages.com/seo/902XL-Ink-Cartridges-HP-902-OfficeJet-Pro-6978-6968-6970-6958-6962-6975-6960-Printer-5-Pack-2-Black-1Cyan-1-Magenta-Yellow_51f14f48-9407-4a59-abd3-7cb7287b5898.928b436866c408d5ca2045439d0477aa.jpeg?odnHeight=180&odnWidth=180&odnBg=FFFFFF",
      "name": "902XL Ink Cartridges for HP 902XL 902 Ink Cartridges for HP OfficeJet Pro 6978 6968 6970 6958 6962 6975 6960 Printer (5 Pack, 2 Black, 1Cyan, 1 Magenta, 1 Yellow)",
      "price": 27.99,
      "rating": {
        "average_rating": 4.8,
        "number_of_reviews": 139
      },
      "seller": "PYMBLE US",
      "url": "https://www.walmart.com/ip/902XL-Ink-Cartridges-HP-902-OfficeJet-Pro-6978-6968-6970-6958-6962-6975-6960-Printer-5-Pack-2-Black-1Cyan-1-Magenta-Yellow/1989803049?athbdg=L1600"
    },
    {
      "availability": "In stock",
      "id": "1QYVJOWU7FWQ",
      "image": "https://i5.walmartimages.com/seo/240XL-241XL-Ink-Cartridges-Canon-ink-240-241-Pixma-MG3620-TS5120-MG2120-MG3520-MX452-MX512-MX532-MX472-1-Black-1-Tri-Color_48e6d3ee-3e0c-4acd-bce2-14bbf27eaf34.a4ca28f9969715c7ba17e0c62c40a93b.jpeg?odnHeight=180&odnWidth=180&odnBg=FFFFFF",
      "name": "240XL 241XL Ink Cartridges for Canon ink 240 and 241 for Canon 240XL and 241XL for Canon Pixma MG3620 TS5120 MG2120 MG3520 MX452 MX512 MX532 MX472 (1 Black, 1 Tri-Color)",
      "price": 38.5,
      "rating": {
        "average_rating": 4.7,
        "number_of_reviews": 264
      },
      "seller": "PYMBLE US",
      "url": "https://www.walmart.com/ip/240XL-241XL-Ink-Cartridges-Canon-ink-240-241-Pixma-MG3620-TS5120-MG2120-MG3520-MX452-MX512-MX532-MX472-1-Black-1-Tri-Color/443556321?athbdg=L1600"
    },
    {
      "availability": "In stock",
      "id": "36B5P800KLP3",
      "image": "https://i5.walmartimages.com/seo/Epson-EcoTank-ET-2803-Wireless-All-in-One-Cartridge-Free-Printer_44e4f66f-4a35-4901-864d-a650a3e88528.96ce12f80dbf993811ca51c1758670f2.jpeg?odnHeight=180&odnWidth=180&odnBg=FFFFFF",
      "name": "Epson EcoTank ET-2803 Wireless All-in-One Cartridge-Free Printer",
      "price": 199.99,
      "rating": {
        "average_rating": 4.2,
        "number_of_reviews": 1133
      },
      "seller": "Walmart.com",
      "url": "https://www.walmart.com/ip/Epson-EcoTank-ET-2803-Wireless-All-in-One-Cartridge-Free-Printer/514027934"
    },
    {
      "availability": "In stock",
      "id": "4KA748QEU6NU",
      "image": "https://i5.walmartimages.com/asr/91dda41f-4ff2-4346-8518-7240a8f59f78.732b29f5be465a02cf22d2cbe53111b6.jpeg?odnHeight=180&odnWidth=180&odnBg=ffffff",
      "name": "Epson 202 Standard-capacity Black Ink Cartridge for XP-5100 and WF-2860",
      "price": 19.99,
      "rating": {
        "average_rating": 3.9,
        "number_of_reviews": 188
      },
      "seller": "Walmart.com",
      "url": "https://www.walmart.com/ip/Epson-202-Standard-capacity-Black-Ink-Cartridge-for-XP-5100-and-WF-2860/949902431"
    },
    {
      "availability": "In stock",
      "id": "5RNPA9IZXPOO",
      "image": "https://i5.walmartimages.com/asr/89c4340f-5616-45d2-8318-49120b2ec41f.998514092cff307715a873d1cc3f4d55.jpeg?odnHeight=180&odnWidth=180&odnBg=ffffff",
      "name": "Brother Genuine TN730 Standard Yield Black Toner Cartridge -2-Pack",
      "price": 89.04,
      "rating": {
        "average_rating": 3.2,
        "number_of_reviews": 107
      },
      "seller": "eToner",
      "url": "https://www.walmart.com/ip/Brother-Genuine-TN730-Standard-Yield-Black-Toner-Cartridge-2-Pack/292435862"
    },
    {
      "availability": "In stock",
      "id": "6L19QH5ILD1C",
      "image": "https://i5.walmartimages.com/asr/4557827d-d071-4747-abbc-e04f20c9f903_1.4106c455bd7a302db40f54b7642eb551.jpeg?odnHeight=180&odnWidth=180&odnBg=ffffff",
      "name": "Canon 6517B001 (CLI-251) ChromaLife100+ Ink Gray",
      "price": 14.99,
      "rating": {
        "average_rating": 4.5,
        "number_of_reviews": 21
      },
      "seller": "Walmart.com",
      "url": "https://www.walmart.com/ip/Canon-6517B001-CLI-251-ChromaLife100-Ink-Gray/29670564"
    }
  ],
  "meta": {
    "page": 3,
    "pages": 25
  }
}
```


---

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