# Pagination

Source: https://developers.swell.is/backend-api/querying/pagination

Use the `page` parameter to determine which page of results to return, relative to the default or specified `limit`. Defaults to 1.

Use `skip` to offset results directly—when set, it overrides the offset normally computed as `(page - 1) × limit`.

Two special values are supported: `page=all` removes the limit and returns all matching records in one response, and `page=false` disables pagination entirely, returning a plain array of records without the usual response envelope.

Paginated responses include `count` (total matching records), `results`, `page`, `limit`, `page_count`, and a `pages` map with the start and end record numbers of each page. The `pages` map is left out when the results fit on one page. It covers a window of pages around the current page, 10 by default; use `window` to change it. With `page=all`, every matching record is returned, and `limit` and `page_count` still reflect the default page size.

```json
{
  "count": 42,
  "results": [
    { "...": "..." }
  ],
  "page": 2,
  "limit": 15,
  "page_count": 3,
  "pages": {
    "1": { "start": 1, "end": 15 },
    "2": { "start": 16, "end": 30 },
    "3": { "start": 31, "end": 42 }
  }
}
```

## Example request

**Example query using page**

**cURL**

```bash
$ curl https://api.swell.store/products?page=2
  -u store-id:secret-key
```

**Node**

```javascript
const { swell } = require('swell-node');
swell.init('store-id', 'secret-key');

await swell.get('/products', {
  page: 2,
});
```

**PHP**

```php
<?php $swell = new \\Swell\\Client('store-id', 'secret-key');

$swell->get('/products', [
  'page' => 2
]);
```
