Back to Home

Statlytic API Reference

Access your analytics data programmatically with our comprehensive REST API. Build custom integrations, automate workflows, and get real-time insights.

🚀 Quick Start

Get started with the Statlytic API in minutes

1. Get API Key
Generate your API key from the dashboard

Go to your dashboard settings and generate a new API key for programmatic access.

2. Make Request
Use your API key to make authenticated requests
curl -H "Authorization: Bearer YOUR_API_KEY" \
  https://statlytic.app/api/sites/{siteId}/analytics

Include your API key in the Authorization header.

3. Get Data
Receive JSON responses with your analytics data
{ "totalViews": 1234, "uniqueVisitors": 567, "bounceRate": 34.2 }

All responses are in JSON format with comprehensive data.

🔐 Authentication

Secure API access with bearer token authentication

Base URL
All API requests are made to this base URL
https://statlytic.app/api

All endpoints are relative to this base URL. Use HTTPS for all requests.

API Key
Include your API key in the Authorization header
Authorization: Bearer YOUR_API_KEY

Generate your API key from the dashboard settings. Keep it secure and never expose it in client-side code.

📊 Core Endpoints

Essential endpoints for accessing your analytics data

Get Analytics Data
Retrieve comprehensive analytics for a site
GET

Endpoint

GET /api/sites/{siteId}/analytics

Query Parameters

startDateStart date (YYYY-MM-DD)
endDateEnd date (YYYY-MM-DD)
groupByday, week, month

Example Response

{ "totalViews": 1234, "uniqueVisitors": 567, "bounceRate": 34.2, "avgSessionDuration": 154, "topPages": [ { "path": "/", "views": 500, "title": "Homepage" } ], "topCountries": [ { "country": "United States", "views": 600, "percentage": 48.6 } ] }
Get Heatmap Data
Retrieve heatmap data for a specific page
GET

Endpoint

GET /api/sites/{siteId}/heatmap

Query Parameters

pathPage path (e.g., /about)
typeclick, scroll, move

Example Response

{ "clicks": [ { "x": 150, "y": 200, "count": 45, "element": "button" } ], "scrolls": [ { "depth": 50, "percentage": 75.2 } ] }
Get SEO Data
Retrieve SEO analytics and insights
GET

Endpoint

GET /api/sites/{siteId}/seo

Example Response

{ "keywords": [ { "keyword": "privacy analytics", "position": 3, "clicks": 45, "impressions": 1200 } ], "pageSpeed": { "score": 85, "lcp": 2.1, "fid": 0.8, "cls": 0.05 }, "suggestions": [ { "type": "meta", "message": "Add meta description", "priority": "high" } ] }

🔗 Webhooks

Get real-time notifications for important events

Available Events
Events that can trigger webhooks

traffic.spike

Traffic increase detected

goal.completed

Conversion goal reached

error.detected

Site error identified

report.ready

Scheduled report generated

Webhook Configuration
How to set up and configure webhooks

1. Create Webhook

POST /api/webhooks
{ "url": "https://your-site.com/webhook", "events": ["traffic.spike", "goal.completed"] }

2. Verify Signature

X-Statlytic-Signature: sha256=...

3. Handle Events

Process incoming webhook events and respond with 200 status.

⚡ Rate Limits & Best Practices

Important information about API usage and limits

Rate Limits
API usage limits and quotas
Free Plan100 requests/hour
Pro Plan1,000 requests/hour
Burst Limit10 requests/second

Rate limit headers are included in all responses: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset

Best Practices
Tips for optimal API usage

Use appropriate date ranges to avoid large responses

Implement exponential backoff for retries

Cache responses when appropriate

Use webhooks for real-time updates instead of polling

Keep your API key secure and rotate it regularly

📚 SDKs & Libraries

Official SDKs and community libraries for popular languages

JavaScript/Node.js
Official SDK for JavaScript and Node.js
npm install @statlytic/sdk
import Statlytic from '@statlytic/sdk'
View on GitHub
Python
Official SDK for Python applications
pip install statlytic
from statlytic import Statlytic
View on GitHub
PHP
Official SDK for PHP applications
composer require statlytic/sdk
use Statlytic\Statlytic;
View on GitHub

Ready to Build with Our API?

Start building custom integrations and accessing your analytics data programmatically.

Need help? Check out our documentation or contact our developer support team.