API reference

Links

Get a short link's clicks with the same query API you use for websites, passing link_id instead of website_id.

curl -X POST "https://api.databuddy.cc/v1/query?link_id=$DATABUDDY_LINK_ID" \
  -H "x-api-key: $DATABUDDY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "parameters": ["link_total_clicks", "link_clicks_by_day", "link_top_referrers"],
    "preset": "last_30d",
    "limit": 10
  }'
{
  "success": true,
  "data": [
    { "parameter": "link_total_clicks", "success": true, "data": [{ "total": 1542 }] },
    { "parameter": "link_clicks_by_day", "success": true, "data": [{ "date": "2026-11-01", "clicks": 125 }] },
    { "parameter": "link_top_referrers", "success": true, "data": [{ "name": "x.com", "referrer": "x.com", "clicks": 523 }] }
  ]
}

The key needs read:data with access to every website in the organization, because links belong to the organization.

Pick query types

TypeReturnsGranularity
link_total_clicksTotal clicksNone
link_clicks_by_dayClicks over timedaily, hourly
link_referrers_by_dayUnique referrers over timedaily, hourly
link_countries_by_dayUnique countries over timedaily, hourly
link_top_referrersTop referrersNone
link_top_countriesTop countriesNone
link_top_regionsTop regionsNone
link_top_citiesTop citiesNone
link_top_devicesMobile, desktop and tabletNone
link_top_browsersTop browsersNone

With "granularity": "hourly", the time series return one row per hour, for ranges up to 30 days. Dates, filters and batches work as in analytics queries.

Set externalId when you add or change a link, such as a partner or company ID. Then list only that partner's links:

curl https://api.databuddy.cc/links/list \
  -H "x-api-key: $DATABUDDY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "externalId": "company_42" }'

Adding and changing links needs write:links; listing needs read:links. The interactive API reference has every link endpoint.

Clicks from your website to other websites are website analytics, not short-link clicks:

Short linksOutbound links
CountsClicks on your dby.sh linksClicks from your website to other websites
URL parameterlink_idwebsite_id
Query typeslink_*outbound_links, outbound_domains

How is this guide?