APIStats
Sessions
Retrieve session-level analytics data including session lists, details, and locations
See the API Reference for authentication, common parameters, and filters.
Endpoints
Get Sessions
GET /api/sessions/:siteReturns a paginated list of sessions with their analytics data.
Path Parameters
Prop
Type
Query Parameters
Accepts all Common Parameters plus the following:
Prop
Type
Response
Prop
Type
Session Object
Prop
Type
curl -X GET "https://api.rybbit.io/api/sessions/123?page=1&limit=20&start_date=2024-01-01&end_date=2024-01-31" \
-H "Authorization: Bearer your_api_key_here"const response = await fetch(
'https://api.rybbit.io/api/sessions/123?page=1&limit=20&start_date=2024-01-01&end_date=2024-01-31',
{
headers: {
'Authorization': 'Bearer your_api_key_here'
}
}
);
const data = await response.json();import requests
response = requests.get(
'https://api.rybbit.io/api/sessions/123',
params={
'page': 1,
'limit': 20,
'start_date': '2024-01-01',
'end_date': '2024-01-31'
},
headers={
'Authorization': 'Bearer your_api_key_here'
}
)
data = response.json()$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.rybbit.io/api/sessions/123?page=1&limit=20&start_date=2024-01-01&end_date=2024-01-31');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer your_api_key_here'
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);require 'net/http'
require 'json'
uri = URI('https://api.rybbit.io/api/sessions/123?page=1&limit=20&start_date=2024-01-01&end_date=2024-01-31')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer your_api_key_here'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
data = JSON.parse(res.body)req, _ := http.NewRequest("GET", "https://api.rybbit.io/api/sessions/123?page=1&limit=20&start_date=2024-01-01&end_date=2024-01-31", nil)
req.Header.Set("Authorization", "Bearer your_api_key_here")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var data map[string]interface{}
json.NewDecoder(resp.Body).Decode(&data)let client = reqwest::Client::new();
let res = client
.get("https://api.rybbit.io/api/sessions/123?page=1&limit=20&start_date=2024-01-01&end_date=2024-01-31")
.header("Authorization", "Bearer your_api_key_here")
.send()
.await?;
let data: serde_json::Value = res.json().await?;HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.rybbit.io/api/sessions/123?page=1&limit=20&start_date=2024-01-01&end_date=2024-01-31"))
.header("Authorization", "Bearer your_api_key_here")
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
var response = await client.GetAsync("https://api.rybbit.io/api/sessions/123?page=1&limit=20&start_date=2024-01-01&end_date=2024-01-31");
var data = await response.Content.ReadAsStringAsync();{
"data": [
{
"session_id": "sess_abc123",
"user_id": "dev_xyz789",
"identified_user_id": "user@example.com",
"traits": { "plan": "pro" },
"country": "US",
"region": "California",
"city": "San Francisco",
"browser": "Chrome",
"operating_system": "macOS",
"device_type": "desktop",
"referrer": "https://google.com",
"channel": "organic",
"entry_page": "/",
"exit_page": "/pricing",
"pageviews": 5,
"events": 2,
"session_duration": 245,
"session_start": "2024-01-31T14:00:00.000Z",
"session_end": "2024-01-31T14:04:05.000Z",
"utm_source": "google",
"utm_medium": "cpc",
"utm_campaign": "brand"
}
]
}Get Session
GET /api/sessions/:sessionId/:siteReturns detailed information about a specific session including all events and pageviews.
Path Parameters
Prop
Type
Query Parameters
Prop
Type
Response
Prop
Type
SessionDetails Object
Prop
Type
Event Object
Prop
Type
curl -X GET "https://api.rybbit.io/api/sessions/sess_abc123/123?limit=50" \
-H "Authorization: Bearer your_api_key_here"const response = await fetch(
'https://api.rybbit.io/api/sessions/sess_abc123/123?limit=50',
{
headers: {
'Authorization': 'Bearer your_api_key_here'
}
}
);
const data = await response.json();import requests
response = requests.get(
'https://api.rybbit.io/api/sessions/sess_abc123/123',
params={'limit': 50},
headers={
'Authorization': 'Bearer your_api_key_here'
}
)
data = response.json()$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.rybbit.io/api/sessions/sess_abc123/123?limit=50');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer your_api_key_here'
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);require 'net/http'
require 'json'
uri = URI('https://api.rybbit.io/api/sessions/sess_abc123/123?limit=50')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer your_api_key_here'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
data = JSON.parse(res.body)req, _ := http.NewRequest("GET", "https://api.rybbit.io/api/sessions/sess_abc123/123?limit=50", nil)
req.Header.Set("Authorization", "Bearer your_api_key_here")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var data map[string]interface{}
json.NewDecoder(resp.Body).Decode(&data)let client = reqwest::Client::new();
let res = client
.get("https://api.rybbit.io/api/sessions/sess_abc123/123?limit=50")
.header("Authorization", "Bearer your_api_key_here")
.send()
.await?;
let data: serde_json::Value = res.json().await?;HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.rybbit.io/api/sessions/sess_abc123/123?limit=50"))
.header("Authorization", "Bearer your_api_key_here")
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
var response = await client.GetAsync("https://api.rybbit.io/api/sessions/sess_abc123/123?limit=50");
var data = await response.Content.ReadAsStringAsync();{
"data": {
"session": {
"session_id": "sess_abc123",
"user_id": "dev_xyz789",
"country": "US",
"browser": "Chrome",
"operating_system": "macOS",
"device_type": "desktop",
"session_start": "2024-01-31T14:00:00.000Z",
"session_end": "2024-01-31T14:04:05.000Z",
"session_duration": 245,
"pageviews": 5,
"events": 7,
"entry_page": "/",
"exit_page": "/pricing"
},
"events": [
{
"timestamp": "2024-01-31T14:00:00.000Z",
"pathname": "/",
"hostname": "example.com",
"page_title": "Home",
"type": "pageview",
"referrer": "https://google.com"
},
{
"timestamp": "2024-01-31T14:01:30.000Z",
"pathname": "/",
"hostname": "example.com",
"type": "custom_event",
"event_name": "cta_click",
"props": { "button": "hero" }
}
],
"pagination": {
"total": 7,
"limit": 50,
"offset": 0,
"hasMore": false
}
}
}Get Session Locations
GET /api/session-locations/:siteReturns aggregated session locations with coordinates for map visualization.
Path Parameters
Prop
Type
Query Parameters
Accepts all Common Parameters (time and filters).
Response
Prop
Type
Location Object
Prop
Type
curl -X GET "https://api.rybbit.io/api/session-locations/123?start_date=2024-01-01&end_date=2024-01-31" \
-H "Authorization: Bearer your_api_key_here"const response = await fetch(
'https://api.rybbit.io/api/session-locations/123?start_date=2024-01-01&end_date=2024-01-31',
{
headers: {
'Authorization': 'Bearer your_api_key_here'
}
}
);
const data = await response.json();import requests
response = requests.get(
'https://api.rybbit.io/api/session-locations/123',
params={
'start_date': '2024-01-01',
'end_date': '2024-01-31'
},
headers={
'Authorization': 'Bearer your_api_key_here'
}
)
data = response.json()$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.rybbit.io/api/session-locations/123?start_date=2024-01-01&end_date=2024-01-31');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer your_api_key_here'
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);require 'net/http'
require 'json'
uri = URI('https://api.rybbit.io/api/session-locations/123?start_date=2024-01-01&end_date=2024-01-31')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer your_api_key_here'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
data = JSON.parse(res.body)req, _ := http.NewRequest("GET", "https://api.rybbit.io/api/session-locations/123?start_date=2024-01-01&end_date=2024-01-31", nil)
req.Header.Set("Authorization", "Bearer your_api_key_here")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var data map[string]interface{}
json.NewDecoder(resp.Body).Decode(&data)let client = reqwest::Client::new();
let res = client
.get("https://api.rybbit.io/api/session-locations/123?start_date=2024-01-01&end_date=2024-01-31")
.header("Authorization", "Bearer your_api_key_here")
.send()
.await?;
let data: serde_json::Value = res.json().await?;HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.rybbit.io/api/session-locations/123?start_date=2024-01-01&end_date=2024-01-31"))
.header("Authorization", "Bearer your_api_key_here")
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
var response = await client.GetAsync("https://api.rybbit.io/api/session-locations/123?start_date=2024-01-01&end_date=2024-01-31");
var data = await response.Content.ReadAsStringAsync();{
"data": [
{
"lat": 37.7749,
"lon": -122.4194,
"city": "San Francisco",
"country": "US",
"count": 1250
},
{
"lat": 40.7128,
"lon": -74.006,
"city": "New York",
"country": "US",
"count": 980
},
{
"lat": 51.5074,
"lon": -0.1278,
"city": "London",
"country": "GB",
"count": 650
}
]
}