> 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/e-commerce/homedepot/homedepot-search-api-async.md).

# Home Depot Search API (Async)

The `Home Depot Search API` endpoint returns a list of Home Depot products based on a search term.

**Single Query Request**

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

```bash
curl -X POST \
	-H "Content-Type: application/json" \
	-d '{
			"apiKey": "API_KEY",
			"search_term": "SEARCH_TERM",
			"page": "PAGE",
			"sort_by": "SORT_BY",
			"callback": {
				"type": "webhook",
				"url": "YYYYY"
			}
		}' \
"https://async.scraperapi.com/structured/homedepot/search"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://async.scraperapi.com/structured/homedepot/search"
headers = {
    "Content-Type": "application/json"
}
data = {
    "apiKey": "API_KEY",
    "search_term": "SEARCH_TERM",
    "page": "PAGE",
    "sort_by": "SORT_BY",
    "callback": {
        "type": "webhook",
        "url": "YYYYY"
    }
}

response = requests.post(url, json=data, headers=headers)
print(response.text)
```

{% endtab %}

{% tab title="NodeJS" %}

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

const options = {
  method: 'POST',
  body: JSON.stringify({
    apiKey: 'API_KEY',
    search_term: 'SEARCH_TERM',
    page: 'PAGE',
    sort_by: 'SORT_BY',
    callback: {
            type: 'webhook',
            url: 'YYYYY' }}),
  headers: {
    'Content-Type': 'application/json',
  },
}

fetch('https://async.scraperapi.com/structured/homedepot/search', options)
  .then(response => {
    response.text().then(text => console.log(text));
  })
  .catch(error => {
    console.log(error)
  })
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$curl = curl_init();
$data = json_encode(array(
    'apiKey' => 'API_KEY',
    'search_term' => 'SEARCH_TERM',
    'page' => 'PAGE',
    'sort_by' => 'SORT_BY',
    'callback' => array(
        'type' => 'webhook',
        'url' => 'YYYYY'
    )
));
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://async.scraperapi.com/structured/homedepot/search',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => $data,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json'
  ),
));
$response = curl_exec($curl);
if (curl_errno($curl)) {
    echo 'Error:' . curl_error($curl);
} else {
    echo $response;
}
curl_close($curl);
?>
```

{% endtab %}

{% tab title="Ruby" %}

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

uri = URI('https://async.scraperapi.com/structured/homedepot/search')
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = {
  apiKey: 'API_KEY',
  search_term: 'SEARCH_TERM',
  page: 'PAGE',
  sort_by: 'SORT_BY',
  callback: {
    type: 'webhook',
    url: 'YYYYY'
  }
}.to_json
begin
  response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
  end
  puts response.body
rescue => e
  puts "Error: #{e.message}"
end
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import javax.net.ssl.HttpsURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) {
        try {
            String apiKey = "API_KEY";
            String jsonInputString = "{"
                + "\"apiKey\": \"" + apiKey + "\", "
                + "\"search_term\": \"SEARCH_TERM\", "
                + "\"page\": \"PAGE\", "
                + "\"sort_by\": \"SORT_BY\", "
                + "\"callback\": {"
                + "    \"type\": \"webhook\", "
                + "    \"url\": \"YYYYY\""
                + "}}";

            URL url = new URL("https://async.scraperapi.com/structured/homedepot/search");
            HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
            connection.setRequestMethod("POST");
            connection.setRequestProperty("Content-Type", "application/json");
            connection.setRequestProperty("Accept", "*/*");
            connection.setDoOutput(true);
            try (OutputStream os = connection.getOutputStream()) {
                byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
                os.write(input, 0, input.length);
            }
            int responseCode = connection.getResponseCode();
            StringBuilder response = new StringBuilder();
            BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
            String readLine;
            while ((readLine = in.readLine()) != null) {
                response.append(readLine);
            }
            in.close();
            if (responseCode == HttpURLConnection.HTTP_OK) {
                System.out.println("Response: " + response.toString());
            } else {
                throw new Exception("Error in API Call: Response code " + responseCode + "\nbody: " + response.toString());
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Multiple Queries Request**

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

```bash
curl -X POST \
	-H "Content-Type: application/json" \
	-d '{
			"apiKey": "API_KEY",
			"search_terms": ["SEARCH_TERM1", "SEARCH_TERM2"],
			"sort_by": "SORT_BY",
			"callback": {
				"type": "webhook",
				"url": "YYYYY"
			}
		}' \
"https://async.scraperapi.com/structured/homedepot/search"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://async.scraperapi.com/structured/homedepot/search"
headers = {
    "Content-Type": "application/json"
}
data = {
    "apiKey": "API_KEY",
    "search_terms": ["SEARCH_TERM1", "SEARCH_TERM2"],
    "sort_by": "SORT_BY",
    "callback": {
        "type": "webhook",
        "url": "YYYYY"
    }
}

