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

# Rate limits for your traffic

> How to size the Veriqa rate limits for your number of users: the values for a site of 1,000 users and the rule for rescaling them.

The Veriqa core limits the number of requests to its public routes: the routes are grouped into
buckets, and each bucket has its own limit. The defaults are sized for a site with 1,000 users. If you have more or fewer users, multiply the limits by the correction factor
N / 1000, where N is your number of users.

A limit protects the availability of the service: once a bucket is used up, it answers `429` to
everyone who comes after, until the window ends. Size each limit so that it holds the peak minute of
your traffic. The core sets no limit per client IP; that limit belongs at the edge of your network
(see [Preparing for production](https://veriqa.app/docs/guides/hardening.md#rate-limiting-and-anti-abuse)).

## Where the defaults come from

* **A peak of 100 sign-ins a minute.** Each of the 1,000 users signs in once or twice a day, which
  averages one or two sign-ins a minute across the site. The design peak is 10% of the users within
  one minute, for example at the start of the working day.
* **The whole peak through one channel.** A bucket without a key is shared by the whole instance and
  has to hold the whole peak. A channel's bucket is sized as if every user signed in through that
  channel.
* **As many confirmations as sign-ins in the peak minute.**
* **A ×2 reserve** for page reloads and repeated requests.
* **A 60-second window** for every bucket.

Limit = 100 × requests per sign-in × 2, rounded.

## Limits for 1,000 users

Paths are given from the root of Veriqa; with `Veriqa:PathBase` set, they start with that prefix. Each
limit is a key of the `Veriqa:RateLimit` section; the matching `…WindowSeconds` key sets its window.

| Bucket | Routes | Counted per | Requests per sign-in | Limit per 60 s | Key in `Veriqa:RateLimit` |
| - | - | - | - | - | - |
| `authorize` | `/connect/authorize` | instance | 1 | 200 | `AuthorizePermitLimit` |
| `callback` | `/connect/authorize/callback` and the sign-in page actions under it, `/auth/claims` | instance | 1 | 200 | `CallbackPermitLimit` |
| `token` | `POST /connect/token` | instance | 1, plus token refreshes — about 17 a minute for 1,000 sessions with a one-hour access token | 250 | `TokenPermitLimit` |
| `signalr` | `/hubs/auth` | instance, sliding window | 2: negotiation and connection | 400 | `SignalRPermitLimit` |
| `polling` | `GET /api/transaction/{id}/status` | instance | up to 10 for a sign-in in hop mode: the phone page polls the status every 3 seconds. On a computer, polling is needed only when SignalR does not work | 2000 | `PollingPermitLimit` |
| `webhook` | `/api/channels/{channel}/webhook` and `/api/channels/{channel}/webhook/{tenant}` | tenant segment | 2–3 platform updates per sign-in through a messaging app | 600 | `WebhookPermitLimit` |
| `email-start` | `/auth/email/start` (the form and sending the email), `POST /auth/email/code` | instance | 3 | 600 | `EmailStartPermitLimit` |
| `web-provider-pages` | `/auth/web-provider/{channel}/start`, `…/callback`, `…/answer`, `…/press` | instance | 3–4 | 800 | `WebProviderPagesPermitLimit` |
| `email-link-pages` | `/auth/email/confirm`, `/auth/email/claim` | instance | 2: opening the link and confirming | 400 | `EmailLinkPagesPermitLimit` |
| `confirmation-pages` | `/auth/transaction`, `/auth/transaction/confirm` with its answers, `/auth/transaction/cancel` | instance | 3–4 per confirmation | 800 | `ConfirmationPagesPermitLimit` |
| `hop-resolve` | `GET /r/{hop_token}` | instance | 1–2: a second one after the QR code is reissued | 400 | `HopResolvePermitLimit` |
| `hop-signal` | `POST /r/{hop_token}` | instance | up to 2 | 400 | `HopSignalPermitLimit` |
| `confirmation-create` | `POST /api/transaction/confirmation` | relying party | 1 per confirmation | 200 | `ConfirmationCreatePermitLimit` |
| `confirmation-result` | `GET /api/transaction/{id}/result`, `POST /api/link-handle/redeem` | relying party | 1–2, depending on how the relying party reads the result | 400 | `ConfirmationResultPermitLimit` |
| `user-auth` | sign-in attempts of one channel user | channel user | — | 5 | `UserAuthPermitLimit` |

The `/r/…` routes exist only when [hop mode](https://veriqa.app/docs/reference/configuration.md#veriqahopmode) is on;
`Veriqa:HopMode:HopPath` sets their prefix.

`email-start` counts requests, not emails: its 600 requests a minute per instance hold about 200
sign-ins through Email, three requests each. Emails to one address are limited separately: `SignInMailsPerAddress` (5 an hour) and `MailResendInterval` (30
seconds per transaction); see [Sending an email again](https://veriqa.app/docs/guides/channels.md#sending-an-email-again).

## Rescaling for your number of users

The correction factor is N / 1000. Multiply every bucket's limit by it, except `user-auth`: that
limit counts the sign-in attempts of one user and does not depend on the size of the site.

* **A different share in the peak minute.** If the share of users who sign in during your busiest
  minute is not 10%, compute the factor from the peak: P / 100, where P is the number of sign-ins
  in that minute.
* **Buckets per relying party.** `confirmation-create` and `confirmation-result` are counted
  separately for each relying party, so their factor comes from the confirmation peak of one relying
  party.
* **Several instances.** Each instance counts its own requests. With even load balancing, each one
  gets its share of the peak, and you can divide the limit of one instance by the number of instances.

## Examples

**A site with 10,000 users.** A factor of 10: `authorize` 2000, `token` 2500, `web-provider-pages`
8000\. `user-auth` stays at 5. The limits of the other buckets are multiplied the same way; the
example shows four of them.

```json appsettings.json theme={null}
{
  "Veriqa": {
    "RateLimit": {
      "AuthorizePermitLimit": 2000,
      "CallbackPermitLimit": 2000,
      "TokenPermitLimit": 2500,
      "WebProviderPagesPermitLimit": 8000
    }
  }
}
```

**An internal portal for 200 employees.** A factor of 0.2: `authorize` 40, `token` 50, `email-start`
120\. Such a portal also works with the defaults, but it does not need a reserve for 1,000 users: a
lower `email-start` limit caps how many emails go out in a minute if a stream of requests hits the
Email form.

**1,000 employees whose shift starts at the same time.** If 300 people sign in during the first minute
of the shift, compute the factor from the peak: 300 / 100 = 3. `authorize` and `callback` 600 each,
`signalr` 1200.

## Where the limits are set

The limits are read only from the global `Veriqa:RateLimit` section of the host configuration; a
tenant or a single client cannot override them. The full list of keys and their defaults is in the
[configuration reference](https://veriqa.app/docs/reference/configuration.md#veriqaratelimit).


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