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

# Rate limits

> Límites de peticiones, headers que los reportan y cómo reintentar bien.

Cada respuesta incluye headers que te dicen cuántas peticiones te quedan:

| Header                  | Significado                                |
| ----------------------- | ------------------------------------------ |
| `X-RateLimit-Limit`     | Máximo de peticiones en la ventana actual. |
| `X-RateLimit-Remaining` | Cuántas te quedan.                         |
| `X-RateLimit-Reset`     | Segundos hasta que la ventana se reinicia. |

Ejemplo:

```http theme={null}
HTTP/1.1 200 OK
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 94
X-RateLimit-Reset: 60
```

## Cuando te pasas: `429`

Si excedes el límite, recibes `429 Too Many Requests` con
[`problem+json`](/guias/referencia-transversal/errores). Espera a que la ventana se reinicie
(`X-RateLimit-Reset`) y reintenta con **backoff exponencial**.

<CodeGroup>
  ```javascript Node.js theme={null}
  async function callWithRetry(url, opts, tries = 4) {
    for (let i = 0; i < tries; i++) {
      const res = await fetch(url, opts)
      if (res.status !== 429) return res
      const reset = Number(res.headers.get("X-RateLimit-Reset") ?? 1)
      await new Promise((r) => setTimeout(r, (reset * 1000 || 2 ** i * 1000)))
    }
    throw new Error("Rate limit: agotados los reintentos")
  }
  ```
</CodeGroup>

<Tip>
  Revisa `X-RateLimit-Remaining` de forma proactiva y espacia tus llamadas antes de topar el límite,
  en vez de esperar al `429`.
</Tip>
