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

# Rate Limits

> Request limits and quotas for the Adaline API.

Adaline enforces rate limits to ensure fair usage and platform stability. Limits apply per workspace.

## Default Limits

| Resource        | Limit | Window     |
| --------------- | ----- | ---------- |
| Log Trace APIs  | 600   | per minute |
| Log Span APIs   | 600   | per minute |
| Deployment APIs | 300   | per minute |
| All other APIs  | 100   | per minute |

<Info>
  These are default limits. If you need higher limits for your use case, contact [support@adaline.ai](mailto:support@adaline.ai).
</Info>

## Handling Rate Limits

When you exceed the rate limit, the API returns a `429 Too Many Requests` response:

```json theme={null}
{
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Rate limit exceeded. Please try again later."
  }
}
```

## Payload Limits

| Resource                        | Max Size |
| ------------------------------- | -------- |
| Request body                    | 32 MB    |
| Response body                   | 32 MB    |
| Span content                    | 1 MB     |
| Span content attachment (image) | 10 MB    |
| Span content attachment (pdf)   | 10 MB    |

Requests exceeding payload limits receive a `413 Payload Too Large` response.

### SDK Retry Behavior

**TypeScript SDK (`@adaline/client`)**

* The Monitor class buffers logs and flushes in batches
* Failed flushes are automatically retried with exponential backoff
* Configure `flushInterval` and `maxBufferSize` to control batching

```typescript theme={null}
const monitor = adaline.initMonitor({
  projectId: "your-project-id",
  flushInterval: 5,    // seconds between flushes
  maxBufferSize: 100,  // max items before forced flush
});
```

**Gateway SDK (`@adaline/gateway`)**

* Built-in configurable queue with automatic retry
* Exponential backoff on transient failures (429, 5xx)
* Pluggable queue backend for custom retry logic

```typescript theme={null}
const gateway = new Gateway({
  // Custom queue options are configured per-request or via plugins
});
```

## Best Practices

<AccordionGroup>
  <Accordion title="Batch your log submissions">
    Use the SDK's built-in batching (Monitor class) rather than sending individual API calls for each trace or span. This significantly reduces the number of requests.
  </Accordion>

  <Accordion title="Cache deployments locally">
    Use `initLatestDeployment()` with a `refreshInterval` to cache prompt deployments locally and reduce deployment fetch requests.
  </Accordion>

  <Accordion title="Implement exponential backoff">
    If making direct API calls, implement exponential backoff when you receive `429` responses. Start with a 1-second delay and double it on each retry, up to a maximum of 60 seconds.
  </Accordion>

  <Accordion title="Monitor your usage">
    Review plan limits in your workspace settings and contact support if your application needs higher limits.
  </Accordion>
</AccordionGroup>
