curl --request GET \
--url https://api.datalyr.com/v1/users/{userId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.datalyr.com/v1/users/{userId}"
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/users/{userId}', 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/users/{userId}",
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/users/{userId}"
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/users/{userId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datalyr.com/v1/users/{userId}")
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{
"user": {},
"sessions": [
{}
],
"conversions": [
{}
],
"window_days": 183,
"sessions_window_days": 45
}{
"error": "<string>"
}{
"error": "<string>"
}Get user
One user’s profile, recent sessions, and conversions. The profile counts the user’s events from the last window_days days, measured back from the moment of the request.
The default window changed from 365 days to 90 days on September 12, 2026. For that reason alone, user.events, user.sessions, user.pageviews, and user.total_value can read lower than they did before, and user.first_seen can read later. Send window_days=365 to get the previous behavior. The window_days field in the response states the window every profile number covers.
sessions and conversions come from the user’s 1000 most recent events inside sessions_window_days, which is window_days or 90, whichever is smaller.
A user with no event inside the window returns 404, even when older events exist. Send a larger window_days, up to 365, before you conclude that the user does not exist.
If the identity store is unavailable or the lookup times out, the response is 503 with error: user_detail_unavailable and a Retry-After header. A 503 never means the user does not exist, so retry it rather than treating it as a 404.
curl --request GET \
--url https://api.datalyr.com/v1/users/{userId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.datalyr.com/v1/users/{userId}"
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/users/{userId}', 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/users/{userId}",
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/users/{userId}"
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/users/{userId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datalyr.com/v1/users/{userId}")
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{
"user": {},
"sessions": [
{}
],
"conversions": [
{}
],
"window_days": 183,
"sessions_window_days": 45
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Query Parameters
How many days back the user profile counts, from the moment of the request. A value below 1 reads as 1, and a value above 365 reads as 365. A decimal is truncated, so 90.7 reads as 90. A non-numeric or empty value uses the default. The response echoes the value it used as window_days.
The default was 365 before September 12, 2026.
1 <= x <= 365Response
Successful response. window_days and sessions_window_days state the windows the numbers cover.
The profile, computed over window_days only. events, sessions, pageviews, and total_value count events inside the window. first_seen and last_seen are the first and last event inside it, so first_seen is not the user's first visit when that visit is older. email, name, and phone are the newest non-empty values in the window. visitor_id, user_id, location, device_type, browser, os, source, medium, campaign, landing_page, and click_id come from the newest event in the window.
Sessions built from the user's 1000 most recent events inside sessions_window_days, newest first.
Events named purchase, signup, trial_start, or subscription, plus any event with a value above 0, taken from the same events as sessions.
The window, in days, that user covers. It is the window_days you sent after clamping, or 90 when you sent none or a non-numeric value.
1 <= x <= 365The window, in days, that sessions and conversions cover. The smaller of window_days and 90.
1 <= x <= 90Was this page helpful?