API Reference¶
Base URL: https://antics-api.turtletech.us (managed) or http://localhost:8480 (self-hosted)
Authentication: Authelia headers (Remote-User) for self-hosted, Bearer API key for managed mode.
Event Collection¶
POST /api/event¶
Collect a pageview or custom event. No authentication required.
{
"n": null,
"u": "https://example.com/page",
"r": "https://google.com",
"w": 1920,
"t": 5,
"p": {"plan": "pro"}
}
Field |
Type |
Description |
|---|---|---|
|
string | null |
Event name. |
|
string |
Page URL |
|
string | null |
Referrer URL |
|
number | null |
Viewport width (pixels) |
|
number | null |
Seconds spent on previous page |
|
object | null |
Custom event properties |
Site identified by Origin header. Returns 202 Accepted.
Sites¶
GET /api/sites¶
List all tracked sites.
POST /api/sites¶
Create a site: {"domain": "example.com", "name": "My Site"}
PUT /api/sites/:id¶
Update: {"name": "New Name", "public": true}
DELETE /api/sites/:id¶
Delete site and all data (cascading).
PUT /api/sites/:id/folder¶
Move to folder: {"folder_id": "FOLDER-UUID"} or {"folder_id": null} to ungroup.
Stats¶
GET /api/stats/:site_id¶
Query analytics data.
Param |
Default |
Description |
|---|---|---|
|
|
|
|
|
|
|
|
Max breakdown items |
Response includes summary, previous_summary (for % change), and breakdown.
GET /api/stats/:site_id/timeseries¶
Daily visitor/pageview counts for charting.
Param |
Default |
Description |
|---|---|---|
|
|
Time range |
GET /api/stats/:site_id/realtime¶
Current visitors in the last 5 minutes.
GET /api/stats/:site_id/paths¶
Top page sequences (user journeys). Returns paths like / -> /about -> /pricing.
GET /api/stats/:site_id/entry-exit¶
Entry and exit page breakdown per visitor.
Export¶
GET /api/export/:site_id¶
CSV download. Add ?metric=pathname for breakdown, omit for daily summary.
Folders¶
GET /api/folders¶
POST /api/folders¶
{"name": "Personal", "authelia_group": "analytics-personal"}
PUT /api/folders/:id¶
DELETE /api/folders/:id¶
Alerts¶
GET /api/alerts¶
POST /api/alerts¶
{"site_id": "...", "metric": "visitors", "operator": "lt", "threshold": 10, "email": "you@example.com"}
DELETE /api/alerts/:id¶
Public Endpoints¶
GET /antics.js¶
Tracker script (served with 24h cache).
GET /api/health¶
{"status": "ok", "service": "antics"}
GET /metrics¶
Prometheus exposition format.
GET /api/badge/:site_id¶
SVG badge with 24h visitor count (site must be public).