response = requests.post(url, json=data, headers=headers)
print(response.text)
```

{% endtab %}

{% tab title="NodeJS" %}

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

const options = {
  method: 'POST',
  body: JSON.stringify({
    apiKey: 'API_KEY',
    search_terms: ['SEARCH_TERM1', 'SEARCH_TERM2'],
    sort_by: 'SORT_BY',
    callback: {
            type: 'webhook',
            url: 'YYYYY' }}),
  headers: {
    'Content-Type': 'application/json',
  },
}

fetch('https://async.scraperapi.com/structured/homedepot/search', options)
  .then(response => {
    response.text().then(text => console.log(text));
  })
  .catch(error => {
    console.log(error)
  })
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$curl = curl_init();
$data = json_encode(array(
    'apiKey' => 'API_KEY',
    'search_terms' => ['SEARCH_TERM1', 'SEARCH_TERM2'],
    'sort_by' => 'SORT_BY',
    'callback' => array(
        'type' => 'webhook',
        'url' => 'YYYYY'
    )
));
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://async.scraperapi.com/structured/homedepot/search',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => $data,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json'
  ),
));
$response = curl_exec($curl);
if (curl_errno($curl)) {
    echo 'Error:' . curl_error($curl);
} else {
    echo $response;
}
curl_close($curl);
```

{% endtab %}

{% tab title="Ruby" %}

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

uri = URI('https://async.scraperapi.com/structured/homedepot/search')
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = {
  apiKey: 'API_KEY',
  search_terms: ['SEARCH_TERM1', 'SEARCH_TERM2'],
  sort_by: 'SORT_BY',
  callback: {
    type: 'webhook',
    url: 'YYYYY'
  }
}.to_json
begin
  response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
    http.request(request)
  end
  puts response.body
rescue => e
  puts "Error: #{e.message}"
end
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import javax.net.ssl.HttpsURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;

