Ratelimit
Ratelimit an action based on an identifier.
Changelog
Date | Changes |
---|---|
Mar 16 2024 | Introduced endpoint |
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Body
Identifier of your user, this can be their userId, an email, an ip or anything else.
"user_123"
How many requests may pass in a given window.
x > 0
10
The window duration in milliseconds
x >= 1000
60000
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"
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.
x >= 0
2
Async will return a response immediately, lowering latency at the cost of accuracy.
Attach any metadata to this request
Resources that are about to be accessed by the user
[
{
"type": "project",
"id": "p_123",
"name": "dub"
}
]
Response
Returns true if the request should be processed, false if it was rejected.
true
How many requests are allowed within a window.
10
How many requests can still be made in the current window.
9
A unix millisecond timestamp when the limits reset.
1709804263654
Was this page helpful?