Skip to main content

Overview

Rate limits protect the API from abuse and ensure fair usage for all users. agntdata uses request-based rate limiting per workspace.

How Rate Limiting Works

Rate limits are applied per workspace with a rolling 60-second window:
  • Each workspace has a requests-per-minute (RPM) limit based on their plan
  • All API keys in a workspace share the same rate limit bucket
  • When the limit is exceeded, requests return 429 Too Many Requests

Rate Limit Response

When you exceed rate limits, you’ll receive a 429 response:
{
  "success": false,
  "error": {
    "code": "RATE_LIMITED",
    "message": "Rate limit exceeded",
    "retryAfter": 30
  }
}
The retryAfter field indicates how many seconds to wait before retrying.

Response Headers

Rate limit information is included in the Retry-After header when limits are exceeded.

Best Practices

When you hit a rate limit, wait and retry with increasing delays:
async function fetchWithRetry(url, options, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    const response = await fetch(url, options);
    
    if (response.status === 429) {
      const retryAfter = response.headers.get('Retry-After') || Math.pow(2, i);
      await sleep(retryAfter * 1000);
      continue;
    }
    
    return response;
  }
  throw new Error('Max retries exceeded');
}
Instead of bursting requests, space them out over time to avoid hitting limits.
Cache API responses when data doesn’t change frequently:
  • Company profiles: Cache for 24 hours
  • User profiles: Cache for 1-6 hours
  • Posts/content: Cache for 15-60 minutes
When available, use bulk endpoints to fetch multiple items in one request instead of making many individual requests.

Credit Costs

Each API call consumes credits based on the endpoint. Credit costs vary by endpoint complexity and are deducted from your workspace balance. The response includes billing information:
{
  "success": true,
  "data": { ... },
  "meta": {
    "costCents": 1,
    "purchasedBalanceCents": 949,
    "subscriptionRemainingCents": 0,
    "cached": false,
    "latencyMs": 245
  }
}

Next Steps

Error Handling

Learn how to handle rate limit and other errors.

Billing

Understand credit consumption and pricing.