Skip to main content

Rate Limit Tiers

Rate limits vary based on your subscription plan:

Free Plan

100 requests per 15 minutes

Pro Plan

1,000 requests per 15 minutes

Enterprise Plan

5,000 requests per 15 minutes

Rate Limit Headers

Every API response includes rate limit information in the headers:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1640000000
HeaderDescription
X-RateLimit-LimitMaximum requests allowed in the time window
X-RateLimit-RemainingNumber of requests remaining in current window
X-RateLimit-ResetUnix timestamp when the rate limit resets

Rate Limit Exceeded

When you exceed the rate limit, you’ll receive a 429 Too Many Requests response:
{
  "success": false,
  "message": "Rate limit exceeded. Please try again later.",
  "retryAfter": 900
}
The retryAfter field indicates how many seconds to wait before making another request.

Best Practices

Always check the X-RateLimit-Remaining header to track your usage and avoid hitting limits.
const response = await axios.get('https://snip.sa/api/urls');
const remaining = response.headers['x-ratelimit-remaining'];

if (remaining < 10) {
  console.warn('Approaching rate limit!');
}
When you receive a 429 response, wait before retrying with exponential backoff:
async function makeRequestWithRetry(url, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    try {
      return await axios.get(url);
    } catch (error) {
      if (error.response?.status === 429) {
        const waitTime = Math.pow(2, i) * 1000; // Exponential backoff
        await new Promise(resolve => setTimeout(resolve, waitTime));
      } else {
        throw error;
      }
    }
  }
}
Cache API responses when appropriate to reduce the number of requests:
const cache = new Map();

async function getCachedUrl(id) {
  if (cache.has(id)) {
    return cache.get(id);
  }
  
  const response = await axios.get(`https://snip.sa/api/urls/${id}`);
  cache.set(id, response.data);
  return response.data;
}
Use bulk operations when available to reduce request count:
// Instead of deleting URLs one by one
// Use bulk delete
await axios.post('https://snip.sa/api/urls/bulk-delete', {
  ids: ['id1', 'id2', 'id3']
});
Request only the data you need with appropriate page sizes:
// Request smaller pages more frequently
const response = await axios.get('https://snip.sa/api/urls', {
  params: {
    page: 1,
    limit: 20  // Don't request max limit if not needed
  }
});

Handling Rate Limits

Example Implementation

const axios = require('axios');

class SnipClient {
  constructor(apiKey) {
    this.apiKey = apiKey;
    this.baseUrl = 'https://snip.sa/api';
  }

  async request(method, endpoint, data = null) {
    try {
      const response = await axios({
        method,
        url: `${this.baseUrl}${endpoint}`,
        data,
        headers: {
          'X-API-Key': this.apiKey,
          'Content-Type': 'application/json'
        }
      });

      // Log rate limit info
      console.log('Rate Limit Remaining:', 
        response.headers['x-ratelimit-remaining']);

      return response.data;
    } catch (error) {
      if (error.response?.status === 429) {
        const retryAfter = error.response.data.retryAfter || 60;
        console.log(`Rate limited. Waiting ${retryAfter} seconds...`);
        await new Promise(resolve => setTimeout(resolve, retryAfter * 1000));
        return this.request(method, endpoint, data); // Retry
      }
      throw error;
    }
  }
}

Upgrading Your Plan

Need higher rate limits? Upgrade your plan:

Upgrade Plan

View pricing and upgrade options

Enterprise Custom Limits

Enterprise customers can request custom rate limits based on their needs. Contact our sales team:

Contact Sales

Discuss custom rate limits for your organization