Endpoint reference
GET
/links/:id/statsLink metrics
Retrieve click analytics for a shortened link — totals, time series, geography, referrers, and UTM breakdowns.
Open playground to send a live request →
Description
Pass the link id from the shorten endpoint. The response includes metrics available on your current plan; advanced breakdowns require higher tiers.
Alternative lookup by slug: GET https://statin.io/api/v1/links/stats?slug=my-link
Request
GET https://statin.io/api/v1/links/64f1a2b3c4d5e6f7a8b9c0d1/stats?days=30
Authorization: Bearer la_...Query parameters
| Param | Type | Description |
|---|---|---|
| days | number | Lookback window (default 30). Capped by plan retention. |
| from | ISO date | Custom range start (optional). |
| to | ISO date | Custom range end (optional). |
| granularity | string | hour, day, or week (default day). |
Response
{
"link": {
"id": "64f1a2b3c4d5e6f7a8b9c0d1",
"url": "https://example.com/landing-page",
"slug": "summer-sale",
"shortUrl": "https://statin.io/summer-sale",
"clicks": 142,
"createdAt": "2026-06-26T12:00:00.000Z",
"updatedAt": "2026-06-26T12:00:00.000Z"
},
"period": {
"from": "2026-05-28T00:00:00.000Z",
"to": "2026-06-26T23:59:59.999Z"
},
"granularity": "day",
"plan": { "id": "starter", "analyticsRetentionDays": 90 },
"stats": {
"totalClicks": 142,
"humanClicks": 128,
"botClicks": 14,
"clicksOverTime": [{ "date": "2026-06-26", "clicks": 12 }],
"topCountries": [{ "name": "US", "clicks": 80 }],
"topReferrers": [{ "name": "twitter.com", "clicks": 40 }],
"topSources": [{ "name": "newsletter", "clicks": 25 }],
"previousPeriod": {
"from": "2026-04-28T00:00:00.000Z",
"to": "2026-05-27T23:59:59.999Z",
"totalClicks": 98,
"humanClicks": 90
}
}
}Fields inside stats depend on your plan. Starter+ unlocks more breakdowns; Free is not eligible for API access.
cURL
curl "https://statin.io/api/v1/links/64f1a2b3c4d5e6f7a8b9c0d1/stats?days=30" \
-H "Authorization: Bearer la_YOUR_KEY"JavaScript
const linkId = "64f1a2b3c4d5e6f7a8b9c0d1";
const res = await fetch(`https://statin.io/api/v1/links/${linkId}/stats?days=30`, {
headers: { Authorization: "Bearer la_YOUR_KEY" },
});
if (!res.ok) throw new Error(await res.text());
const data = await res.json();
console.log(data.stats.totalClicks);
console.log(data.stats.topCountries);
console.log(data.stats.clicksOverTime);Python
import requests
link_id = "64f1a2b3c4d5e6f7a8b9c0d1"
response = requests.get(
f"https://statin.io/api/v1/links/{link_id}/stats",
params={"days": 30},
headers={"Authorization": "Bearer la_YOUR_KEY"},
timeout=30,
)
response.raise_for_status()
data = response.json()
print(data["stats"]["totalClicks"])
print(data["stats"].get("topCountries", []))