Skip to content

Sorting by Story Object Property

Stories can be sorted based on custom or predefined properties by employing the sort_by parameter, with field:asc or field:desc as values, allowing for ascending or descending order, respectively.

  • sort_by=name:asc: Sort by the story object property name
  • sort_by=position:desc: Sort stories in the order determined in the Content tab
  • sort_by=first_published_at:desc: Sort by the story object property first_published_at

The following example demonstrates how to sort stories in descending order by their first published date.

curl "https://api.storyblok.com/v2/cdn/stories\
?sort_by=first_published_at%3Adesc\
&token=ask9soUkv02QqbZgmZdeDAtt\
&starts_with=authors"
Response
{
"stories": [
{
"name": "Jane Doe",
"created_at": "2018-04-24T11:57:29.378Z",
"published_at": "2026-10-13T09:03:07.816Z",
"updated_at": "2026-10-13T09:03:07.829Z",
"id": 107354,
"uuid": "c47be9f0-47c3-4315-a95a-550f0c560eb5",
"content": {
"_uid": "b8b14760-b7a7-49f9-9e60-e3f8da23ad7b",
"name": "Jane Doe",
"avatar": "//a.storyblok.com/f/44162/1211x822/c73551377a/john-doe.png",
"component": "author"
},
"slug": "jane-doe",
"full_slug": "authors/jane-doe",
"sort_by_date": null,
"position": -10,
"tag_list": [],
"is_startpage": false,
"parent_id": 107352,
"meta_data": null,
"group_id": "e70ef646-5de2-42d6-acb3-0cda9f3388be",
"first_published_at": "2018-08-23T08:18:08.196Z",
"release_id": null,
"lang": "default",
"path": null,
"alternates": [],
"default_full_slug": null,
"translated_slugs": null
},
{
"name": "John Doe",
"created_at": "2018-04-24T11:57:29.365Z",
"published_at": "2018-04-23T11:02:02.203Z",
"updated_at": "2018-10-02T07:55:23.985Z",
"id": 107353,
"uuid": "22f4fb1b-50b3-4bf2-816e-7d589e307421",
"content": {
"_uid": "b8b14760-b7a7-49f9-9e60-e3f8da23ad7b",
"name": "John Doe",
"avatar": "//a.storyblok.com/f/44162/1211x822/c73551377a/john-doe.png",
"component": "author"
},
"slug": "john-doe",
"full_slug": "authors/john-doe",
"sort_by_date": null,
"position": 0,
"tag_list": [],
"is_startpage": false,
"parent_id": 107352,
"meta_data": null,
"group_id": "792ef2d2-2a7a-498c-87a9-8facc8fac3f5",
"first_published_at": "2018-04-23T11:02:02.203Z",
"release_id": null,
"lang": "default",
"path": null,
"alternates": [],
"default_full_slug": null,
"translated_slugs": null
}
],
"cv": 1792059567,
"rels": [],
"links": []
}

Was this page helpful?

What went wrong?

This site uses reCAPTCHA and Google's Privacy Policy (opens in a new window).Terms of Service (opens in a new window) apply.