Skip to main content
Unkey’s rate limiting system allows you to set different limits for different customers, override defaults dynamically, and implement sophisticated tier-based strategies. This enables fair usage policies while rewarding premium customers with higher limits.

Rate limit architecture

Unkey supports multiple named rate limits per key, giving you fine-grained control:
Auto-apply vs manual rate limits:
  • autoApply: true — Checked on every verification automatically
  • autoApply: false — Only checked when explicitly specified in verification request

Auto-apply rate limits

Auto-apply limits are enforced on every key verification:

Manual rate limits

Manual limits are only checked when explicitly specified:

Dynamic cost overrides

Adjust how much each request “costs” against the rate limit:

Example: Token-based rate limiting

For AI APIs, limit by tokens consumed rather than request count:

Per-customer rate limits

Set different rate limits for different subscription tiers:

Updating rate limits

Adjust limits when customers upgrade or downgrade:

Operation-specific limits

Apply different limits to different endpoints:

Identity-level rate limits

Share rate limits across all keys for a user/organization:
Identity-level rate limits are perfect for multi-tenant applications where each organization should have a shared quota across all their API keys.

Temporary overrides

Grant temporary rate limit increases:

Bypass rate limits

For internal or admin keys:

Best practices

Begin with strict rate limits and increase them based on actual usage patterns. Easier to give more than to take away.
Don’t lump everything into a single “requests” limit. Separate read/write operations, expensive queries, and bulk operations.
When rate limited, tell users which limit they hit and when it resets. Include retry-after headers.
Track how close customers are to their limits. Proactively suggest upgrades when they’re hitting 80%.

Rate limit response headers

Include rate limit information in your API responses:

Next steps

Multi-tenant applications

Share rate limits across organizations

Usage limits

Combine rate limits with credit-based quotas