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

# Rate limits

> How many requests your plan allows, and how to stay under it.

Rate limits apply to your organization, measured over a rolling 60-second window.

## Limits by plan

| Plan | Requests per minute |
| - | - |
| Free | 500 |
| Plus | 1,000 |
| Growth | 2,000 |
| Business | 3,000 |
| Scale | 5,000 |
| Enterprise | Uncapped |

> [!NOTE]
>
> The limit applies **per organization**, not per API key. Every key you issue draws on the same budget, so a Growth organization gets 2,000 requests per minute in total no matter how many keys it holds. Issuing another key does not buy more throughput.

## Reading the headers

Every response carries your current position, so you never have to guess:

| Header | Meaning |
| - | - |
| `X-RateLimit-Limit` | Requests allowed per minute. `-1` on Enterprise |
| `X-RateLimit-Remaining` | Requests left in this window |
| `X-RateLimit-Reset` | Seconds until the window rolls over |
| `X-RateLimit-Plan` | The plan the limit came from |

```http theme={null}
HTTP/1.1 200 OK
X-RateLimit-Limit: 2000
X-RateLimit-Remaining: 1847
X-RateLimit-Reset: 43
X-RateLimit-Plan: Growth
```

## Being limited

Over the limit, you get `429` with a `Retry-After` header:

```http theme={null}
HTTP/1.1 429 Too Many Requests
Retry-After: 43
```

```json theme={null}
{
  "error": {
    "message": "Rate limit exceeded. Please retry in 43 seconds.",
    "status_code": 429,
    "code": "RATE_LIMIT_EXCEEDED"
  }
}
```

The window is rolling, not fixed: it covers the last 60 seconds from now, so capacity returns gradually rather than all at once on the minute.

## Handling limits well

### Retry with exponential backoff

Respect `Retry-After` when it is there, and back off exponentially when it is not.

```bash cURL theme={null}
attempt=0
while [ "$attempt" -lt 5 ]; do
  headers=$(mktemp)
  code=$(curl -sS -D "$headers" -o /tmp/dashlink-body -w "%{http_code}" \
    -H "X-API-Key: $DASHLINK_API_KEY" \
    "https://api.dashlink.ai/api/v1/shortlinks/get_shortlinks?per_page=1")
  if [ "$code" != "429" ]; then
    cat /tmp/dashlink-body
    break
  fi
  wait=$(awk 'tolower($1)=="retry-after:" {print $2}' "$headers" | tr -d '\r')
  sleep "${wait:-$((2 ** attempt))}"
  attempt=$((attempt + 1))
done
```

```javascript Node.js theme={null}
async function call(url, options, maxAttempts = 5) {
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
    const response = await fetch(url, options);

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

    // Retry-After is authoritative; the exponential fallback only
    // covers a proxy stripping the header.
    const wait = Number(response.headers.get("Retry-After") ?? 2 ** attempt);
    await new Promise((resolve) => setTimeout(resolve, wait * 1000));
  }

  throw new Error(`Still rate limited after ${maxAttempts} attempts`);
}
```

```python Python theme={null}
import time
import requests

def call(url, headers, params=None, max_attempts=5):
    for attempt in range(max_attempts):
        response = requests.get(url, headers=headers, params=params)

        if response.status_code != 429:
            return response

        # Retry-After is authoritative; the exponential fallback only
        # covers a proxy stripping the header.
        wait = int(response.headers.get("Retry-After", 2 ** attempt))
        time.sleep(wait)

    raise RuntimeError(f"Still rate limited after {max_attempts} attempts")
```

```go Go theme={null}
func Call(req *http.Request, maxAttempts int) (*http.Response, error) {
	for attempt := 0; attempt < maxAttempts; attempt++ {
		resp, err := http.DefaultClient.Do(req)
		if err != nil {
			return nil, err
		}

		if resp.StatusCode != http.StatusTooManyRequests {
			return resp, nil
		}
		resp.Body.Close()

		// Retry-After is authoritative; the exponential fallback only
		// covers a proxy stripping the header.
		wait := 1 << attempt
		if after, err := strconv.Atoi(resp.Header.Get("Retry-After")); err == nil {
			wait = after
		}
		time.Sleep(time.Duration(wait) * time.Second)
	}

	return nil, fmt.Errorf("still rate limited after %d attempts", maxAttempts)
}
```

```ruby Ruby theme={null}
def call(uri, headers, max_attempts: 5)
  max_attempts.times do |attempt|
    response = Net::HTTP.get_response(uri, headers)

    return response unless response.code == "429"

    # Retry-After is authoritative; the exponential fallback only
    # covers a proxy stripping the header.
    wait = (response["Retry-After"] || 2**attempt).to_i
    sleep wait
  end

  raise "Still rate limited after #{max_attempts} attempts"
end
```

