Skip to content

API Reference

Navigate: Use the sidebar (left) for any endpoint. Quick links on this page:


Tracking Endpoints

All tracking endpoints accept POST with Content-Type: application/json. No authentication required. All responses include CORS headers.

MethodPathDescription
POST/track/session/startStart a new tracking session
POST/track/eventRecord a single event
POST/track/events/batchRecord multiple events (max 100)
POST/track/session/endEnd a session and calculate engagement
OPTIONS/track/*CORS preflight

Analytics Endpoints

All analytics endpoints require API key authentication and accept GET only. See Analytics API for full details.

MethodPathDescription
GET/analytics/overviewSummary stats (sessions, events, visitors)
GET/analytics/sessions/dailyDaily session counts
GET/analytics/pages/topMost viewed pages
GET/analytics/geoCountry-level distribution
GET/analytics/engagementEngagement score buckets
GET/analytics/sourcesTraffic referrer ranking
GET/analytics/realtimeActive sessions and live stats
GET/analytics/storageR2 storage stats
GET/analytics/leadsPaginated lead listing with filters
GET/analytics/leads/:idLead detail with replay-linked activity
GET/analytics/leads/projectsDistinct project names for filter dropdowns
GET/analytics/leads/sourcesDistinct sources for filter dropdowns
GET/analytics/anomaliesAnomaly detection (submission drops, traffic spikes, VPN ratio)
GET/analytics/engine/submissions-dailyLead submissions per day (Analytics Engine; optional filters)
GET/analytics/engine/by-projectLead submissions by project
GET/analytics/engine/by-sourceLead submissions by source
GET/analytics/engine/by-engagementLead submissions by engagement label
GET/analytics/engine/overviewLead submission totals and averages
GET/analytics/engine/projectsDistinct projects (filter options)
GET/analytics/engine/sourcesDistinct sources (filter options)
OPTIONS/analytics/*CORS preflight (no auth required)

Forms (multi-form / sites)

MethodPathDescription
GET/forms/configForm schema by siteKey + formId (domain-validated)
OPTIONS/forms/configCORS preflight

Lead Capture

MethodPathDescription
POST/lead.capturePrimary lead capture endpoint
POST/lead.capture/crm-callbackCallback for Make.com to send CRM lead ID after CRM create
POST/lead.capture/make-callbackCallback for Make.com to send execution log URL (and optional status) for "View in Make.com"
POST/webhooks/crm/leadIncoming webhook for CRM lead change events
POST/leadDeprecated — use /lead.capture (sunset 2026-06-01)
POST/Deprecated — use /lead.capture (sunset 2026-06-01)
OPTIONS/lead.captureCORS preflight

Other Endpoints

MethodPathDescription
GET/tracker.jsServes the frontend tracking script
GET/form.jsServes the dynamic form builder script
GET/pulse.jsCombined tracker + form script; PulseGate.init() defaults endpoint to script origin
GET/healthHealth check ({ status: "ok", timestamp })

Authentication

Analytics endpoints require an API key in one of two headers. Role-based access: admin key (ANALYTICS_API_KEY) has full access; marketing keys (dashboard-generated in Settings → Marketing API keys, or optional ANALYTICS_MARKETING_API_KEY) have restricted pages and optional PII masking. See Marketing access.

Authorization: Bearer <your-api-key>

or

X-API-Key: <your-api-key>

Requests without a valid key receive 401 Unauthorized with a WWW-Authenticate: Bearer header.

Common Response Format

Success (200):

json
{
  "session_id": "uuid",
  "visitor_id": "sha256-hash",
  "timestamp": 1740000000000
}

Error (400/401/404/405):

json
{
  "error": "Description of what went wrong"
}

Rate Limiting

Tracking endpoints (/track/*) are rate-limited per IP using a fixed-window strategy backed by D1 (atomic increment). Whitelisted IPs (dashboard Whitelisted IPs) skip rate limiting.

RouteLimit
/track/session/start10 requests/min
/track/session/end10 requests/min
/track/event120 requests/min
/track/events/batch30 requests/min

When rate-limited, the response includes:

  • 429 Too Many Requests status
  • Retry-After header (seconds until reset)
  • X-RateLimit-Remaining and X-RateLimit-Reset headers

CORS Headers

All responses include:

Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: Content-Type, X-Fingerprint-ID, X-Visitor-ID, Authorization, X-API-Key
Content-Type: application/json