Overview
limiter.check() is the core method. Call it before any business logic you want to rate limit.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
identifier | string | ✅ | Unique key for the entity (user ID, IP, email, etc.) |
rule | string | ✅ | Name of the rule as defined in your dashboard |
Return Value (CheckResult)
Basic Example
Express Route Example
Error Handling
check() throws a RateLimiterError in these cases:
| Error Code | When it happens |
|---|---|
MISSING_API_KEY | SDK initialized without an API key |
MISSING_FIELDS | identifier or rule not provided |
NETWORK_ERROR | Could not reach the Throttlr API |
UNKNOWN_ERROR | Unexpected server-side error |