Sort

Sort an array in ascending or descending order or reverse it

POST/v1/sort/array/{order}

View as Markdown

Sorts an array. ascending and descending sort the items (by the sort_by keys, per key overridable, empty sorts the items themselves) and reverse flips the order of the items, ignoring sort_by.

Parameters

Name Type Required Description
order one of: ascending, descending, reverse yes

Request body

Name Type Required Description
items array of any yes The array
sort_by array of SortKey no What to sort by, main key first. Empty sorts the items themselves
order one of: asc, desc no Order for keys that do not set their own: asc or desc (default "asc")

Example request

A request body that works, as JSON.

{
  "items": [
    "Zoe",
    "Ana",
    "Ben"
  ],
  "order": "asc"
}

Response

The fields inside data of a successful response.

Name Type Required Description
items array of any yes The sorted items
count integer yes Number of items

Example response

A real answer from the operation, as JSON. The fields in the table above are inside data.

{
  "data": {
    "items": [
      "Ana",
      "Ben",
      "Zoe"
    ],
    "count": 3
  },
  "errors": null,
  "meta": {
    "request_id": "7b77c461-14b7-4780-82b3-6ec0aeaebe92",
    "timestamp": "2026-10-27T07:19:42.148552Z",
    "version": "2026-03-26"
  },
  "pagination": null
}

Responses

Status When it happens
200 Successful Response
400 The body respects the operation schema, but the use case rejected it. Each problem is one ApiError entry
413 The request is larger than the request size limit of the API allows
422 The body does not respect the operation schema. Each problem is one ApiError entry with the code validation_error
500 Something failed inside the server and was not an input problem. The same envelope, errors may be empty