Skip to main content

Documentation Index

Fetch the complete documentation index at: https://houseofdragon-079a8546.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Step 1: Create a Project

  1. Go to the Throttlr Dashboard and sign in with Google.
  2. Click New Project and give it a name (e.g. my-api).
  3. Your project is created with a unique API Key — copy it from the API Key tab.
Your API key is only shown once in plaintext at creation time. Store it in your environment variables immediately.

Step 2: Create a Rate Limit Rule

In your project dashboard, go to the Rules tab and click New Rule.
FieldExample ValueDescription
Namesend_emailA unique identifier for this rule, used in SDK calls
Limit5Max requests allowed per window
Window60Time window in seconds
AlgorithmFIXED_WINDOWFixed or Sliding Window
Rule names are what you pass to limiter.check(). Use descriptive names like login_attempt or generate_report.

Step 3: Install the SDK

npm install @throttlr/sdk

Step 4: Initialize & Check

import { RateLimiter } from "@throttlr/sdk";

const limiter = new RateLimiter({
  apiKey: process.env.THROTTLR_API_KEY!,
  baseUrl: "https://api.throttlr.dev/sdk",
});

// In your route handler:
const result = await limiter.check({
  identifier: "user_123",   // Unique user or IP
  rule: "send_email",       // Must match a rule in your dashboard
});

if (!result.allowed) {
  return res.status(429).json({ error: "Too many requests" });
}

// Continue with your logic...

Step 5: View Logs

Head to the Logs tab in your project dashboard. You’ll see every request checked by the SDK in real time, with status (✅ Allowed / ❌ Blocked), identifier, rule name, and timestamp.

What’s Next?

SDK Reference

Full API for check() and RateLimitermiddleware

Algorithms Explained

Fixed Window vs Sliding Window — which should you use?