> ## Documentation Index
> Fetch the complete documentation index at: https://agnt.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Rate Limits

> Understand rate limits and quotas for the agntdata API.

## 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:

```json theme={null}
{
  "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

<AccordionGroup>
  <Accordion title="Implement Exponential Backoff">
    When you hit a rate limit, wait and retry with increasing delays:

    ```javascript theme={null}
    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');
    }
    ```
  </Accordion>

  <Accordion title="Space Out Requests">
    Instead of bursting requests, space them out over time to avoid hitting limits.
  </Accordion>

  <Accordion title="Cache Responses">
    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
  </Accordion>

  <Accordion title="Use Bulk Endpoints">
    When available, use bulk endpoints to fetch multiple items in one request instead of making many individual requests.
  </Accordion>
</AccordionGroup>

## 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:

```json theme={null}
{
  "success": true,
  "data": { ... },
  "meta": {
    "costCents": 1,
    "purchasedBalanceCents": 949,
    "subscriptionRemainingCents": 0,
    "cached": false,
    "latencyMs": 245
  }
}
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Error Handling" icon="triangle-exclamation" href="/concepts/errors">
    Learn how to handle rate limit and other errors.
  </Card>

  <Card title="Billing" icon="credit-card" href="/billing/credits">
    Understand credit consumption and pricing.
  </Card>
</CardGroup>
