---
title: Search
slug: backyardapi/home-improvement-product-data-api/parameters/search
docTags: 
createdAt: 2024-07-23T14:57:52.062Z
---

# Search Parameters

<font color="#52c41a">`GET`  </font>`/request`

The Search Parameters are applicable when making a request with  `type=search`  to retrieve search results from Home Depot. The search term is specified in the  `search_term`  parameter. The parameters should be appended as querystring parameters to the Home Improvement Product Data API `GET` HTTP request.

Search results are retrieved from the [Search results page](https://www.homedepot.com/s/lawn+mower) on Home Depot.

![](https://apiimages.imgix.net/backyardapi/images/png/docs/search.png?auto=format\&ixlib=react-9.5.1-beta.1\&w=600 "Search Results Page")

For example, to request search results for the search term  `lawn mower` , sorted by "best selling products", the request would be:

:::CodeblockTabs
HTTP

```HTTP
https://api.backyardapi.com/request?api_key=demo&engine=homedepot&type=search&search_term=lawn+mower&sort_by=best_seller
```

```curl
curl -L --get https://api.backyardapi.com/request
-d api_key="demo"
-d engine="homedepot"
-d type="search"
-d search_term="lawn mower"
-d sort_by="best_seller"
```

```nodejs
const axios = require('axios');

// set up the request parameters
const params = {
  api_key: "demo",
  engine: "homedepot",
  type: "search",
  search_term: "lawn mower",
  sort_by: "best_seller"
}

// make the http GET request to Backyard API
axios.get('https://api.backyardapi.com/request', { params })
  .then(response => {

    // print the JSON response from Backyard API
    console.log(JSON.stringify(response.data, 0, 2));

  }).catch(error => {
    // catch and print the error
    console.log(error);
  })
```

```python
import requests
import json

# set up the request parameters
params = {
  'api_key': 'demo',
  'engine': 'homedepot',
  'type': 'search',
  'search_term': 'lawn mower',
  'sort_by': 'best_seller'
}

# make the http GET request to Backyard API
api_result = requests.get('https://api.backyardapi.com/request', params)

# print the JSON response from Backyard API
print(json.dumps(api_result.json()))
```

```php
<?php
      
# set up the request parameters
$queryString = http_build_query([
  'api_key' => 'demo',
  'engine': 'homedepot',
  'type': 'search',
  'search_term': 'lawn mower',
  'sort_by': 'best_seller'
]);

# make the http GET request to Backyard API
$ch = curl_init(sprintf('%s?%s', 'https://api.backyardapi.com/request', $queryString));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
# the following options are required if you're using an outdated OpenSSL version
# more details: https://www.openssl.org/blog/blog/2021/09/13/LetsEncryptRootCertExpire/
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 180);

$api_result = curl_exec($ch);
curl_close($ch);

# print the JSON response from Backyard API
echo $api_result;

?>
```
:::

***

### Search Parameters

The following parameters are available for all requests made when  `type=search` .

| `Parameter`   | `Required` | `Description`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `engine`      | `required` | The engine of Home Improvement data to retrieve, for example `homedepot`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `search_term` | `required` | A search term to use to search for Home Improvement items. Either the `search_term` or `url` parameter must be supplied.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `sort_by`     | `optional` | Determines how the results are sorted. Valid values are:<br />1) `best_seller`&#x20;
2) Sort results by best selling products first.<br /><br />1) `most_popular`&#x20;
2) Sort results by most popular products first.<br /><br />1) `price_high_to_low`&#x20;
2) Sort results by highest to lowest priced.<br /><br />1) `price_low_to_high`&#x20;
2) Sort results by lowest to highest priced.<br /><br />1) `highest_rating`&#x20;
2) Sort results by highest rated first.<br /><br />*
  ![](https://apiimages.imgix.net/backyardapi/images/png/docs/sort_by.png?auto=format\&ixlib=react-9.5.1-beta.1\&w=150)<br /> |
| `min_price`   | `optional` | Determines the minimum price of results to return, expressed in dollars and cents (i.e. `min_price=2.99` for $2.99).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `max_price`   | `optional` | Determines the maximum price of results to return, expressed in dollars and cents (i.e. `min_price=39.99` for $39.99).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `page`        | `optional` | The current page of results to retrieve. Inspect the `pagination` results property for details on the number of pages available.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `max_page`    | `optional` | Use the `max_page` parameter to get multiple pages of results in one request. The API will automatically paginate through pages and concatenate the results into one response.  <br />See the [Pagination ](https://docs.trajectdata.com/backyardapi/home-improvement-product-data-api/pagination)docs for more information.                                                                                                                                                                                                                                                                                              |
| `url`         | `optional` | The Home Improvement search results page to retrieve results from.  <br />**Note** : If the `url` parameter is supplied then all other parameters are ignored as they are overriden be those specified in the `url` parameter.                                                                                                                                                                                                                                                                                                                                                                                            |

***

**Next Steps**
     [Search Results](https://docs.trajectdata.com/backyardapi/home-improvement-product-data-api/results/search)
