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

You can add a `sort` JSON object in a Sitecore Discover Search and Recommendation request. You use 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") to specify the order of the content search results. The value object contains a list of objects, and each object contains a sort type and order type.

> [!note]
> You set up the default and available sort values in the Customer Engagement Console (CEC) when you first create an account with Discover.

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

```csharp
{
    "sort": {
	"value": [{
           "type": "<sort_type>",
	   "order": "<order_type>"
            }
    	]
     }
}
```

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

The following table describes the key that the `sort` object contains.

| Key | Type/default value | Description |
| --- | --- | --- |
| `value` | [Sort 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/the-sort-request-object.html#UUID-3194d836-fc07-a103-b84e-f9000b0d1ac7_section-idm466105706835363321407533584 "Sort object") | Optional.<br><br>Determines the sort order of the content results based on the `<sort_type>` and `<order_type>`. |

### Sort object

The following table describes the keys in the `sort` object:

| Key | Type | Description | Value |
| --- | --- | --- | --- |
| type | string | Required.The sort types you want to sort by. | featured (default)namepricenewestratingreview |
| order | string | Required.Whether you want to sort in an ascending or descending order. | asc (default)desc |

### Sort types

We typically support the following sort types:

| Sort | Description |
| --- | --- |
| `featured` | Sort by a mix of vendor rules, popular, individualized. |
| `name` | Sort by name. |
| `price` | Sort by price. |
| `newest` | Sort by recently added. |
| `rating` | Sort by product review rating. |
| `review` | Sort by the number of reviews. |

> [!note]
> See the CEC for the sort choices applicable to your account.

</details>

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

You need a request to search for *red* products and then:

- Sort by `price` from high to low (*desc*)
- If the `price` is the same, sort by `name` alphabetically (*asc*)

This is a sample request:

```csharp
{
    "query": {
	"keyphrase": ["red"]
    },
    "n_item": 3,
    "content": {},
    "sort": {
    	"value": [{
        	"type": "price",
		"order": "desc"
	    },
	    {
		"type": "name",
		"order": "asc"
	    }
	]
    }
}
```

For more examples, see [Sorting content results](https://doc.sitecore.com/discover/en/developers/discover-developer-guide/integrate-using-discover-rest-apis/search-and-recommendation-data-model/request-structure-and-objects/sorting-content-results.md "Sorting content results").

</details>