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

> ## Agent Instructions
> Flowsign is one word with a lowercase s.
> The REST API base URL is https://my.flowsign.app and every endpoint lives under /api/v1.
> When answering API questions, cite the HTTP method and endpoint path.
> API access needs the Enterprise plan and an API key with the API access permission.

# Pagination

> Paging through packages, templates, webhooks, webhook deliveries and audit events.

`GET /api/v1/packages`, `GET /api/v1/templates`, `GET /api/v1/webhooks`, `GET /api/v1/webhooks/{endpointId}` (its deliveries) and `GET /api/v1/packages/{packageId}/audit-events` 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 newest first: packages and templates by `updatedAt`, webhooks, deliveries and audit events by `createdAt`.

```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 other lists use the same shape with a `templates`, `webhooks` or `auditEvents` array. `GET /api/v1/webhooks/{endpointId}` returns the endpoint's own fields alongside a `deliveries` array, and reports the total as `deliveryCount` rather than `totalCount`.

## 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`, which is the same as leaving it out).
* **Webhook deliveries**: `status` (`PENDING`, `DELIVERED`, `FAILED` or `EXHAUSTED`) on `GET /api/v1/webhooks/{endpointId}`.

`GET /api/v1/webhooks` takes no filters and pages through every endpoint in the organisation. `GET /api/v1/library/documents`, `GET /api/v1/signing-groups` and `GET /api/v1/custom-fields` are not paginated: library documents return up to 50 matches for an optional `search`, signing groups return every group in the workspace by name, and custom fields return every active definition, optionally narrowed with `templateId`.
