# Pagination

Depending on the use-case, there might be a need to fetch more than 100 entities from the Alerts API for local data processing. For such scenarios, Alerts API implements id-based cursor pagination.&#x20;

#### Example

Let's assume we have the following set of Alerts available in the API:

```javascript
[
  {
    "id": "05978d3a-0a49-8b63-b054-b65d37e4eb05"
  },
  {
    "id": "9b8a3e5d-b7e5-0a67-7788-96d98349407b"
  },
  {
    "id": "030bd54a-745b-9d6d-33d7-e683a0ee7389"
  },
]
```

Running the following GraphQL query would return the very first of the three Alerts:

```graphql
query getAlerts {
  alerts(first: 1) {
    id
  }
}
```

```graphql
[
  {
    "id": "05978d3a-0a49-8b63-b054-b65d37e4eb05"
  },
]
```

Since this response contains the same amount of items as was requested with the `first` argument, we can assume there are more Alerts available for the same query.

To fetch the next page, it's possible to specify `after` argument on the `alerts` node which accepts a valid Alert ID. It instructs the API to return all the entities following the one with the given ID.

Running the same query, but with `after` argument:

```graphql
query getAlerts {
  alerts(first: 1, after: "05978d3a-0a49-8b63-b054-b65d37e4eb05") {
    id
  }
}
```

Will return the second Alert from the initial group.

```graphql
[
  {
    "id": "9b8a3e5d-b7e5-0a67-7788-96d98349407b"
  },
]
```

{% hint style="info" %}
`after` argument can be combined with any other arguments available on the `alerts` node, including `orderBy`
{% endhint %}

If we'll run the same query, using last Alert's ID, it'll return the empty array:

```graphql
[]
```

This indicates that we have paginated through all available entities and there are no more Alerts left.
