curl --request POST \
--url https://api.rigaly.com/api/v1/segments/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"preset_id": "big_spenders",
"points_balance": {
"min": 123,
"max": 123
},
"spend_usd_estimated": {
"min": 123,
"max": 123
},
"visit_count": {
"min": 123,
"max": 123
},
"redemption_count": {
"min": 123,
"max": 123
},
"last_visit_within_days": 1825,
"last_visit_not_within_days": 1825,
"joined_within_days": 1825,
"joined_before_days_ago": 1825,
"hour_of_day": {
"from": 11,
"to": 11
},
"day_of_week": [
3
],
"timezone": "America/New_York",
"has_redeemed": true,
"promotion_interest": true,
"birthday_in_month": 6,
"pagination": {
"limit": 50,
"offset": 0
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
preset_id: 'big_spenders',
points_balance: {min: 123, max: 123},
spend_usd_estimated: {min: 123, max: 123},
visit_count: {min: 123, max: 123},
redemption_count: {min: 123, max: 123},
last_visit_within_days: 1825,
last_visit_not_within_days: 1825,
joined_within_days: 1825,
joined_before_days_ago: 1825,
hour_of_day: {from: 11, to: 11},
day_of_week: [3],
timezone: 'America/New_York',
has_redeemed: true,
promotion_interest: true,
birthday_in_month: 6,
pagination: {limit: 50, offset: 0}
})
};
fetch('https://api.rigaly.com/api/v1/segments/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.rigaly.com/api/v1/segments/preview"
payload = {
"preset_id": "big_spenders",
"points_balance": {
"min": 123,
"max": 123
},
"spend_usd_estimated": {
"min": 123,
"max": 123
},
"visit_count": {
"min": 123,
"max": 123
},
"redemption_count": {
"min": 123,
"max": 123
},
"last_visit_within_days": 1825,
"last_visit_not_within_days": 1825,
"joined_within_days": 1825,
"joined_before_days_ago": 1825,
"hour_of_day": {
"from": 11,
"to": 11
},
"day_of_week": [3],
"timezone": "America/New_York",
"has_redeemed": True,
"promotion_interest": True,
"birthday_in_month": 6,
"pagination": {
"limit": 50,
"offset": 0
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.rigaly.com/api/v1/segments/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'preset_id' => 'big_spenders',
'points_balance' => [
'min' => 123,
'max' => 123
],
'spend_usd_estimated' => [
'min' => 123,
'max' => 123
],
'visit_count' => [
'min' => 123,
'max' => 123
],
'redemption_count' => [
'min' => 123,
'max' => 123
],
'last_visit_within_days' => 1825,
'last_visit_not_within_days' => 1825,
'joined_within_days' => 1825,
'joined_before_days_ago' => 1825,
'hour_of_day' => [
'from' => 11,
'to' => 11
],
'day_of_week' => [
3
],
'timezone' => 'America/New_York',
'has_redeemed' => true,
'promotion_interest' => true,
'birthday_in_month' => 6,
'pagination' => [
'limit' => 50,
'offset' => 0
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"success": true,
"message": "<string>",
"data": {}
}Preview a segment
Returns the match count and a small sample for a segment filter — either a preset_id or custom filters (spend, visits, recency, time-of-day, birthday month…). Filter fields are top-level (there is no filters wrapper).
curl --request POST \
--url https://api.rigaly.com/api/v1/segments/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"preset_id": "big_spenders",
"points_balance": {
"min": 123,
"max": 123
},
"spend_usd_estimated": {
"min": 123,
"max": 123
},
"visit_count": {
"min": 123,
"max": 123
},
"redemption_count": {
"min": 123,
"max": 123
},
"last_visit_within_days": 1825,
"last_visit_not_within_days": 1825,
"joined_within_days": 1825,
"joined_before_days_ago": 1825,
"hour_of_day": {
"from": 11,
"to": 11
},
"day_of_week": [
3
],
"timezone": "America/New_York",
"has_redeemed": true,
"promotion_interest": true,
"birthday_in_month": 6,
"pagination": {
"limit": 50,
"offset": 0
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
preset_id: 'big_spenders',
points_balance: {min: 123, max: 123},
spend_usd_estimated: {min: 123, max: 123},
visit_count: {min: 123, max: 123},
redemption_count: {min: 123, max: 123},
last_visit_within_days: 1825,
last_visit_not_within_days: 1825,
joined_within_days: 1825,
joined_before_days_ago: 1825,
hour_of_day: {from: 11, to: 11},
day_of_week: [3],
timezone: 'America/New_York',
has_redeemed: true,
promotion_interest: true,
birthday_in_month: 6,
pagination: {limit: 50, offset: 0}
})
};
fetch('https://api.rigaly.com/api/v1/segments/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.rigaly.com/api/v1/segments/preview"
payload = {
"preset_id": "big_spenders",
"points_balance": {
"min": 123,
"max": 123
},
"spend_usd_estimated": {
"min": 123,
"max": 123
},
"visit_count": {
"min": 123,
"max": 123
},
"redemption_count": {
"min": 123,
"max": 123
},
"last_visit_within_days": 1825,
"last_visit_not_within_days": 1825,
"joined_within_days": 1825,
"joined_before_days_ago": 1825,
"hour_of_day": {
"from": 11,
"to": 11
},
"day_of_week": [3],
"timezone": "America/New_York",
"has_redeemed": True,
"promotion_interest": True,
"birthday_in_month": 6,
"pagination": {
"limit": 50,
"offset": 0
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.rigaly.com/api/v1/segments/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'preset_id' => 'big_spenders',
'points_balance' => [
'min' => 123,
'max' => 123
],
'spend_usd_estimated' => [
'min' => 123,
'max' => 123
],
'visit_count' => [
'min' => 123,
'max' => 123
],
'redemption_count' => [
'min' => 123,
'max' => 123
],
'last_visit_within_days' => 1825,
'last_visit_not_within_days' => 1825,
'joined_within_days' => 1825,
'joined_before_days_ago' => 1825,
'hour_of_day' => [
'from' => 11,
'to' => 11
],
'day_of_week' => [
3
],
'timezone' => 'America/New_York',
'has_redeemed' => true,
'promotion_interest' => true,
'birthday_in_month' => 6,
'pagination' => [
'limit' => 50,
'offset' => 0
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"success": true,
"message": "<string>",
"data": {}
}Authorizations
API key from the Rigaly dashboard: Authorization: Bearer rgly_sk_...
Body
Customer segment filter. Provide preset_id OR any combination of the
top-level filter fields below (there is NO filters wrapper). Range
filters take { min, max }. Time-of-day filters require timezone.
A preset from GET /segments/presets
"big_spenders"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
1 <= x <= 3650Mutually exclusive with last_visit_within_days
1 <= x <= 36501 <= x <= 36501 <= x <= 3650Requires timezone
Show child attributes
Show child attributes
0=Sunday. Requires timezone
0 <= x <= 6"America/New_York"
1 <= x <= 12Show child attributes
Show child attributes