curl --request GET \
--url https://api.datalyr.com/v1/events \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.datalyr.com/v1/events"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.datalyr.com/v1/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.datalyr.com/v1/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.datalyr.com/v1/events"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.datalyr.com/v1/events")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datalyr.com/v1/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"events": [
{
"id": "<string>",
"event_name": "<string>",
"visitor_id": "<string>",
"session_id": "<string>",
"user_id": "<string>",
"received_at": "<string>",
"source": "<string>",
"transport_source": "<string>",
"attribution_source": "<string>",
"geo_country": "<string>",
"geo_region": "<string>",
"geo_city": "<string>",
"page_path": "<string>",
"page_title": "<string>",
"page_url": "<string>",
"referrer": "<string>",
"utm_source": "<string>",
"utm_medium": "<string>",
"utm_campaign": "<string>",
"event_data": "<string>"
}
],
"total_count": 123,
"returned_count": 123,
"has_more": true,
"limit": 123,
"offset": 123,
"complete": true,
"total_count_is_lower_bound": true,
"coverage": {
"returned": 123,
"total": 123,
"total_is_lower_bound": true,
"complete": true,
"reason": "<string>"
},
"property_filters": [
{
"key": "<string>",
"op": "eq",
"value": "<string>"
}
],
"property_filter_note": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}List events
curl --request GET \
--url https://api.datalyr.com/v1/events \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.datalyr.com/v1/events"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.datalyr.com/v1/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.datalyr.com/v1/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.datalyr.com/v1/events"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.datalyr.com/v1/events")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datalyr.com/v1/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"events": [
{
"id": "<string>",
"event_name": "<string>",
"visitor_id": "<string>",
"session_id": "<string>",
"user_id": "<string>",
"received_at": "<string>",
"source": "<string>",
"transport_source": "<string>",
"attribution_source": "<string>",
"geo_country": "<string>",
"geo_region": "<string>",
"geo_city": "<string>",
"page_path": "<string>",
"page_title": "<string>",
"page_url": "<string>",
"referrer": "<string>",
"utm_source": "<string>",
"utm_medium": "<string>",
"utm_campaign": "<string>",
"event_data": "<string>"
}
],
"total_count": 123,
"returned_count": 123,
"has_more": true,
"limit": 123,
"offset": 123,
"complete": true,
"total_count_is_lower_bound": true,
"coverage": {
"returned": 123,
"total": 123,
"total_is_lower_bound": true,
"complete": true,
"reason": "<string>"
},
"property_filters": [
{
"key": "<string>",
"op": "eq",
"value": "<string>"
}
],
"property_filter_note": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Inclusive ISO 8601 start date.
Inclusive ISO 8601 end date.
Comma-separated event names.
Country code.
Filters on the event_data JSON blob, as a JSON array of {key, op, value} objects combined with AND. Up to 5. op is one of eq, neq, contains, gt, lt. Example: [{"key":"plan","op":"eq","value":"pro"},{"key":"amount","op":"gt","value":20}].
Use /events/properties to get key names. A key that is not tracked returns zero rows, which is indistinguishable from a key whose value never matches.
eq, neq and contains compare the value as text and require the key to be PRESENT — so neq EXCLUDES events that never carried the key, rather than counting them as not-equal. gt and lt compare the value as a number and ignore events whose value is missing, null, boolean, or non-numeric. A JSON string such as "12" is treated as the number 12, because event_data is untyped and the same property arrives quoted from one SDK and bare from another.
event_data has no index, so a property filter reads every event in the range. The range is therefore capped at 31 days when property_filters is present; a wider range is a 400, not a slow query.
1 <= x <= 1000x >= 0Send true to count every matching event, so total_count is exact on every page of a property_filters request. Only the string true turns it on: 1, yes, and TRUE do not.
Without it, a property_filters request skips the count. total_count is then exact on the last page and a lower bound on every page before it, flagged by total_count_is_lower_bound. has_more is exact either way.
The count reads event_data for every event in the range a second time, so the request takes longer. If either read fails or times out, the response is 503. Without property_filters the count always runs, and this parameter changes nothing.
Response
Successful response. Three source fields ride together during the events-source rename. attribution_source is the stable alias to read for attribution; transport_source is the stable field for transport.
Show child attributes
Show child attributes
Matching events in the whole date range, not in this page. Always exact without property_filters, and exact with include_total=true.
With property_filters and no include_total, it is exact on the last page. On an earlier page it is a lower bound, offset + returned_count + 1, and total_count_is_lower_bound is true. A page past the end, with no rows at a non-zero offset, reports 0 as a lower bound.
Rows in this page.
Exact. Page until it is false rather than until a page comes back short.
Always true on a 200. A failed read is a 503, never an empty page.
Present, and true, only when total_count is a lower bound rather than the exact total. Absent otherwise, and never sent as false. To get the exact total, page until has_more is false, or send include_total=true.
Show child attributes
Show child attributes
The property filters the request applied, echoed back. Absent when it applied none.
Show child attributes
Show child attributes
Present only with property_filters. Explains in prose that the filter scans every event in the range, which ops exclude events without the key, and whether total_count was counted or is a lower bound. Read total_count_is_lower_bound for the flag, not this text.
Was this page helpful?