> ## Documentation Index
> Fetch the complete documentation index at: https://staging.docs.flowsign.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Pagination

> Paging through packages and templates.

`GET /api/v1/packages` and `GET /api/v1/templates` are paginated with page numbers.

| Query parameter | Type              | Default | Notes                                          |
| --------------- | ----------------- | ------- | ---------------------------------------------- |
| `page`          | integer, from 1   | `1`     | Page number                                    |
| `pageSize`      | integer, 1 to 100 | `25`    | Items per page. Values above 100 return `422`. |

Results are ordered by `updatedAt`, newest first.

```bash theme={null}
curl "https://my.flowsign.app/api/v1/packages?status=COMPLETED&page=2&pageSize=50" \
  -H "Authorization: Bearer fsk_your_key_here"
```

```json theme={null}
{
  "data": {
    "packages": [ ... ],
    "totalCount": 137,
    "page": 2,
    "pageSize": 50
  }
}
```

The response echoes `page` and `pageSize` and reports `totalCount`, the number of items across all pages. A page past the end returns an empty array with the same `totalCount`. The templates endpoint uses the same shape with a `templates` array.

## Iterating every page

```javascript theme={null}
async function* allPackages(params = {}) {
  const pageSize = 100;
  for (let page = 1; ; page++) {
    const query = new URLSearchParams({ ...params, page, pageSize });
    const res = await fetch(`https://my.flowsign.app/api/v1/packages?${query}`, {
      headers: { Authorization: `Bearer ${process.env.FLOWSIGN_API_KEY}` },
    });
    const { data } = await res.json();
    yield* data.packages;
    if (page * pageSize >= data.totalCount) return;
  }
}

for await (const pkg of allPackages({ status: "IN_PROGRESS" })) {
  console.log(pkg.id, pkg.title);
}
```

## Filters

* **Packages**: `status` (one of `DRAFT`, `SCHEDULED`, `IN_PROGRESS`, `COMPLETED`, `DECLINED`, `ON_HOLD`, `VOID`, or `VIEWED` for packages a recipient has opened) and `search` (case-insensitive match on the title).
* **Templates**: `status` (`DRAFT`, `ACTIVE`, `ARCHIVED`, or `all`).

`GET /api/v1/webhooks` returns every endpoint in the organisation and is not paginated.
