
# Pagination

All core API resources provide a list endpoint to fetch resource items in bulk.
For example you can [list plans][list plans], [list subscriptions][list subscriptions], or [list users][list users].
All list endpoints share a common interface with three list related HTTP query
parameters: `after`, `before`, and `limit`, as well as a common JSON response
format.

<div>
  <Properties>
    <Property name="after" type="string">
      A cursor for use in pagination. The `after` parameter takes an object ID
      that defines the position in the list, only items immediately following
      the item with that ID will be returned.
    </Property>
    <Property name="before" type="string">
      A cursor for use in pagination. The `before` parameter takes an object ID
      that defines the position in the list, only items immediately preceding
      the item with that ID will be returned.
    </Property>
    <Property name="limit" type="integer">
      The limit of items to be returned in the list, between 0 and 200.
      <div>
        <span className="font-mono text-xs text-zinc-500">Default</span>: `10`
      </div>
    </Property>
  </Properties>
</div>

Gigs provides a cursor-based pagination approach via the `after` / `before`
parameters. Either parameter takes an existing item ID and will return items
after / before the given item ID. The parameters are mutually exclusive, only
one of them may be used at the same time. All list responses include
`moreItemsAfter` and `moreItemsBefore` attributes which indicate whether more
items are available after or before the current batch of items and which ID to
use in the parameters.

```json title="List response example" lineNumbers
{
  "object": "list",
  "items": [
    {...},
    {...},
    {...},
    {...},
    {
      "object": "sim",
      "id": "01G7PFYGYN8WC45QG5GVF8V07V",
      "iccid": "89424242426525615846",
      "provider": "test",
      "status": "inactive",
      "type": "eSIM",
      "createdAt": "2022-07-11T11:22:40Z"
    }
  ],
  "moreItemsAfter": "01G7PFYGYN8WC45QG5GVF8V07V",
  "moreItemsBefore": null
}
```

[list plans]: /core/plans#list-all-plans
[list subscriptions]: /core/subscriptions#list-all-subscriptions
[list users]: /core/users#list-all-users
