API Reference
REST API Documentation
Integrate Invoker Analytics into your applications with our REST API.
Authentication
All API requests require authentication using a Bearer token. You can obtain your API token from your account settings.
Authorization Header
Authorization: Bearer YOUR_API_TOKEN
Base URL
https://api.invoker-analytics.com/api
Endpoints
Sites
GET
/sitesList all sites for the authenticated user
curl -X GET "https://api.invoker-analytics.com/api/sites" \ -H "Authorization: Bearer YOUR_API_TOKEN"
POST
/sitesCreate a new site
curl -X POST "https://api.invoker-analytics.com/api/sites" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"domain": "newsite.com",
"timezone": "America/New_York"
}'Analytics
GET
/sites/{site_id}/analytics/statsGet aggregate statistics for a site
Query Parameters
| Parameter | Type | Description |
|---|---|---|
period | string | Time period (today, 7d, 30d, 12mo, custom) |
startDate | date | Start date for custom period (YYYY-MM-DD) |
endDate | date | End date for custom period (YYYY-MM-DD) |
curl -X GET "https://api.invoker-analytics.com/api/sites/1/analytics/stats?period=30d" \ -H "Authorization: Bearer YOUR_API_TOKEN"
GET
/sites/{site_id}/analytics/pagesGet page view statistics
{
"data": [
{
"page": "/",
"hits": 5420,
"visitors": 2100,
"percentage": 35.2
},
{
"page": "/pricing",
"hits": 2150,
"visitors": 980,
"percentage": 14.0
}
]
}Events
POST
/eventTrack a custom event (no auth required, uses domain validation)
curl -X POST "https://api.invoker-analytics.com/api/event" \
-H "Content-Type: application/json" \
-d '{
"domain": "example.com",
"name": "Button Click",
"url": "https://example.com/pricing",
"props": {
"button_id": "cta-signup",
"variant": "blue"
}
}'Shared Dashboards
POST
/sites/{site_id}/sharesCreate a shared dashboard
curl -X POST "https://api.invoker-analytics.com/api/sites/1/shares" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Client Dashboard",
"password": "optional-password",
"allowed_metrics": ["pageviews", "visitors", "pages"],
"expires_at": "2024-12-31T23:59:59Z"
}'Error Handling
The API uses standard HTTP status codes to indicate success or failure:
| Status Code | Description |
|---|---|
200 | Success |
201 | Created |
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid or missing token |
403 | Forbidden - Insufficient permissions |
404 | Not Found - Resource doesn't exist |
429 | Too Many Requests - Rate limit exceeded |
Rate Limits
API requests are rate limited to ensure fair usage:
- Standard plans: 100 requests per minute
- Pro plans: 500 requests per minute
- Enterprise: Custom limits available
Rate limit headers are included in all responses:
X-RateLimit-Limit: 100 X-RateLimit-Remaining: 95 X-RateLimit-Reset: 1705329600