Documentation
REST API · v1.0
Send page views and custom events to WysLeap from any application.
API documentation
Send page views and custom events to WysLeap from any application with the telemetry ingest endpoints.
The fastest path depends on what you need:
One script tag auto-tracks pageviews, clicks, and scroll depth, with optional session replay.
Onboarding guidehttps://wysleap.com/apiAPI Key (header or body)
JSON + HTTP status codes
Every API request requires your API key, found in Site Settings. Supply it as a request header (recommended) or inside the request body.
Header (recommended)
X-API-Key: your-api-key-hereRequest body
{
"siteId": "your-site-id",
"_apiKey": "your-api-key-here"
}Track page views. Automatically builds visitor profiles from browser and device signals.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
siteId | string | Yes | Your site identifier |
pageUrl | string | Yes | Full URL of the page being viewed |
pageTitle | string | No | Page title from document.title |
referrer | string | No | Referring URL |
visitorId | string | No | Visitor ID, auto-generated if omitted |
sessionId | string | No | Session ID, auto-generated if omitted |
screenWidth | integer | No | Viewport width in pixels |
screenHeight | integer | No | Viewport height in pixels |
language | string | No | Browser language (e.g. en-US) |
timeZone | string | No | IANA timezone identifier |
_apiKey | string | Yes* | API key (or use X-API-Key header) |
Code Examples
curl -X POST https://wysleap.com/api/telemetry/pageview \
-H "Content-Type: application/json" \
-d '{
"siteId": "your-site-id",
"pageUrl": "https://example.com/products",
"pageTitle": "Products - Example Store",
"referrer": "https://google.com",
"visitorId": "vis_abc123",
"sessionId": "sess_xyz789",
"userAgent": "Mozilla/5.0...",
"screenWidth": 1920,
"screenHeight": 1080,
"language": "en-US",
"timeZone": "America/New_York",
"_apiKey": "your-api-key"
}'Response 200 OK
{
"success": true,
"message": "Pageview tracked successfully",
"visitorId": "vis_abc123",
"sessionId": "sess_xyz789",
"timestamp": "2025-01-15T10:30:00Z"
}Track custom events such as purchases, sign-ups, button clicks, or any other interaction that matters to you.
Sign Up Success, not sign_up_success.Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
siteId | string | Yes | Your site identifier |
eventName | string | Yes | Event name in Title Case (e.g. "Purchase Completed") |
eventData | object | No | Any JSON-serializable metadata for the event |
visitorId | string | No | Visitor ID to associate the event with |
sessionId | string | No | Session ID to associate the event with |
pageUrl | string | No | URL where the event occurred |
_apiKey | string | Yes* | API key (or use X-API-Key header) |
Code Examples
curl -X POST https://wysleap.com/api/telemetry/event \
-H "Content-Type: application/json" \
-d '{
"siteId": "your-site-id",
"eventName": "Purchase Completed",
"eventData": {
"productId": "prod_123",
"productName": "Premium Plan",
"currency": "USD"
},
"visitorId": "vis_abc123",
"pageUrl": "https://example.com/checkout/success",
"_apiKey": "your-api-key"
}'Response 200 OK
{
"success": true,
"message": "Event tracked successfully",
"eventId": "evt_123456",
"timestamp": "2025-01-15T10:30:00Z"
}All error responses use standard HTTP status codes with a consistent JSON body.
400Bad Request{
"error": "Invalid payload"
}401Unauthorized{
"error": "Invalid API key"
}403Forbidden{
"error": "Origin not allowed"
}429Too Many Requests{
"error": "Monthly event limit reached",
"usage": { "count": 1000000, "limit": 1000000, "percentUsed": 100 }
}500Internal Server Error{
"error": "Internal server error"
}Ingestion is limited by your plan's monthly event allowance (page views and events). Requests beyond it return 429 Too Many Requests with your current usage, until the allowance resets at the start of the next month. Requests are also checked against the site's API key and allowed domains.
{
"error": "Monthly event limit reached",
"usage": { "count": 1000000, "limit": 1000000, "percentUsed": 100 }
}The easiest integration. One script tag handles anonymous visitor IDs, session management, and data collection automatically.
For full setup, configuration options (trackClicks, trackScroll, session replay), and all SDK methods (trackPageView, trackEvent, setConsent), see the Onboarding Guide.
WysLeap.trackEvent('Event Name', { }) in your app to send custom events without calling the REST endpoint directly.Get your API key and start integrating privacy-first visitor intelligence into your application.