Legacy TinyLimiter documentation. About this product

Add rate limiting to your API in minutes. No infrastructure to manage.

1. Get Your API Key

  1. Sign up at dashboard.tinyscale.io
  2. Navigate to API Keys
  3. Click Create Key → Select TinyLimiter → Choose Test mode
  4. Copy your key (it starts with ts_limiter_test_)

2. Make Your First Request

curl -X POST https://limiter.tinyscale.io/v1/check \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "namespace": "api",
    "identifier": "user_123",
    "limit": 10,
    "window": 60000
  }'

Response:

{
  "data": {
    "allowed": true,
    "remaining": 9,
    "limit": 10,
    "reset_at": 1703980800000,
    "namespace": "api",
    "identifier": "user_123"
  }
}

3. Integrate Into Your App

async function checkRateLimit(userId) {
  const response = await fetch('https://limiter.tinyscale.io/v1/check', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.TINYSCALE_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      namespace: 'api',
      identifier: userId,
      limit: 100,
      window: 60000,
    }),
  });

  const { data } = await response.json();
  return data.allowed;
}

// Usage in your route handler
app.get('/api/resource', async (req, res) => {
  const allowed = await checkRateLimit(req.user.id);
  
  if (!allowed) {
    return res.status(429).json({ error: 'Too many requests' });
  }
  
  // Process request...
});

What's Next?