---
title: "The filter request object"
slug: "the-filter-request-object"
abstract: "Describes the structure and properties of the filter object in a Discover Search and Recommendation request"
---
# The filter request object

You can add a `filter` JSON object in a Sitecore Discover Search and Recommendation request to limit the types of content and facets you want returned. The value of the `filter` object is a [value object](https://doc.sitecore.com/discover/en/developers/discover-developer-guide/integrate-using-discover-rest-apis/search-and-recommendation-data-model/request-structure-and-objects/annotations-and-terms.html#UUID-2e6e272c-5601-6ab0-e594-5fd25aa93318_section-idm4542587877929632876121293693 "Type of value object"). The value of the value object is a list containing either a `<facet_id>` or a `<range_filter`.

The following shows the structure of a `filter` object in a request:

```csharp
{
    "filter": {
	"<facet_type>": {
             "value": ["<filter_id>"]
	}
}
}
```

<details>
<summary><h2>Keys</h2></summary>

The following table describes the keys that the `filter` object contains.

| Key | Type | Description | Value |
| --- | --- | --- | --- |
| <facet_type> | Filter type object | Required.The filters you want to apply to the request. | brandcategory_namespricerating |

> [!note]
> The `brand`, `category_names`, `price`, and `rating` facet types are default and come with all implementations. You can define additional facet types that are specific to your industry when you do the [initial data feed](https://doc.sitecore.com/discover/en/developers/discover-developer-guide/integrate-using-discover-rest-apis/search-and-recommendation-data-model/request-structure-and-objects/preparing,-uploading,-and-managing-your-data.html "Preparing, uploading, and managing your data").

### Filter type object

The following table describes the key in the `Filter type` object:

| Key | Type | Description | Value |
| --- | --- | --- | --- |
| value | array | Required.A list that contains the <filter_id>. | <facet_id> - the ID returned by a facet query.<range_filter> - For a number filter, pass a an object that contains min and max keys to represent a range. For a text filter, pass the exact value of the facet. |

</details>

<details>
<summary><h2>Example</h2></summary>

The following example uses the exact values for a text filter (`gender`) and a range for a number filter (`price`):

```csharp
{
    "context": {
        "page": {
            "uri": "/mylandingpage"
        }
    },
    "widget": {
        "all": true
    },
    "facet": {
        "all": true
    },
    "filter": {
        "genders": {
            "value": [
                "unisex"
            ]
        },
        "price": {
            "value": [
                {
                    "min": 7,
                    "max": 70
                }
            ]
        }
    },
    "content": {
        "product": {}
    }
}
```

The following example uses the `facet_id` for a text filter (`gender`) and a number filter (`price`):

```csharp
{
    "context": {
        "page": {
            "uri": "/mylandingpage"
        }
    },
    "widget": {
        "all": true
    },
    "facet": {
        "all": true
    },
    "filter": {
        "genders": {
            "value": [
                "facet_iddW5pc2V4"
            ]
        },
        "price": {
            "value": [
                "facet_ideyJtYXgiOjkwLCJtaW4iOjcwfQ=="
            ]
        }
    },
    "content": {
        "product": {}
    }
}
```

</details>