API Reference

API Overview

Access your analytics data programmatically with Databuddy's REST API. All endpoints require authentication and are rate-limited for security.

Base URLs

ServiceURLPurpose
Analytics APIhttps://api.databuddy.cc/v1Query analytics data
Event Trackinghttps://basket.databuddy.ccSend custom events

Quick Start

1. Get your API key from Dashboard → Organization Settings → API Keys

2. List your websites:

bash
curl -H "x-api-key: dbdy_your_api_key" \
https://api.databuddy.cc/v1/query/websites

3. Query analytics data:

bash
curl -X POST -H "x-api-key: dbdy_your_api_key" \
-H "Content-Type: application/json" \
-d '{
  "parameters": ["summary", "pages"],
  "preset": "last_30d"
}' \
"https://api.databuddy.cc/v1/query?website_id=web_123"

Use date presets like last_7d, last_30d, this_month instead of explicit dates for convenience.

API Sections

Available Query Types

Website Analytics

Query types for website_id:

TypeDescription
summaryOverall website metrics and KPIs
pagesPage views and performance by URL
trafficTraffic sources and referrers
browser_nameBrowser usage breakdown
os_nameOperating system breakdown
device_typesDevice category (mobile/desktop/tablet)
countriesVisitors by country
citiesVisitors by city
errorsJavaScript errors
performanceWeb vitals and load times
sessionsSession-based analytics
custom_eventsCustom event data
profilesUser profile analytics
outbound_linksExternal link clicks
outbound_domainsExternal clicks by domain
engagementUser engagement metrics

Query types for link_id:

TypeDescription
link_total_clicksTotal click count
link_clicks_by_dayDaily click breakdown
link_top_referrersTop traffic sources
link_top_countriesTop countries
link_top_devicesDevice breakdown
link_top_browsersBrowser breakdown

Health Check

Check API and dependency status:

http
GET /health
json
{
"clickhouse": true,
"database": true,
"redis": true,
"success": true,
"version": "1.0.0",
"timestamp": "2024-01-01T12:00:00.000Z"
}

How is this guide?