---
title: "Create or replace sort options"
method: PUT
path: "/v1/sort_options"
tags: ["Sort options"]
---

# Create or replace sort options

`PUT /v1/sort_options`

## Request

- Base URL: `https://ac.cnstrc.com`
- URL: `https://ac.cnstrc.com/v1/sort_options`
- Auth: one of:
  - HTTP basic
  - HTTP bearer

**🔐 This endpoint requires [HTTP authentication](https://docs.constructor.com/reference/main-authentication) (either [Basic](https://docs.constructor.com/reference/main-authentication#basic-authentication) or [Bearer](https://docs.constructor.com/reference/main-authentication#bearer-authentication)).**
For authenticating with Bearer token, required scopes are: `sort_options(w)`.

Create or replace existing sort options. When providing sort options, every combination of `sort_by` and `sort_order` must be unique. For instance, there can only be one sort option that has a `sort_by` with value `price` and a `sort_order` with value `ascending`.

## Query parameters

- `key` string, required: The key of the index to use.
- `section` string: The section of the index to use. Defaults to `Products`.
- `c` string: The ID of the client and version that the request is coming from, such as `cio-js-2.90`.

## Request body

- SortOptionListPutBody
  - `sort_options` SortOption[], required: Array of sort options you want to create or replace.
    - `display_name` string: The name of the sort option as it is displayed to end users.
    - `path_in_metadata` string, required: The path in the item's metadata to the field that results will be sorted according to.
    - `position` integer: The position of the sort option, used to provide sort options in a specific order.
    - `hidden` boolean: Indicates if a sort option is hidden. This can be marked at `sort_by` level. A hidden sort option will be ignored in response by default.
    - `sort_by` string, required: The name of the sort option.
    - `sort_order` 'ascending' | 'descending', required

## Response `200`

OK

- SortOptionListPutResponse
  - `sort_options` SortOptionResponse[], required
    - `display_name` string, required: The name of the sort option as it is displayed to end users.
    - `path_in_metadata` string, required: The path in the item's metadata to the field that results will be sorted according to.
    - `position` integer: The position of the sort option, used to provide sort options in a specific order.
    - `hidden` boolean: Indicates if a sort option is hidden. This can be marked at `sort_by` level. A hidden sort option will be ignored in response by default.
    - `sort_by` string, required: The name of the sort option.
    - `sort_order` 'ascending' | 'descending', required

## Other responses

- `400`: Validation Error
- `401`: Credentials are not passed or action is forbidden.
- `403`: The supplied token does not have the required permissions.
- `429`: Rate limit breached

---

[API](https://skmtc.dev/constructor/apis/configuration.md) - [All operations](https://skmtc.dev/constructor/apis/configuration/llms.txt) - [OpenAPI document](https://skmtc.dev/constructor/apis/configuration/revisions/205ffdb5f494?raw)
