Skip to content

Tip: Start by listing your pages with GET /api/public/pages, grab the slug you need, then fetch stats with GET /api/public/stats/{slug}.

The public API is subject to rate limiting. If you exceed the limit, you receive a 429 Too Many Requests response.

Best practices:

  • Cache results on your end — stats don’t update in real time
  • Avoid polling more frequently than once every few minutes
  • Use the startDate/endDate range to request only the data you need

Lists all pages accessible to your API key — both personal pages and pages from organizations where your account has API access.

URL

GET https://onlynk.me/api/public/pages

Headers

Authorization: Bearer YOUR_API_KEY

Response

{
"personal": [
{
"id": "page_123",
"slug": "my_page",
"title": "My Page",
"published": true
}
],
"organizations": [
{
"organization": { "id": "org_123", "name": "My Team" },
"pages": [
{
"id": "page_456",
"slug": "team_page",
"title": "Team Page",
"published": true
}
]
}
]
}

Response fields

FieldTypeDescription
personalarrayPages owned by your personal account
organizationsarrayGroups of pages by organization
organizations[].organization.idstringOrganization ID
organizations[].organization.namestringOrganization display name
pages[].idstringInternal page ID
pages[].slugstringPublic URL handle — use this for the stats endpoint
pages[].titlestringPage display title
pages[].publishedbooleanWhether the page is publicly accessible

Example

Terminal window
curl -sS \
-H "Authorization: Bearer YOUR_API_KEY" \
"https://onlynk.me/api/public/pages"

Fetches analytics for a specific page identified by its slug.

URL

GET https://onlynk.me/api/public/stats/{slug}

Headers

Authorization: Bearer YOUR_API_KEY

Query parameters

ParameterTypeRequiredDescription
startDateYYYY-MM-DDStart of the date range (inclusive). Defaults to 30 days ago.
endDateYYYY-MM-DDEnd of the date range (inclusive). Defaults to today.

Dates are interpreted as UTC. If your use case requires local timezone alignment, shift the dates accordingly before passing them.

Response

{
"slug": "my_page",
"totalViews": 1234,
"totalClicks": 256,
"totalDirect": 89,
"totalChatbotClicks": 42,
"totalSafed": 15,
"totalBlocked": 7,
"topCountries": [
{ "country": "FR", "views": 420 },
{ "country": "US", "views": 210 }
],
"topLinks": [
{ "url": "https://instagram.com/myprofile", "clicks": 130 },
{ "url": "https://youtube.com/mychannel", "clicks": 90 }
],
"topReferrers": [
{ "referrer": "instagram.com", "views": 300 },
{ "referrer": "direct", "views": 180 }
],
"topDeviceTypes": [
{ "deviceType": "mobile", "views": 900 },
{ "deviceType": "desktop", "views": 334 }
],
"dailyStats": [
{ "date": "2026-03-01", "views": 45, "clicks": 8 },
{ "date": "2026-03-02", "views": 62, "clicks": 11 }
]
}

Response fields

FieldTypeDescription
totalViewsnumberTotal PAGE_VIEW events in the range
totalClicksnumberLINK_CLICK + CARD_CLICK events
totalDirectnumberREDIRECT events (direct link redirects)
totalChatbotClicksnumberCHATBOT_CLICK events
totalSafednumberSAFE events — bots that were served the landing page instead of being redirected
totalBlockednumberBLOCK events — visitors blocked by geo rules
topCountriesarrayTop 5 countries by views, { country: "ISO-2", views: N }
topLinksarrayTop 5 clicked link URLs, { url: string, clicks: N }
topReferrersarrayTop 5 traffic sources, { referrer: string, views: N }. "direct" means no referrer header.
topDeviceTypesarrayTop 5 device categories, { deviceType: string, views: N }
dailyStatsarrayPer-day breakdown { date: "YYYY-MM-DD", views: N, clicks: N }, sorted ascending

Example (last 30 days, default)

Terminal window
curl -sS \
-H "Authorization: Bearer YOUR_API_KEY" \
"https://onlynk.me/api/public/stats/your-slug"

Example (custom date range)

Terminal window
curl -sS \
-H "Authorization: Bearer YOUR_API_KEY" \
"https://onlynk.me/api/public/stats/your-slug?startDate=2026-03-01&endDate=2026-03-31"

Access rules

Your API key can query stats for:

  • Pages owned by your personal account
  • Pages owned by an org where your account is OWNER or ADMIN

If neither condition is true, the endpoint returns 403 Forbidden.


StatusBodyCause
401{ "error": "API key is required" }No Authorization header
403{ "error": "Invalid API key" }Key doesn’t match any account
403{ "error": "Forbidden" }Key is valid but you don’t have access to this page
404{ "error": "Page not found" }No page with that slug exists
429{ "error": "Rate limit exceeded" }Too many requests; back off and retry

  • API Authentication — How to generate and use your API key
  • Page analytics — Understanding the same metrics in the dashboard
  • Glossary — Event type definitions (PAGE_VIEW, LINK_CLICK, REDIRECT, etc.)