Analytics Endpoints
The analytics endpoints let you export raw click and scan event data from Codelloy. Use them to build custom dashboards, feed data warehouses, or integrate with your existing analytics stack.
Authentication
All analytics endpoints use X-API-KEY header authentication:
curl -H "X-API-KEY: your_api_key_here" \
"https://api.codelloy.com/link/external/v1/analytics/events"See Authentication and Obtaining Your API Key for details.
List Analytics Events
GET /link/external/v1/analytics/eventsReturns raw click and scan events with cursor-based pagination. Supports two modes: Browse and Sync.
Mode Detection
The API automatically selects a mode based on the parameters you provide:
| Parameters provided | Mode | Use case |
|---|---|---|
from and to | Browse | Query events within a date range |
since | Sync | Incremental sync — fetch events newer than a timestamp |
Note: Browse mode requires both
fromandtoparameters. Omitting them will return an error.
You cannot combine Browse and Sync parameters in the same request. Providing both
from/toandsincewill return an error.
Browse Mode
Query events within a date range. Useful for ad-hoc analysis and backfills.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
from | ISO 8601 date | Yes | Start of date range (inclusive) |
to | ISO 8601 date | Yes | End of date range (inclusive) |
cursor | string | No | Pagination cursor from previous response |
limit | integer | No | Number of events per page (default: 100, max: 5000) |
Example:
curl -H "X-API-KEY: your_api_key_here" \
"https://api.codelloy.com/link/external/v1/analytics/events?from=2026-01-01&to=2026-01-31&limit=500"Response:
{
"data": [
{
"eventId": "evt_abc123",
"shortCode": "my-link",
"schemaVersion": 1,
"createdAt": "2026-01-15T10:30:00Z",
"shortUrlId": "url_abc123",
"eventType": "CLICK",
"clickSource": "DIRECT",
"referrer": "https://facebook.com",
"referrerDomain": "facebook.com",
"country": "United States",
"countryCode": "US",
"city": "San Francisco",
"region": "California",
"browserName": "Chrome",
"browserVersion": "122.0",
"osName": "iOS",
"osVersion": "17.4",
"deviceType": "MOBILE",
"deviceBrand": "Apple",
"deviceModel": "iPhone",
"utmSource": "facebook",
"utmMedium": "social",
"utmCampaign": "launch"
}
],
"hasMore": true,
"nextCursor": "cursor_xyz789"
}To fetch the next page, pass nextCursor as the cursor parameter:
curl -H "X-API-KEY: your_api_key_here" \
"https://api.codelloy.com/link/external/v1/analytics/events?from=2026-01-01&to=2026-01-31&cursor=cursor_xyz789"Sync Mode
Incrementally fetch new events since a given point in time. Designed for data warehouse ingestion pipelines that run on a schedule.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
since | ISO 8601 timestamp | Yes | Fetch events after this timestamp |
afterEventId | string | No | Deduplicate — skip events up to and including this ID (for events sharing the same timestamp) |
limit | integer | No | Number of events per page (default: 100, max: 5000) |
Example:
curl -H "X-API-KEY: your_api_key_here" \
"https://api.codelloy.com/link/external/v1/analytics/events?since=2026-03-01T00:00:00Z"Response:
{
"data": [ ... ],
"hasMore": false,
"nextSince": "2026-03-15T14:22:00Z",
"afterEventId": "evt_def456"
}On your next sync run, use the returned nextSince and afterEventId values:
curl -H "X-API-KEY: your_api_key_here" \
"https://api.codelloy.com/link/external/v1/analytics/events?since=2026-03-15T14:22:00Z&afterEventId=evt_def456"Event Fields
Each event object contains the following fields:
| Field | Type | Description |
|---|---|---|
eventId | string | Unique event identifier |
schemaVersion | integer | Schema version number |
createdAt | ISO 8601 timestamp | When the click or scan occurred |
shortCode | string | The short code of the link |
shortUrlId | string | Unique identifier of the short URL |
eventType | string | Type of event (e.g., CLICK) |
clickSource | string | DIRECT, QR_CODE, or API |
referrer | string or null | Full referrer URL |
referrerDomain | string or null | Domain extracted from the referrer URL |
country | string or null | Country name (e.g., United States, United Kingdom) |
countryCode | string or null | Two-letter country code (e.g., US, GB) |
city | string or null | City name |
region | string or null | Region or state name |
browserName | string or null | Browser name (e.g., Chrome, Safari) |
browserVersion | string or null | Browser version (e.g., 122.0) |
osName | string or null | Operating system (e.g., iOS, Android, Windows) |
osVersion | string or null | OS version (e.g., 17.4) |
deviceType | string or null | MOBILE, DESKTOP, or TABLET |
deviceBrand | string or null | Device manufacturer (e.g., Apple, Samsung) |
deviceModel | string or null | Device model (e.g., iPhone, Pixel 8) |
utmSource | string or null | UTM source parameter |
utmMedium | string or null | UTM medium parameter |
utmCampaign | string or null | UTM campaign parameter |
Export Events
GET /link/external/v1/analytics/events/exportDownload all events as a file. The export endpoint only supports Browse mode — you must provide from and to parameters. The since parameter (Sync mode) is not allowed on the export endpoint.
Additional parameter:
| Parameter | Type | Required | Description |
|---|---|---|---|
format | string | No | json (newline-delimited JSON, default) or csv |
Example — CSV export:
curl -H "X-API-KEY: your_api_key_here" \
"https://api.codelloy.com/link/external/v1/analytics/events/export?from=2026-01-01&to=2026-03-31&format=csv" \
-o analytics.csvExample — JSON export:
curl -H "X-API-KEY: your_api_key_here" \
"https://api.codelloy.com/link/external/v1/analytics/events/export?from=2026-01-01&to=2026-03-31&format=json" \
-o analytics.ndjsonThe JSON export uses newline-delimited JSON (one JSON object per line), making it easy to stream into BigQuery, Snowflake, or similar tools.
Rate Limits
Analytics endpoints have separate rate limits from the link management API:
| Endpoint | Limit | Window |
|---|---|---|
List events (/analytics/events) | 30 requests | 1 minute |
Export (/analytics/events/export) | 5 requests | 1 minute |
When you exceed the limit, you will receive a 429 Too Many Requests response. See Rate Limiting for best practices.
Best Practices
-
Use Sync mode for pipelines — If you are ingesting data into a warehouse on a schedule, Sync mode ensures you never miss events and never process duplicates.
-
Use Browse mode for ad-hoc queries — When you need data for a specific date range, Browse mode is more straightforward.
-
Store
nextSinceandafterEventId— After each sync run, persist these values so your next run picks up exactly where you left off. -
Use CSV for spreadsheets, JSON for pipelines — CSV is convenient for quick analysis in Excel or Google Sheets. Newline-delimited JSON is better for programmatic ingestion.
-
Respect rate limits — Space out export requests and use pagination for large date ranges rather than exporting everything at once.