# Lists and pagination

> Walk through invoices, customers or events page by page with limit and starting_after.

Routes that list (`GET /v1/invoices`, `GET /v1/customers`, `GET /v1/events`…) answer one page, most recent first:

```json
{
  "object": "list",
  "data": [{ "id": "inv_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg", "object": "invoice", "...": "..." }],
  "has_more": true,
  "url": "/v1/invoices"
}
```

| Parameter | What it does |
| --- | --- |
| `limit` | How many per page, 1 to 100. 10 by default. |
| `starting_after` | The `id` of the last object of the previous page: the next one starts after it. |

While `has_more` is `true` there's more: ask for the next one with the `id` of the last item in `data`.

```bash tab="cURL"
curl -G https://api.fiscalisto.com/v1/invoices \
  -H "Authorization: Bearer $FISCALISTO_API_KEY" \
  -d limit=100 \
  -d starting_after=inv_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg
```

```ts tab="TypeScript"
import { Fiscalisto } from "fiscalisto";

// The key comes from FISCALISTO_API_KEY.
const fiscalisto = new Fiscalisto();

for await (const item of fiscalisto.invoices.list({
  limit: 100,
  starting_after: "inv_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg",
})) {
  console.log(item.id);
}
```

```python tab="Python"
from fiscalisto import Fiscalisto

# The key comes from FISCALISTO_API_KEY.
fiscalisto = Fiscalisto()

for item in fiscalisto.invoices.list({
    "limit": 100,
    "starting_after": "inv_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg",
}):
    print(item["id"])
```

```php tab="PHP"
<?php

use Fiscalisto\Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
$fiscalisto = new Fiscalisto();

foreach ($fiscalisto->invoices->list([
    'limit' => 100,
    'starting_after' => 'inv_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg',
]) as $item) {
    echo $item['id'], "\n";
}
```

```go tab="Go"
package main

import (
	"context"
	"fmt"
	"log"

	fiscalisto "fiscalisto.com/go"
)

func main() {
	// The key comes from FISCALISTO_API_KEY.
	client, err := fiscalisto.NewClient("")
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	for item, err := range client.Invoices.ListAutoPaging(ctx, &fiscalisto.ListInvoicesParams{
		Limit:         fiscalisto.Int64(100),
		StartingAfter: fiscalisto.String("inv_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg"),
	}) {
		if err != nil {
			log.Fatal(err)
		}
		fmt.Println(item.ID)
	}
}
```

```java tab="Java"
import com.fiscalisto.FiscalistoClient;
import com.fiscalisto.model.ListInvoicesParams;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

for (var item : fiscalisto.invoices().listAutoPaging(new ListInvoicesParams()
        .setLimit(100)
        .setStartingAfter("inv_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg"))) {
    System.out.println(item.getId());
}
```

```csharp tab="C#"
using Fiscalisto;

// The key comes from FISCALISTO_API_KEY.
var fiscalisto = new FiscalistoClient();

await foreach (var item in fiscalisto.Invoices.ListAutoPagingAsync(new ListInvoicesParams
{
    Limit = 100,
    StartingAfter = "inv_OufpKqnrvx9p0Nfbydl9jG4UNGeTYcvdrg",
}))
    Console.WriteLine(item.Id);
```

```js title="todas-las-facturas.js"
async function* facturas(filtros = {}) {
  let startingAfter;
  while (true) {
    const q = new URLSearchParams({ limit: "100", ...filtros });
    if (startingAfter) q.set("starting_after", startingAfter);
    const res = await fetch(`https://api.fiscalisto.com/v1/invoices?${q}`, {
      headers: { Authorization: `Bearer ${process.env.FISCALISTO_API_KEY}` },
    });
    const page = await res.json();
    yield* page.data;
    if (!page.has_more) return;
    startingAfter = page.data.at(-1).id;
  }
}

for await (const f of facturas({ status: "valid", created_gte: "2026-10-01" })) {
  console.log(f.uuid, f.total);
}
```

Pages never skip or repeat objects even if others are created while you walk the list.

## Filters

Each list has its own, for example:

- Invoices: `issuer`, `status`, `type` (I, E, P, T or N), `customer` (the customer's RFC), `created_gte` and `created_lte`.
- Withholding certificates: `issuer`, `status`, `recipient` (RFC) and `year`.
- Customers: `tax_id`. Products: `sku`, `product_key` and `category`.
- Events: `type` (`invoice.stamped`…) and `object` (the document's id, to see everything that happened to it).

Lists of documents, customers, products, employees and batches belong to one issuer: send `issuer` if the account has several. SAT catalogs (`q` searches by key or description) and advances answer a single list, without pages.

Each route's [reference](https://fiscalisto.com/en/docs/api/referencia/facturas/list-invoices) says which filters it accepts.
