Check and enforce rate limits for any identifier (user ID, IP address, API client, etc.).
Use this for rate limiting beyond API keys - limit users by ID, IPs by address, or any custom identifier. Supports namespace organization, variable costs, and custom overrides.
Important: Always returns HTTP 200. Check the success
field to determine if the request should proceed.
Required Permissions
Your root key must have one of the following permissions:
ratelimit.*.limit
(to check limits in any namespace)ratelimit.<namespace_id>.limit
(to check limits in a specific namespace)Side Effects
Records rate limit metrics for analytics and monitoring, updates rate limit counters with sliding window algorithm, and optionally triggers override matching for custom limits.
Unkey uses API keys (root keys) for authentication. These keys authorize access to management operations in the API. To authenticate, include your root key in the Authorization header of each request:
Authorization: Bearer unkey_123
Root keys have specific permissions attached to them, controlling what operations they can perform. Key permissions follow a hierarchical structure with patterns like resource.resource_id.action
(e.g., apis.*.create_key
, apis.*.read_api
).
Security best practices:
Rate limit check completed. Always returns HTTP 200 - check the success
field to determine if the request is allowed.
The response is of type object
.