API reference

API overview

Databuddy’s REST API lets you query website analytics as JSON, send custom events, read session replays, and manage short links and feature flags.

Analytics base URL: https://api.databuddy.cc/v1

Authentication: Send a server-side API key with read:data access to your website in the x-api-key header. Authentication and scopes

Get pageviews and unique visitors

To get totals for November 1–7, replace YOUR_WEBSITE_ID and YOUR_API_KEY and run this request from your server or terminal.

curl -X POST 'https://api.databuddy.cc/v1/query?website_id=YOUR_WEBSITE_ID' \
  -H 'x-api-key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"parameters":["summary_metrics"],"startDate":"2026-11-01","endDate":"2026-11-07"}'

In this example response, 80 unique visitors generated 240 pageviews across the seven days.

{
  "success": true,
  "requestId": "req_0000000000000001",
  "queryId": "",
  "data": [{
    "parameter": "summary_metrics",
    "success": true,
    "data": [{
      "pageviews": 240, "unique_visitors": 80, "sessions": 100,
      "bounce_rate": 25, "median_session_duration": 48, "total_events": 560
    }]
  }],
  "meta": {
    "parameters": ["summary_metrics"], "total_parameters": 1,
    "page": 1, "limit": 100, "filters_applied": 0
  }
}

What you can do

TaskReference
Query and export analyticsQuery visitors, pages, and traffic sources, build a report from the JSON results, run your own SQL, or query from an AI assistant with MCP.
Send eventsRecord custom events from your application.
Read session replaysFind recordings and load playback data.
Manage links and flagsManage short links and feature flags in the interactive API reference and query clicks on your links.
Handle failed requestsCheck key permissions, interpret errors, and retry after rate limits.

Base URLs

ServiceURLPurpose
Analytics APIhttps://api.databuddy.cc/v1Query analytics data
Session replay APIhttps://api.databuddy.cc/replaysFind recordings and load playback data
Event Trackinghttps://basket.databuddy.ccSend custom events
OpenAPI spechttps://www.databuddy.cc/openapi.jsonMachine-readable Databuddy REST API schema
API referencehttps://api.databuddy.cc/Interactive Databuddy API reference
MCP serverhttps://api.databuddy.cc/v1/mcpStreamable HTTP MCP endpoint for AI agents
MCP manifesthttps://www.databuddy.cc/.well-known/mcp.jsonMachine-readable MCP discovery manifest

Most endpoints require authentication. Public routes include the health check, query-type discovery, public feature-flag evaluation, and service discovery.

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_metrics", "top_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.

Continue with the complete reporting recipe to select the right website, use a consistent timezone, and reject failed query parameters before producing an automated report.

Available query types

Website analytics

Query types for website_id:

TypeDescription
summary_metricsOverall website metrics and KPIs
top_pagesPageviews and visitors by path
traffic_sourcesTraffic source breakdown
top_referrersTop referrers
browser_nameBrowser usage breakdown
os_nameOperating system breakdown
device_typesDevice category (mobile/desktop/tablet)
countryVisitors by country
cityVisitors by city
recent_errorsLatest JavaScript errors
error_summaryError counts and impact
vitals_overviewCore Web Vitals overview
page_performancePageviews and visitors by page; for load timing use vitals_by_page
session_metricsSession metrics over time
session_listIndividual sessions
custom_eventsCustom event data
profile_listUser profile analytics
outbound_linksExternal link clicks
outbound_domainsExternal clicks by domain
scroll_depth_summaryScroll depth engagement
interaction_summaryInteraction engagement
frustration_by_pageRage clicks, dead clicks, and errors per page
form_abandonment_by_pageForm starts, submits, and the field visitors stop on
engagement_quality_by_pageActive time, attention ratio, and interaction per page

This is a subset. Use GET /v1/query/types for the full list.

Query types for link_id:

TypeDescription
link_total_clicksTotal click count
link_clicks_by_dayDaily click breakdown
link_referrers_by_dayDaily clicks by referrer
link_countries_by_dayDaily clicks by country
link_top_referrersTop traffic sources
link_top_countriesTop countries
link_top_regionsTop regions
link_top_citiesTop cities
link_top_devicesDevice breakdown
link_top_browsersBrowser breakdown

Health check

Check API availability:

http
GET /health
json
{
"status": "ok"
}

How is this guide?