public class Main {
    public static void main(String[] args) {
        try {
            String apiKey = "API_KEY";
            String jsonInputString = "{"
                + "\"apiKey\": \"" + apiKey + "\", "
                + "\"search_terms\": [\"SEARCH_TERM1\", \"SEARCH_TERM2\"], "
                + "\"sort_by\": \"SORT_BY\", "
                + "\"callback\": {"
                + "    \"type\": \"webhook\", "
                + "    \"url\": \"YYYYY\""
                + "}}";

            URL url = new URL("https://async.scraperapi.com/structured/homedepot/search");
            HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
            connection.setRequestMethod("POST");
            connection.setRequestProperty("Content-Type", "application/json");
            connection.setRequestProperty("Accept", "*/*");
            connection.setDoOutput(true);
            try (OutputStream os = connection.getOutputStream()) {
                byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
                os.write(input, 0, input.length);
            }
            int responseCode = connection.getResponseCode();
            StringBuilder response = new StringBuilder();
            BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
            String readLine;
            while ((readLine = in.readLine()) != null) {
                response.append(readLine);
            }
            in.close();
            if (responseCode == HttpURLConnection.HTTP_OK) {
                System.out.println("Response: " + response.toString());
            } else {
                throw new Exception("Error in API Call: Response code " + responseCode + "\nbody: " + response.toString());
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Supported Parameters**

<table data-search="false"><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>SEARCH_TERM</code> (required)</td><td><p>Search term. <strong>Required unless <code>URL</code> is provided.</strong></p><p></p><p><strong>Example:</strong></p><p><code>milwaukee cordless drill</code><br></p><p>To submit several searches in one request, send them as an array in <code>search_terms</code> instead. Each search term creates its own job.</p></td></tr><tr><td><code>URL</code></td><td><p>A Home Depot search results URL, used instead of <code>SEARCH_TERM</code>. Both <code>/s/</code> (keyword search) and <code>/b/</code> (category browse) URLs are accepted. </p><p></p><p><strong>Example:</strong></p><p><code>https://www.homedepot.com/s/milwaukee%20cordless%20drill?Nao=24</code></p><p><br><strong>Note:</strong> When <code>URL</code> is provided, <code>PAGE</code>, <code>SORT_BY</code>, <code>MIN_PRICE</code> and <code>MAX_PRICE</code> are ignored. Paginate or refine by changing the URL itself, or follow <code>pagination.next.link</code>.</p></td></tr><tr><td><code>PAGE</code></td><td>Page number, sent as a string (e.g. <code>"2"</code>). Each page contains up to 24 results. Defaults to <code>"1"</code>.</td></tr><tr><td><code>SORT_BY</code></td><td><p>Instructs the API to sort the results. Supported values:</p><p><br>best_seller<br>most_popular<br>price_low_to_high<br>price_high_to_low<br>highest_rating</p></td></tr><tr><td><code>MIN_PRICE</code></td><td>Minimum product price in USD, sent as a string (e.g. <code>"100"</code>).</td></tr><tr><td><code>MAX_PRICE</code></td><td>Maximum product price in USD, sent as a string (e.g. <code>"500"</code>).</td></tr><tr><td><code>OUTPUT_FORMAT</code></td><td><p>This endpoint returns JSON output only. CSV is not supported.<br></p><p><strong>Options:</strong><br>• json (default)</p></td></tr></tbody></table>

{% hint style="info" %}
Home Depot's result ranking can change between requests, so the same product may appear on more than one page. Use `item_id` to deduplicate results when paginating.
{% endhint %}

{% hint style="warning" %}
Results are localized to a default Home Depot store (returned in `location_info`). Selecting a specific store or ZIP code is not currently supported, so `fulfillment` data (pickup, ship-to-store, stock levels) reflects that default store only.
{% endhint %}

### Sample Response

Single Query Request

```json
{
  "id": "f58ca422-f145-49a4-9a1f-e7b516ec2efe",
  "attempts": 0,
  "status": "running",
  "statusUrl": "https://async.scraperapi.com/jobs/f58ca422-f145-49a4-9a1f-e7b516ec2efe",
  "search_term": "milwaukee cordless drill",
  "sort_by": "price_low_to_high"
}
```

Multiple Queries Request

```json
[
  {
    "id": "34e9b812-1ca4-422f-bb05-abc8ff88a648",
    "attempts": 0,
    "status": "running",
    "statusUrl": "https://async.scraperapi.com/jobs/34e9b812-1ca4-422f-bb05-abc8ff88a648",
    "search_term": "milwaukee cordless drill",
    "sort_by": "price_low_to_high"
  },
  {
    "id": "db125fe4-968a-49f3-b128-14fd2260ab45",
    "attempts": 0,
    "status": "running",
    "statusUrl": "https://async.scraperapi.com/jobs/db125fe4-968a-49f3-b128-14fd2260ab45",
    "search_term": "dewalt cordless drill",
    "sort_by": "price_low_to_high"
  }
]
```

After the job(s) finish, you will find the result under the <mark style="color:red;">response</mark> key in the response JSON object. The structure is the same as in the corresponding SYNC data endpoint.


---

# 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/e-commerce/homedepot/homedepot-search-api-async.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.
