Skip to main content
The Limitly Next.js SDK provides powerful request validation capabilities to enforce rate limits and usage policies.

Basic Validation

Validate a request using the user’s API key:

API Route Integration

Integrate validation directly into your Next.js API routes:

Validation Response

The validation method returns a detailed response:

Using withRateLimit Helper

The SDK provides a withRateLimit helper for easier integration:

Custom Error Handling

Customize error responses for rate limit exceeded:

Validation Options

You can pass additional options to the validation:

Error Types

The SDK handles various error scenarios:
  • Invalid API Key: Returns 401 Unauthorized
  • Rate Limit Exceeded: Returns 429 Too Many Requests
  • Network Errors: Returns 500 Internal Server Error
  • Validation Errors: Returns 400 Bad Request

Next Steps