---
title: "SearchAfter API (V1)"
slug: "searchafter-api--v1-"
abstract: "How to use the SearchAfter API to fetch multiple pages of search results sequentially."
---
# SearchAfter API (V1)

The SearchAfter API is used to fetch multiple pages of search results sequentially. To start, a request is made for the first page of results, which includes a `last_hit_data` value corresponding to the last item in the page. This value is then used to fetch subsequent pages until all results are retrieved.

> [!important]
> Not all search results are kept in memory. To have consistent search results between pages, add at least one query parameter that is unique and easily sortable, for example, an identifier. Using a modification date might return inconsistent results if new entities are modified while navigating between pages in the same search result set.

This resource is available at the following URL:

```http
GET http://<HOSTNAME>/api/entities/searchafter/

```

SearchAfter API can have the following query strings:

| String | Description |
| --- | --- |
| `sort` | Sorting type, with two different inputs:<br><br><ul><li>Name of an item based on which you want to sort the results, for example `sort=CreatedOn&order=Asc`.</li><li>A sort and order combination, for example `sort=CreatedOn+Asc,Importance+Desc`.</li></ul> |
| `order` | Ordering of results. |
| `searchAfter` | For a given set of results when making a request after the first one, provide the preceding value of `last_hit_data` here. |
| `query` | A normal query. |
| `take` | Number of items to fetch per page. The default is 25, and the maximum is 100. |
| `members` | Members to be retrieved. |
| `renditions` | Renditions to be retrieved. |
| `culture` | User culture, for example `en-us`. |
| `sortCulture` | If no culture is specified, it uses the invariant culture by default. |

## Example

The following example shows the initial request made to fetch a list of assets, sorted in ascending order by creation date:

```shell
/api/entities/searchafter?query=Definition.Name=="M.Asset"&sort=createdOn&order=Asc

```

The results include the first 25 items in a set of 212. The value of `last_hit_data` here corresponds with the 25th item:

```shell
{
    "last_hit_data": [
      "1680149774978"
      ],
    "items": [],
    "total_items": 212,
    "returned_items": 25
  }

```

By adding the value of `last_hit_data` to a subsequent request based on the same criteria, you can fetch the next 25 items in the set, beginning with the 26th.

```shell
/api/entities/searchafter?query=Definition.Name=="M.Asset"&sort=createdOn&order=Asc&searchAfter=1678176769452

```