Analytics

BASE  https://api.rii.link/v1AUTH: BEARER → AUTHENTICATION

Pull aggregates on demand, or hold an SSE stream open and get each click on your API-created links as it happens.

GET/v1/links/{id}/stats

Link stats

One aggregate call, bucketed how you ask, over any from/to window. Bot traffic is excluded.

PARAMETERS
from / totimestamp

Bounds of the window. Default: last 30 days.

group_bystring

country, device, referrer, or rule.

intervalstring

hour or day — buckets the series for charting.

REQUEST
curl "https://api.rii.link/v1/links/lnk_8h2f0qZ3Tk1mR4vXw9aBcQ/stats?group_by=country" \
-H "Authorization: Bearer $RII_KEY"
RESPONSE · 200
{
"total": 1284,
"group_by": "country",
"buckets": [
{ "key": "DE", "clicks": 512 },
{ "key": "US", "clicks": 401 },
{ "key": "FR", "clicks": 371 }
],
"interval": null,
"series": [],
"from": "2026-07-13T00:00:00Z",
"to": "2026-08-12T00:00:00Z"
}
GET/v1/events/stream

The click stream (SSE)

Server-sent events over plain HTTP — the live surface that exists today, no webhook registration required. Hold it open with -N; every non-bot click on your live API-created links arrives as one frame.

A HELD-OPEN CONNECTION, UNSIGNED · TEST KEYS RECEIVE NO CLICKS · OUTBOUND WEBHOOKS ARE ROADMAP (Q1 2027)

REQUEST
curl -N https://api.rii.link/v1/events/stream \
-H "Authorization: Bearer $RII_KEY" \
-H "Accept: text/event-stream"
STREAM · TEXT/EVENT-STREAM
event: click
data: {"link_id":"lnk_8h2f0qZ3Tk1mR4vXw9aBcQ","country":"DE","device":"mobile","referrer":"instagram.com","utm_source":"instagram","utm_medium":null,"utm_campaign":"summer","is_qr":false,"rule_matched":"geo.country == \"DE\"","timestamp":"2026-08-12T09:17:02.418+00:00"}
event: click
data: {"link_id":"lnk_2xw11pGh6Rt0Yc3Mv9LsJg","country":"US","device":"desktop","referrer":null,"utm_source":null,"utm_medium":null,"utm_campaign":null,"is_qr":true,"rule_matched":null,"timestamp":"2026-08-12T09:17:05.031+00:00"}