> ## Documentation Index
> Fetch the complete documentation index at: https://developers.openalex.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Sort

> Order results by a field

Use the `sort` parameter to order results by a property:

```bash theme={"dark"}
# Works sorted by citation count (highest first)
https://api.openalex.org/works?sort=cited_by_count:desc

# Sources in alphabetical order
https://api.openalex.org/sources?sort=display_name
```

## Common sortable fields

| Field              | Description                               |
| ------------------ | ----------------------------------------- |
| `display_name`     | Alphabetical order                        |
| `cited_by_count`   | Number of citations                       |
| `works_count`      | Number of works                           |
| `publication_date` | Publication date (works only)             |
| `relevance_score`  | Search relevance (requires search filter) |

## Sort direction

By default, sort is ascending. Append `:desc` for descending:

```bash theme={"dark"}
# Ascending (default)
https://api.openalex.org/works?sort=publication_date

# Descending
https://api.openalex.org/works?sort=publication_date:desc
```

## Multiple sort keys

Sort by multiple properties using commas:

```bash theme={"dark"}
# Sort by year descending, then by relevance score
https://api.openalex.org/works?search=bioplastics&sort=publication_year:desc,relevance_score:desc
```

<Note>
  Sorting by `relevance_score` requires an active search. An error is thrown otherwise.
</Note>
