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
Base URLs
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:
curl -H "x-api-key: dbdy_your_api_key" \
https://api.databuddy.cc/v1/query/websites3. Query analytics data:
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:
This is a subset. Use GET /v1/query/types for the full list.
Link shortener analytics
Query types for link_id:
Health check
Check API availability:
GET /health{
"status": "ok"
}How is this guide?