---
title: "Create a sort option"
method: POST
path: "/v1/sort_option"
tags: ["Sort options"]
---

# Create a sort option

`POST /v1/sort_option`

**🔐 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 a new sort option. Note that total number of sort options is limited, and every combination of `sort_by` and `sort_order` fields among the sort options must be unique.

## 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

- SortOptionPostBody
  - `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

- SortOptionPostResponse
  - `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.
- `409` — Conflict
- `429` — Rate limit breached

---

[API](https://skmtc.dev/constructor/apis/autocomplete.md) · [All operations](https://skmtc.dev/constructor/apis/autocomplete/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/constructor/autocomplete/revisions/2d33330633b6/schema)
