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

# Rate Limits

> API rate limits and quotas

DocIntell enforces per-tenant rate limits to ensure fair usage and system stability.

## Current Limits

| Operation              | Limit          | Window |
| ---------------------- | -------------- | ------ |
| **Document Ingestion** | 100 documents  | 1 hour |
| **Job Status Checks**  | 1,000 requests | 1 hour |

## Response Headers

Every response includes rate limit information:

```http theme={null}
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1701612000
```

| Header                  | Description                      |
| ----------------------- | -------------------------------- |
| `X-RateLimit-Limit`     | Maximum requests allowed         |
| `X-RateLimit-Remaining` | Requests remaining in window     |
| `X-RateLimit-Reset`     | Unix timestamp when limit resets |

## Rate Limit Errors

When you exceed the limit, you'll receive a `429 Too Many Requests` response:

```json theme={null}
{
  "error": "rate_limit_exceeded",
  "message": "Rate limit: 100 documents/hour. Retry after 3600 seconds",
  "retry_after": 3600
}
```

The response includes a `Retry-After` header indicating when to retry.

## Handling Rate Limits

### Implement Exponential Backoff

```python theme={null}
from tenacity import retry, stop_after_attempt, wait_exponential

@retry(
    stop=stop_after_attempt(5),
    wait=wait_exponential(multiplier=1, min=2, max=60)
)
def upload_with_retry(file_path):
    response = requests.post(
        "https://api.docintell.com/v1/documents",
        headers={"Authorization": f"Bearer {API_KEY}"},
        files={"file": open(file_path, "rb")}
    )

    if response.status_code == 429:
        retry_after = int(response.headers.get("Retry-After", 60))
        raise RateLimitError(retry_after)

    return response.json()
```

### Monitor Usage

Check remaining quota before batch operations:

```python theme={null}
def check_rate_limit(response):
    remaining = int(response.headers.get("X-RateLimit-Remaining", 0))
    if remaining < 10:
        print(f"Warning: Only {remaining} requests remaining")
```

## Best Practices

<CardGroup cols={2}>
  <Card title="Batch Wisely" icon="layer-group">
    Group multiple operations when possible
  </Card>

  <Card title="Cache Results" icon="database">
    Cache extraction results to avoid duplicate requests
  </Card>

  <Card title="Use Webhooks" icon="webhook">
    Webhooks don't count against rate limits
  </Card>

  <Card title="Monitor Usage" icon="chart-line">
    Track rate limit headers to avoid hitting limits
  </Card>
</CardGroup>

## Increasing Limits

Need higher limits? Contact us at [support@docintell.com](mailto:support@docintell.com) to discuss enterprise plans with higher quotas.
