LinkSnap
Guides

Rate Limits

Understand quota and concurrency limits for your plan

Rate Limits

LinkSnap uses rate limits to ensure fair usage and service reliability. Understanding these limits helps you build robust integrations.

Types of Limits

Request Rate Limit

Maximum requests per minute per API key:

PlanRequests/minute
Free10
Basic30
Pro60
Team120

Concurrency Limit

Maximum simultaneous screenshots being processed:

PlanConcurrent
Free2
Basic5
Pro10
Team20

Monthly Quota

Total screenshots per billing cycle:

PlanMonthly Quota
Free100
Basic5,000
Pro20,000
Team60,000

Rate Limit Headers

Every response includes rate limit information:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1704067200
HeaderDescription
X-RateLimit-LimitMax requests per window
X-RateLimit-RemainingRemaining requests
X-RateLimit-ResetUnix timestamp when limit resets

Handling Rate Limits

When rate limited, you'll receive:

{
  "success": false,
  "error": {
    "code": "RATE_LIMITED",
    "message": "Too many requests. Please try again later.",
    "retryAfter": 15
  }
}

Best Practices

  1. Check headers - Monitor remaining quota proactively
  2. Implement backoff - Use exponential backoff on 429 errors
  3. Queue requests - Buffer requests during high load
  4. Use webhooks - Avoid polling by using webhook callbacks

Example: Exponential Backoff

async function captureWithRetry(url, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    const response = await fetch('https://api.linksnap.dev/v1/screenshots', {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${API_KEY}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({ url }),
    });

    if (response.status !== 429) {
      return response.json();
    }

    const retryAfter = response.headers.get('Retry-After') || Math.pow(2, i);
    await new Promise(resolve => setTimeout(resolve, retryAfter * 1000));
  }

  throw new Error('Max retries exceeded');
}

Quota Management

Check Remaining Quota

GET /v1/account/quota
{
  "plan": "pro",
  "monthlyQuota": 20000,
  "used": 5432,
  "remaining": 14568,
  "resetsAt": "2024-02-01T00:00:00Z"
}

Cache Hits Don't Count

When a screenshot is served from cache, it doesn't count against your quota. Check the cached field in responses:

{
  "data": {
    "id": "ss_abc123",
    "cached": true  // No quota deducted
  }
}

Failed Requests Refunded

If a screenshot fails (timeout, blocked URL, etc.), the quota is automatically refunded.

Need Higher Limits?

  • Upgrade your plan - Higher plans have higher limits
  • Contact sales - For custom enterprise limits
  • Optimize usage - Batch similar URLs, leverage caching