Migrate to the analytics query endpoint
Move from the deprecated clicks and segments endpoints to GET /analytics/query
The /clicks and /segments endpoints for accounts, workspaces, domains, tags, teammates, and links are deprecated, including the link-level calls that are not listed in the API reference. They still work today. Their data will stop updating on a date we will announce on this page, so plan your move now. Use Query click analytics (GET /v1/analytics/query, beta) instead. This page shows how each legacy call maps to the new endpoint and what is not available yet.
What changes
Legacy /clicks and /segments | GET /analytics/query | |
|---|---|---|
| Scope | Account, workspace, domain, tag, teammate, or link in the path | One workspace per request, set with the Workspace header. Narrow it with filters, for example filters[link_id] |
| Time range | Fixed by group: last 48 hours, last 30 days, or about 24 months | period: last_24_hours to last_12_months, or start_date and end_date for up to 2 years, within your plan's analytics history |
| Breakdowns | Share of all-time clicks per value (weight, adds up to 1) | Click counts per value for the chosen period |
| Metrics | clicks, and QR scans on some calls | clicks, human_clicks, human_qr, bot_clicks |
| Access | Advanced analytics on the plan (none for link-level calls) | The workspace owner's plan sets how much history you see, from 30 days up to 2 years |
Time series
Legacy calls without group return hourly points.
| Legacy call | New request |
|---|---|
GET /links/{link_id}/clicks?group=days (not listed in the API reference) | GET /analytics/query?period=last_30_days&metrics=clicks&granularity=day&filters[link_id]={link_id} |
GET /workspaces/{workspace_id}/clicks?group=hours | Workspace: {workspace_id} and ?period=last_24_hours&metrics=clicks&granularity=hour. Returns 25 hourly points, the last one partial, instead of 48: for 48 hourly points, use period=last_7_days and keep the last 48 |
GET /workspaces/{workspace_id}/clicks?group=days | Workspace: {workspace_id} and ?period=last_30_days&metrics=clicks&granularity=day |
GET /workspaces/{workspace_id}/clicks?group=months | Workspace: {workspace_id} and ?period=last_12_months&metrics=clicks&granularity=month. For up to 730 days (about 24 months), use start_date and end_date instead of period |
GET /account/clicks | One request for each workspace you own, as above. Add the results together |
The legacy response is a list of { "key", "clicks" } points. The new response returns the points in rows[0].series, with an ISO 8601 period for each. Shortened example, without range, coverage, caveats, and freshnessBoundary:
{
"granularity": "day",
"total": { "clicks": 218 },
"rows": [
{
"key": null,
"label": null,
"metrics": { "clicks": 218 },
"series": [
{ "period": "2026-11-30T00:00:00Z", "metrics": { "clicks": 120 } },
{ "period": "2026-12-01T00:00:00Z", "metrics": { "clicks": 98 } }
]
}
]
}Breakdowns
Legacy breakdowns return the all-time share of clicks per value. The new endpoint returns counts for the period you request. To get a share, divide each row's metric by total.
Legacy group | New dimension |
|---|---|
countries | country_code |
regions | region_name |
cities | city_name |
languages | user_language_tag |
browsers | browser |
platforms | device_platform |
devices | device_type (desktop or other) |
sources | source_channel, or referrer_host for the referring site |
socials | referrer_host with filters[source_channel]=social |
Region and city rows carry the name only, and the same name can exist in several countries. Add filters[country_code] to tell them apart.
Social rows are referring hosts, not network names, so one network can span several hosts. Social clicks without a referrer are counted in unknown.
For a breakdown of one link, add filters[link_id]={link_id}. A breakdown of one link works up to last_30_days; longer periods can time out with 503. A link_id that does not exist or belongs to another workspace returns zero counts. For example, the top 10 countries of one link over the last 30 days:
GET /v1/analytics/query?period=last_30_days&metrics=clicks&dimension=country_code&filters[link_id]={link_id}&limit=10
apikey: YOUR_API_KEY
Workspace: YOUR_WORKSPACE_IDNot available yet
- Tag, domain, and teammate scope. There is no filter by tag, branded domain, or teammate. Filter by the IDs of the links in the tag or domain with
filters[link_id]. Totals and time series are exact when you split many links across requests and add the counts. Top lists merged across requests are approximate, because a value outside each request's top rows can still belong in the overall top. - Weekday and hour-of-day breakdowns (
weekdays,dayhours). Group an hourly series (granularity=hour, up tolast_30_days, in UTC) by weekday or hour yourself. - All-time totals. Periods are limited by your plan's analytics history.
- History beyond 2 years. The longest range is 730 days, set with
start_dateandend_date.
Before you switch
- Send the
Workspaceheader on every request. Without it, the endpoint returns403, or404if your account has no default workspace. - Check how much history the workspace owner's plan includes, from 30 days up to 2 years. Link-level calls had no plan limit before, so a smaller plan now sees less history for a link. A plan without analytics history gets
403. - Some workspaces have no per-link data. There, a
link_idbreakdown or filter returns theper_link_excludedcaveat: treat those counts as unavailable, not as zero. - On
429, back off and retry after the time in theRetry-Afterheader. - Counts can differ from the legacy endpoints. Compare both for a few days before you switch.
- The endpoint is in beta. Fields and limits can change before it is generally available.
Updated 1 day ago
