Field | Type | Required | Description | Example |
---|---|---|---|---|
Namespace |
*string | ➖ | Namespaces group different limits together for better analytics. You might have a namespace for your public API and one for internal tRPC routes. | email.outbound |
Identifier |
string | ✔️ | Identifier of your user, this can be their userId, an email, an ip or anything else. | user_123 |
Limit |
int64 | ✔️ | How many requests may pass in a given window. | 10 |
Duration |
int64 | ✔️ | The window duration in milliseconds | 60000 |
Cost |
*int64 | ➖ | Expensive requests may use up more tokens. You can specify a cost to the request here and we'll deduct this many tokens in the current window. If there are not enough tokens left, the request is denied. Set it to 0 to receive the current limit without changing anything. |
2 |
Async |
*bool | ➖ | Async will return a response immediately, lowering latency at the cost of accuracy. | |
Meta |
map[string]any | ➖ | Attach any metadata to this request | |
Resources |
[]operations.Resources | ➖ | Resources that are about to be accessed by the user | [ { "type": "project", "id": "p_123", "name": "dub" } ] |