# Pagination

Page through lists of FiscalRail API resources.

List endpoints return resources in reverse chronological ID order, with the newest resource first. Use cursor parameters to request the next or previous page.

## List response format

Every list response uses the same top-level structure:

```json
{
  "object": "list",
  "has_more": true,
  "data": [
    {
      "id": "cus_14Vxtqg6oXpAY5WdWoq4wW",
      "object": "customer"
    }
  ]
}
```

| Property | Meaning |
| --- | --- |
| `object` | Always `list`. |
| `has_more` | Whether another page exists in the requested direction. |
| `data` | The resources in the current page. |

## Pagination parameters

| Parameter | Meaning |
| --- | --- |
| `limit` | Maximum number of resources to return. The default is `25`; allowed values are `1` through `100`. |
| `starting_after` | Return the next page of older resources after the resource with this ID. |
| `ending_before` | Return the previous page of newer resources before the resource with this ID. |

`starting_after` and `ending_before` are mutually exclusive. The cursor must be the ID of a resource from the list being paginated.

To fetch the next page, pass the ID of the last resource in `data` as `starting_after`:

```http
GET /v1/customers?limit=25&starting_after=cus_14Vxtqg6oXpAY5WdWoq4wW
Authorization: Bearer ak_...
```

If `has_more` is `true`, repeat this using the last resource in the new page. If it is `false`, you have reached the end in that direction.

To fetch the previous page, pass the ID of the first resource in `data` as `ending_before`:

```http
GET /v1/customers?limit=25&ending_before=cus_14Vxtqg6oXpAY5WdWoq4wW
Authorization: Bearer ak_...
```

Keep the same filters on every request while traversing a list.
