User Traits
Get Users by Trait
Returns users matching a specific trait key and value, with location and session metadata.
GET /api/sites/:site/user-traits/usersReturns users matching a specific trait key and value, with location and session metadata.
Path Parameters
Prop
Type
Query Parameters
Prop
Type
Response
Prop
Type
TraitUser Object
Prop
Type
curl -X GET "https://app.rybbit.io/api/sites/123/user-traits/users?key=plan&value=pro" \
-H "Authorization: Bearer your_api_key_here"const response = await fetch(
'https://app.rybbit.io/api/sites/123/user-traits/users?key=plan&value=pro',
{
headers: {
'Authorization': 'Bearer your_api_key_here'
}
}
);
const data = await response.json();import requests
response = requests.get(
'https://app.rybbit.io/api/sites/123/user-traits/users',
params={
'key': 'plan',
'value': 'pro'
},
headers={
'Authorization': 'Bearer your_api_key_here'
}
)
data = response.json()$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/123/user-traits/users?key=plan&value=pro');
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://app.rybbit.io/api/sites/123/user-traits/users?key=plan&value=pro')
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://app.rybbit.io/api/sites/123/user-traits/users?key=plan&value=pro", 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://app.rybbit.io/api/sites/123/user-traits/users?key=plan&value=pro")
.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://app.rybbit.io/api/sites/123/user-traits/users?key=plan&value=pro"))
.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://app.rybbit.io/api/sites/123/user-traits/users?key=plan&value=pro");
var data = await response.Content.ReadAsStringAsync();{
"users": [
{
"user_id": "a1b2c3",
"identified_user_id": "user_987",
"traits": { "plan": "pro", "company": "Acme" },
"country": "US",
"region": "California",
"city": "CA-San Francisco",
"browser": "Chrome",
"operating_system": "macOS",
"device_type": "desktop",
"sessions": 14
}
],
"total": 1,
"hasMore": false
}