```php PHP theme={null}
<?php
function call(string $url, array $headers, int $maxAttempts = 5)
{
    for ($attempt = 0; $attempt < $maxAttempts; $attempt++) {
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HEADER, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

        $response = curl_exec($ch);
        $status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
        $headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
        curl_close($ch);

        if ($status !== 429) {
            return substr($response, $headerSize);
        }

        // Retry-After is authoritative; the exponential fallback only
        // covers a proxy stripping the header.
        preg_match('/retry-after:\s*(\d+)/i', $response, $m);
        sleep((int) ($m[1] ?? 2 ** $attempt));
    }

    throw new RuntimeException("Still rate limited after $maxAttempts attempts");
}
```

### Slow down before you are stopped

`X-RateLimit-Remaining` lets you ease off rather than hit the wall:

```python theme={null}
remaining = int(response.headers.get("X-RateLimit-Remaining", 1))
reset = int(response.headers.get("X-RateLimit-Reset", 60))

# Below 10% of the window, spread what is left over the time remaining
# instead of spending it immediately and stalling on a 429.
if remaining < limit * 0.1:
    time.sleep(reset / max(remaining, 1))
```

### Prefer bulk endpoints

Creating 500 links one at a time is 500 requests. `bulk_create_shortlinks` does it in one.

```bash cURL theme={null}
curl -X POST "https://api.dashlink.ai/api/v1/shortlinks/bulk_create_shortlinks" \
  -H "X-API-Key: dlk_live_..." \
  -d 'shortlinks=[{"destination_url":"https://example.com/a"},{"destination_url":"https://example.com/b"}]'
```

```javascript Node.js theme={null}
const body = new URLSearchParams();
body.append("shortlinks", "[{\"destination_url\":\"https://example.com/a\"},{\"destination_url\":\"https://example.com/b\"}]");

const response = await fetch("https://api.dashlink.ai/api/v1/shortlinks/bulk_create_shortlinks", {
  method: "POST",
  headers: { "X-API-Key": "dlk_live_..." },
  body,
});
const payload = await response.json();
```

```python Python theme={null}
import requests

response = requests.post(
    'https://api.dashlink.ai/api/v1/shortlinks/bulk_create_shortlinks',
    headers={'X-API-Key': 'dlk_live_...'},
    data={
        'shortlinks': '[{"destination_url":"https://example.com/a"},{"destination_url":"https://example.com/b"}]',
    },
)
payload = response.json()
```

```go Go theme={null}
package main

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
	"strings"
)

func main() {
	endpoint0 := "https://api.dashlink.ai/api/v1/shortlinks/bulk_create_shortlinks"
	form0 := url.Values{
		"shortlinks": {"[{\"destination_url\":\"https://example.com/a\"},{\"destination_url\":\"https://example.com/b\"}]"},
	}
	req0, err0 := http.NewRequest("POST", endpoint0, strings.NewReader(form0.Encode()))
	if err0 != nil {
		panic(err0)
	}
	req0.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	req0.Header.Set("X-API-Key", "dlk_live_...")
	resp0, err0b := http.DefaultClient.Do(req0)
	if err0b != nil {
		panic(err0b)
	}
	defer resp0.Body.Close()
	body0, _ := io.ReadAll(resp0.Body)
	fmt.Println(string(body0))
}

```

```ruby Ruby theme={null}
require "net/http"
require "json"
require "uri"

uri0 = URI("https://api.dashlink.ai/api/v1/shortlinks/bulk_create_shortlinks")
request0 = Net::HTTP::Post.new(uri0)
request0["X-API-Key"] = "dlk_live_..."
request0.set_form_data("shortlinks" => "[{\"destination_url\":\"https://example.com/a\"},{\"destination_url\":\"https://example.com/b\"}]")
response0 = Net::HTTP.start(uri0.hostname, uri0.port, use_ssl: true) do |http|
  http.request(request0)
end
payload0 = JSON.parse(response0.body)
```

```php PHP theme={null}
<?php
$ch0 = curl_init('https://api.dashlink.ai/api/v1/shortlinks/bulk_create_shortlinks');
curl_setopt($ch0, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch0, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch0, CURLOPT_HTTPHEADER, [
    "X-API-Key: " . 'dlk_live_...',
]);
curl_setopt($ch0, CURLOPT_POSTFIELDS, http_build_query(['shortlinks' => '[{"destination_url":"https://example.com/a"},{"destination_url":"https://example.com/b"}]']));
$payload0 = json_decode(curl_exec($ch0), true);
curl_close($ch0);
```

The same applies to reads: `get_org_metrics_batch` returns several analytics metrics in one call instead of one request per metric.

### Ask for larger pages

`per_page=100` walks a 1,000-record list in 10 requests rather than 100.

## Failing open

If the rate limiter itself is unavailable, requests are served rather than refused. When that happens you will see `X-RateLimit-Remaining: ?` — the limit is published, but that request was not counted against it. Treat it as informational.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.