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

# PagAmerican API

> Query your purchases, orders, refunds and chargebacks over HTTPS.

One HTTPS endpoint, one API key, and read access to everything that belongs to your account. There is no SDK to install and no token to refresh. If you can make an HTTP request, you can use it.

```bash theme={null}
curl -G https://external-api-service.pagamerican.app/api/v1/purchases \
  -H "Authorization: Bearer pag_your_api_key" \
  --data-urlencode "from=2026-08-01" \
  --data-urlencode "to=2026-08-08" \
  --data-urlencode "limit=1000"
```

```json theme={null}
{
  "data": [{ "purchaseId": 151206, "productName": "EXAMPLE PRODUCT", "amountTransaction": 97.0, "...": "..." }],
  "meta": { "count": 4, "limit": 1000, "from": "2026-08-01", "to": "2026-08-08", "truncated": false }
}
```

## How it behaves

<CardGroup cols={3}>
  <Card title="Read only" icon="eye">
    Every endpoint is a `GET`. Nothing you call here can change an order, a refund or a customer.
  </Card>

  <Card title="Scoped by your key" icon="lock">
    You only ever receive your own data. There is no account filter to pass, and none to get wrong.
  </Card>

  <Card title="Same shape everywhere" icon="layers">
    One error envelope, one date convention, one pagination model, across every resource.
  </Card>
</CardGroup>

## Two things that surprise people

<CardGroup cols={2}>
  <Card title="`to` is exclusive" icon="calendar">
    For all of April, use `from=2026-04-01` and `to=2026-05-01`, the day after your intended last day. The widest window you can ask for is **90 days**.
  </Card>

  <Card title="`limit` truncates, it does not paginate" icon="scissors">
    `limit` goes up to 5000 and defaults to 1000. When `meta.truncated` is `true` there is more data behind it, so narrow the window. Records come newest first.
  </Card>
</CardGroup>

## When something goes wrong

Every error comes back in the same envelope:

```json theme={null}
{
  "error": {
    "code": "invalid_request",
    "message": "human-readable error description",
    "correlation_id": "a1b2c3d4-0000-0000-0000-000000000000"
  }
}
```

| Status | `code`            | When it happens                                   |
| ------ | ----------------- | ------------------------------------------------- |
| `400`  | `invalid_request` | Invalid parameters (malformed dates, `from > to`) |
| `401`  | `invalid_token`   | Key missing, invalid, or revoked                  |
| `403`  | `forbidden`       | Token lacks permission for the resource           |
| `422`  | `invalid_request` | Date window larger than 90 days                   |
| `429`  | `rate_limited`    | Rate limit exceeded                               |
| `5xx`  | `internal_error`  | Internal error, try again later                   |

<Note>
  The `correlation_id` is always present, in the body and in the `x-correlation-id` header. **Include it when you open a support ticket** and we can trace your exact request.
</Note>

## Next

<CardGroup cols={2}>
  <Card title="Authentication" icon="key" href="/authentication">
    How the `pag_` key works, how to send it, and how to keep it safe.
  </Card>

  <Card title="API Reference" icon="code" href="/api/reference">
    Every resource, every parameter, and a "Try it" playground.
  </Card>
</CardGroup>
