Rate Limits
The LinkForty Cloud API limits how many requests your organization can make each minute, based on your plan.
Overview
LinkForty Cloud counts API requests per organization, per minute. See your plan's limit.
LinkForty Core (self-hosted) has no built-in rate limits. If you need them, add them at your reverse proxy.
No request limits on:
- Short link redirects (
/:shortCode)
Rate Limit Headers
Rate-limited API responses include this information:
HTTP/1.1 200 OK
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 55
X-RateLimit-Reset: 1711373520
| Header | Description | Example |
|---|---|---|
X-RateLimit-Limit | Maximum requests per minute | 60 |
X-RateLimit-Remaining | Requests remaining in current minute | 55 |
X-RateLimit-Reset | Unix timestamp when limit resets (seconds) | 1711373520 |
Exceeding Rate Limits
When you exceed the rate limit:
Status Code: 429 Too Many Requests
{
"message": "API rate limit exceeded. Your pro plan allows 60 requests/minute.",
"error": "ORG_RATE_LIMIT_EXCEEDED",
"limit": 60,
"retryAfterSeconds": 42,
"tier": "pro"
}
Response Headers:
HTTP/1.1 429 Too Many Requests
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1642531200
Handling Rate Limits
Basic Retry Logic
async function makeRequest(url, options) {
const response = await fetch(url, options);
if (response.status === 429) {
const { retryAfterSeconds: retryAfter = 60 } = await response.json();
console.log(`Rate limited. Retrying in ${retryAfter} seconds...`);
await new Promise(resolve => setTimeout(resolve, retryAfter * 1000));
return makeRequest(url, options);
}
return response;
}
Exponential Backoff
async function makeRequestWithBackoff(url, options, attempt = 1) {
const response = await fetch(url, options);
if (response.status === 429 && attempt <= 3) {
const delay = Math.min(1000 * Math.pow(2, attempt), 32000);
console.log(`Rate limited. Waiting ${delay}ms before retry ${attempt}/3`);
await new Promise(resolve => setTimeout(resolve, delay));
return makeRequestWithBackoff(url, options, attempt + 1);
}
return response;
}
Check Before Sending
class RateLimitedClient {
constructor(apiKey, limit = 60) {
this.apiKey = apiKey;
this.limit = limit;
this.remaining = limit;
this.resetTime = Date.now() + 60000;
}
updateLimits(headers) {
this.remaining = parseInt(headers.get('X-RateLimit-Remaining'));
this.resetTime = parseInt(headers.get('X-RateLimit-Reset')) * 1000;
}
async waitIfNeeded() {
if (this.remaining <= 0) {
const waitTime = this.resetTime - Date.now();
if (waitTime > 0) {
console.log(`Rate limit reached. Waiting ${waitTime}ms...`);
await new Promise(resolve => setTimeout(resolve, waitTime));
}
}
}
async request(url, options = {}) {
await this.waitIfNeeded();
const response = await fetch(url, {
...options,
headers: {
...options.headers,
'Authorization': `Bearer ${this.apiKey}`
}
});
this.updateLimits(response.headers);
return response;
}
}
// Usage
const client = new RateLimitedClient(API_KEY);
const response = await client.request('https://api.linkforty.com/api/links');
Bulk Operations
A bulk request counts as one request against your plan's limit, and can create up to 100 links:
# This counts as 1 request
curl -X POST https://api.linkforty.com/api/links/bulk-create \
-H "Authorization: Bearer $LINKFORTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"links": [
{ "templateId": "template_123", "originalUrl": "https://example.com/1" },
{ "templateId": "template_123", "originalUrl": "https://example.com/2" }
]
}'
Increasing Rate Limits
Cloud Plans
Cloud rate limits are enforced at the organization level based on your subscription tier.
Free Tier:
- 10 requests/minute
- 1,000 links total
- 5,000 clicks/month
- 1 API key
Pro Tier:
- 60 requests/minute
- 25,000 links
- 100,000 clicks/month
- 3 API keys
Business Tier:
- 200 requests/minute
- 100,000 links
- 500,000 clicks/month
- 10 API keys
Unlimited Tier:
- 1,000 requests/minute
- Unlimited links and clicks
- Unlimited API keys
- Contact: [email protected]
Best Practices
1. Use Bulk Endpoints
Instead of creating links one by one:
Bad:
// 100 requests
for (const url of urls) {
await fetch('https://api.linkforty.com/api/links', {
method: 'POST',
body: JSON.stringify({ templateId: 'template_123', originalUrl: url })
});
}
Good:
// 1 request
await fetch('https://api.linkforty.com/api/links/bulk-create', {
method: 'POST',
body: JSON.stringify({
links: urls.map(url => ({ templateId: 'template_123', originalUrl: url }))
})
});
2. Cache Responses
Don't fetch the same data repeatedly:
const cache = new Map();
async function getLink(id) {
if (cache.has(id)) {
return cache.get(id);
}
const response = await fetch(`https://api.linkforty.com/api/links/${id}`);
const link = await response.json();
cache.set(id, link);
return link;
}
3. Batch Requests
Group multiple operations:
// Instead of 50 separate requests, wait and batch
const pendingCreates = [];
function queueLinkCreation(data) {
pendingCreates.push(data);
if (pendingCreates.length >= 50) {
flushBatch();
}
}
async function flushBatch() {
const batch = pendingCreates.splice(0, pendingCreates.length);
await fetch('https://api.linkforty.com/api/links/bulk-create', {
method: 'POST',
body: JSON.stringify({ links: batch })
});
}
// Flush every 5 seconds if there are pending requests
setInterval(() => {
if (pendingCreates.length > 0) {
flushBatch();
}
}, 5000);
4. Monitor Rate Limit Headers
Track your usage:
async function monitoredRequest(url, options) {
const response = await fetch(url, options);
const remaining = response.headers.get('X-RateLimit-Remaining');
const limit = response.headers.get('X-RateLimit-Limit');
console.log(`Rate limit: ${remaining}/${limit} remaining`);
if (parseInt(remaining) < 10) {
console.warn('Approaching rate limit!');
}
return response;
}
5. Implement Circuit Breakers
Stop sending requests when rate limited:
class CircuitBreaker {
constructor() {
this.failures = 0;
this.state = 'CLOSED'; // CLOSED, OPEN, HALF_OPEN
this.resetTime = null;
}
async execute(fn) {
if (this.state === 'OPEN') {
if (Date.now() < this.resetTime) {
throw new Error('Circuit breaker is OPEN');
}
this.state = 'HALF_OPEN';
}
try {
const result = await fn();
this.onSuccess();
return result;
} catch (error) {
this.onFailure();
throw error;
}
}
onSuccess() {
this.failures = 0;
this.state = 'CLOSED';
}
onFailure() {
this.failures++;
if (this.failures >= 3) {
this.state = 'OPEN';
this.resetTime = Date.now() + 60000; // 1 minute
}
}
}
const breaker = new CircuitBreaker();
await breaker.execute(() =>
fetch('https://api.linkforty.com/api/links')
);
Monitoring Rate Limits
Check Response Headers
Monitor your rate limit usage by inspecting response headers:
const response = await fetch('https://api.linkforty.com/api/links', {
headers: { 'Authorization': `Bearer ${API_KEY}` }
});
const limit = response.headers.get('X-RateLimit-Limit');
const remaining = response.headers.get('X-RateLimit-Remaining');
const reset = response.headers.get('X-RateLimit-Reset');
console.log(`Rate Limit: ${remaining}/${limit} remaining`);
console.log(`Resets at: ${new Date(parseInt(reset) * 1000).toISOString()}`);
if (parseInt(remaining) < 10) {
console.warn('Approaching rate limit!');
}
Webhook Rate Limits
Webhook deliveries have separate limits:
Outbound Webhooks:
- 10 deliveries/second per webhook
- 3 retry attempts with exponential backoff
- 30-second timeout per delivery
If your webhook endpoint is slow or down, deliveries may be delayed or dropped.
Common Errors
Error: "API rate limit exceeded"
{
"message": "API rate limit exceeded. Your pro plan allows 60 requests/minute.",
"error": "ORG_RATE_LIMIT_EXCEEDED",
"limit": 60,
"retryAfterSeconds": 42,
"tier": "pro"
}
Solution:
- Wait for
retryAfterSecondsseconds - Implement exponential backoff
- Use bulk endpoints
- Cache responses
Error: "Bulk operation limit exceeded"
Requests over the limit return a 400 with the message Maximum 100 links allowed per bulk create and the code BULK_LIMIT_EXCEEDED.
Solution:
- Split into batches of 100 links each
Next Steps
- Error Handling - Handle API errors gracefully
- Authentication - API key management
- Create Link API - API reference
- Bulk Operations - Batch link creation
Support
Need higher rate limits?
- Pro Plan: 60 requests/minute
- Business Plan: 200 requests/minute
- Unlimited Plan: 1,000 requests/minute
- Self-Hosted: No limits by default, deploy on your infrastructure