Skip to main content

Overview

Day Copilot implements rate limiting to ensure fair usage and maintain service quality for all users. Rate limits vary by subscription tier and are applied per authenticated user.
Rate limit information is included in every API response via headers, allowing you to track your usage in real-time.

Rate Limit Tiers

TierRequests per MinuteRequests per HourRequests per Day
Free601,00010,000
Pro30010,000100,000
EnterpriseCustomCustomCustom

Rate Limit Headers

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

Checking Rate Limits

const response = await fetch('https://app.daycopilot.ai/api/v1/tasks', {
  headers: {
    'Authorization': `Bearer ${token}`
  }
});

const rateLimit = {
  limit: response.headers.get('X-RateLimit-Limit'),
  remaining: response.headers.get('X-RateLimit-Remaining'),
  reset: new Date(parseInt(response.headers.get('X-RateLimit-Reset')) * 1000)
};

console.log(`Requests remaining: ${rateLimit.remaining}/${rateLimit.limit}`);
console.log(`Resets at: ${rateLimit.reset}`);

Rate Limit Exceeded

When you exceed the rate limit, you’ll receive a 429 Too Many Requests response:
{
  "error": "Rate limit exceeded",
  "message": "Too many requests. Please retry after the rate limit resets.",
  "status": 429,
  "retryAfter": 45
}
The response includes:
  • retryAfter: Seconds until you can retry the request
  • X-RateLimit-Reset header: Unix timestamp when limits reset

Best Practices

When you hit rate limits, implement exponential backoff:
async function makeRequestWithBackoff(url, options, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    const response = await fetch(url, options);

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

    // Exponential backoff: 1s, 2s, 4s
    const delay = Math.pow(2, i) * 1000;
    await new Promise(resolve => setTimeout(resolve, delay));
  }

  throw new Error('Max retries exceeded');
}
Reduce API calls by caching responses locally:
const cache = new Map();
const CACHE_TTL = 5 * 60 * 1000; // 5 minutes

async function getCachedTasks(token) {
  const now = Date.now();
  const cached = cache.get('tasks');

  if (cached && now - cached.timestamp < CACHE_TTL) {
    return cached.data;
  }

  const response = await fetch('https://app.daycopilot.ai/api/v1/tasks', {
    headers: { 'Authorization': `Bearer ${token}` }
  });

  const data = await response.json();
  cache.set('tasks', { data, timestamp: now });

  return data;
}
When possible, batch multiple operations into a single request to reduce API calls.
Instead of polling for changes, use webhooks (when available) to receive real-time updates without making repeated API calls.
Track your rate limit usage and set up alerts before you hit limits:
function checkRateLimitUsage(response) {
  const remaining = parseInt(response.headers.get('X-RateLimit-Remaining'));
  const limit = parseInt(response.headers.get('X-RateLimit-Limit'));
  const usagePercent = ((limit - remaining) / limit) * 100;

  if (usagePercent > 80) {
    console.warn(`Warning: ${usagePercent.toFixed(1)}% of rate limit used`);
  }
}

Handling 429 Responses

Proper error handling for rate limit responses:
async function makeRequest(url, options) {
  const response = await fetch(url, options);

  if (response.status === 429) {
    const retryAfter = response.headers.get('Retry-After') || 60;
    console.log(`Rate limited. Retrying in ${retryAfter} seconds...`);

    await new Promise(resolve =>
      setTimeout(resolve, parseInt(retryAfter) * 1000)
    );

    return makeRequest(url, options); // Retry
  }

  return response;
}

Rate Limit Increases

Need higher rate limits? Contact our sales team to discuss Enterprise plans with custom limits tailored to your needs.

Contact Sales

Discuss custom rate limits for your use case

Next Steps