Use this API to retrieve recent click activity at the workspace level. It aggregates clicks across all short links in the workspace.
If you are in London (Europe/London) and want hourly clicks for today, call:
import { U301 } from 'u301';
const apiKey = '<YOUR_API_KEY>';
const workspaceId = '<YOUR_WORKSPACE_ID>';
const u301 = new U301({
apiKey,
workspaceId,
});
const clicks = await u301.analytics.getClicks({
range: '1d',
granularity: 'hour',
timezone: 'Europe/London'
})Request
| Name | Location | Type | Required | Default | Description |
|---|---|---|---|---|---|
Authorization | Header | string | Bearer token used for authentication. | ||
workspaceId | Query | string | Workspace identifier for multi‑tenant routing. | ||
range | Query | string | Time range for click data aggregation. | ||
granularity | Query | string | Time granularity for click data aggregation. | ||
timezone | Query | string | UTC | Timezone for click data aggregation. |
Response
| Name | Type | Description |
|---|---|---|
start | string | Start time of the click data aggregation in YYYY-MM-DDTHH:mm:ss.sssZ format. |
end | string | End time of the click data aggregation in YYYY-MM-DDTHH:mm:ss.sssZ format. |
data | array | Array of click data objects. |
data[].date | string | Date of the click in YYYY-MM-DD format for day granularity, or YYYY-MM-DD HH:mm:ss format for hour granularity. |
data[].click | number | Number of clicks for the specified date and hour. |
{
"start": "2025-11-15T00:00:00.000Z",
"end": "2025-11-15T23:59:59.999Z",
"data": [
{
"date": "2025-11-15 00:00:00",
"click": 10
},
{
"date": "2025-11-15 01:00:00",
"click": 15
},
// ... more hourly data,
{
"date": "2025-11-15 23:00:00",
"click": 0
}
]
}Last updated on