# On List endpoints (/api/using-the-api/on-list-endpoints)

When using list endpoints, you have the ability to combine various query options
to locate the desired results. Some endpoints even offer specific filter options
to aid in this search.

All the list endpoints employ pagination. This means that a single request might
only return a part of the entire set of resources you're aiming to retrieve. To
move through the subsequent pages, the Spoke API provides a `nextPageToken`
field in the response of every list endpoint query.

It's crucial to understand that when a `nextPageToken` is returned, it indicates
that more data is available. For every subsequent request, this token should be
added as the `pageToken` query parameter. And, importantly, **all the original
query parameters** used in the first request must also be included.

Here's a step-by-step example to elucidate this:

1. Suppose you initiate a request to list your plans:

```bash
curl "https://api.spoke.com/public/v1/plans?filter.startsGte=2023-05-01" -u yourApiKey:
```

2. The Spoke API might return a response like:

```json
{
  // other attributes
  "nextPageToken": "I53Jr5Eu2qK9omh0iA8q"
}
```

3. To retrieve the next page of data, use the returned `nextPageToken` as the
   `pageToken` query parameter, and ensure all initial query parameters remain
   the same:

```bash
curl "https://api.spoke.com/public/v1/plans?filter.startsGte=2023-05-01&pageToken=I53Jr5Eu2qK9omh0iA8q" -u yourApiKey:
```

4. Repeat step 3 for all subsequent pages, updating the `pageToken` parameter
   with the latest `nextPageToken` value returned until `nextPageToken` is
   `null` in the response.

Spoke also accepts limiting the maximum number of results per page by using
the `maxPageSize` query parameter, but notice that each individual endpoint has
a maximum value you can set this to.