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

> ## Agent Instructions
> Base URL da API: https://api.pagstack.com/v1. Autenticação: header Authorization: Bearer <chave>.
> Chaves sk_test_ simulam pagamentos (modo de teste); chaves sk_live_ movimentam dinheiro real. Use sk_test_ durante a integração.
> Valores monetários são inteiros em centavos (4990 = R$ 49,90). Moeda: BRL.
> Sempre valide a assinatura do webhook (header Pagstack-Signature) antes de liberar um pedido.
> Índice completo: https://docs.pagstack.com/llms.txt. Conteúdo completo: https://docs.pagstack.com/llms-full.txt.

# Paginação

> Como paginar as listas da API da Pagstack com limit, starting_after e has_more, do mais novo para o mais antigo.

As rotas de lista (`GET /transactions`, `GET /balance/transactions`, `GET /withdrawals` e `GET /webhook-endpoints`) devolvem os objetos do mais novo para o mais antigo, em páginas.

**limit** `integer` (default: 20)

Quantos objetos por página, de 1 a 100.

**starting\_after** `string`

ID do último objeto da página anterior. A próxima página começa depois dele.

```json theme={null}
{
  "object": "list",
  "data": [{ "id": "tx_7Fq2kM9xLp" }, { "id": "tx_6Pa1jL8wKo" }],
  "has_more": true
}
```

Enquanto `has_more` for `true`, peça a próxima página com o `id` do último item:

```javascript Node.js theme={null}
let startingAfter;
do {
  const url = new URL("https://api.pagstack.com/v1/transactions");
  url.searchParams.set("limit", "100");
  if (startingAfter) url.searchParams.set("starting_after", startingAfter);

  const page = await fetch(url, {
    headers: { Authorization: `Bearer ${process.env.PAGSTACK_API_KEY}` },
  }).then((r) => r.json());

  for (const transaction of page.data) {
    // ...
  }
  startingAfter = page.has_more ? page.data.at(-1).id : undefined;
} while (startingAfter);
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.