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

# Retention

> How far back your plan can look, and how to tell when you hit the limit.

Each plan has an analytics retention window measured in months. Ask for more history than yours allows and the request is **not rejected** — `date_from` is moved forward to the earliest date your plan permits, and the response says so.

## Spotting a clamp

The response carries a `retention` object whenever it happened:

```json theme={null}
{
  "data": {
    "kpis": { },
    "retention": {
      "clamped": true,
      "earliest_date": "2026-01-01",
      "retention_months": 12
    }
  }
}
```

No clamp, no `retention` key. Which is the trap: without checking for it, a twenty-four month query silently returns twelve months and the chart looks like your traffic began a year ago.

```python theme={null}
data = response.json()["data"]
notice = data.get("retention")

if notice and notice.get("clamped"):
    logger.info(
        "Range clamped to %s (%s-month retention)",
        notice["earliest_date"],
        notice["retention_months"],
    )
```

> [!TIP]
>
> Read `earliest_date` and use it as your effective start when labelling charts or writing exports. Presenting a clamped result under the range the user asked for is how a support ticket about "missing data" starts.

## Knowing the window in advance

Rather than discovering the floor by tripping over it, read it from your plan:

```bash cURL theme={null}
curl -X GET "https://api.dashlink.ai/api/v1/plans/get_organization_plan_summary" \
  -H "X-API-Key: $DASHLINK_API_KEY"
```

```javascript Node.js theme={null}
const response = await fetch("https://api.dashlink.ai/api/v1/plans/get_organization_plan_summary", {
  headers: { "X-API-Key": process.env.DASHLINK_API_KEY },
});
const payload = await response.json();
```

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

response = requests.get(
    'https://api.dashlink.ai/api/v1/plans/get_organization_plan_summary',
    headers={'X-API-Key': os.environ["DASHLINK_API_KEY"]},
)
payload = response.json()
```

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

import (
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	endpoint0 := "https://api.dashlink.ai/api/v1/plans/get_organization_plan_summary"
	req0, err0 := http.NewRequest("GET", endpoint0, nil)
	if err0 != nil {
		panic(err0)
	}
	req0.Header.Set("X-API-Key", os.Getenv("DASHLINK_API_KEY"))
	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/plans/get_organization_plan_summary")
request0 = Net::HTTP::Get.new(uri0)
request0["X-API-Key"] = ENV.fetch("DASHLINK_API_KEY")
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/plans/get_organization_plan_summary');
curl_setopt($ch0, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch0, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch0, CURLOPT_HTTPHEADER, [
    "X-API-Key: " . getenv("DASHLINK_API_KEY"),
]);
$payload0 = json_decode(curl_exec($ch0), true);
curl_close($ch0);
```

The `analytics_retention` section carries the window in months and the earliest queryable date. Use it to bound a date picker, so the limit is visible before a query rather than after.

## What retention does and does not affect

Retention limits **how far back analytics queries may read**. It does not delete your links, QR codes, campaigns or their configuration, and it does not stop new clicks being recorded. The underlying event data is kept; what changes is how much of it your plan lets you query.

Raise the plan and the window widens — including over history recorded while you were on the lower one.

## Building against it

> [accordion] Bound date pickers to the floor
>
> Disable dates before `earliest_date`. Cheaper than explaining a clamp after the fact.

> [accordion] Export before a downgrade
>
> Moving to a shorter window makes older history unqueryable. Pull what you need via the [report endpoints](https://docs.dashlink.ai/guides/analytics/reports.md) first.

> [accordion] Do not assume a fixed window
>
> Plans change. Read `analytics_retention` rather than hardcoding twelve months.

> [accordion] Clamping fails open
>
> If the plan lookup cannot be resolved, no clamp is applied — better than serving an empty chart to a paying customer because of a lookup failure. Do not treat the absence of a `retention` key as proof that no limit exists.


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