Segments
Get Segment Count
Preview the active subscriber count for a segment
GET
/
api
/
v1
/
segments
/
{segmentId}
/
count
Get Segment Count
curl --request GET \
--url https://api.sequenzy.com/api/v1/segments/{segmentId}/count \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.sequenzy.com/api/v1/segments/{segmentId}/count"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.sequenzy.com/api/v1/segments/{segmentId}/count', 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.sequenzy.com/api/v1/segments/{segmentId}/count",
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.sequenzy.com/api/v1/segments/{segmentId}/count"
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.sequenzy.com/api/v1/segments/{segmentId}/count")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sequenzy.com/api/v1/segments/{segmentId}/count")
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{
"success": true,
"segmentId": "seg_active_non_buyers",
"count": 1180
}
{
"success": false,
"error": "Segment references are nested too deeply. A segment filter can reference other segments up to 16 levels deep, and the reference to segment seg_r would be level 17 (chain: seg_b > seg_c > ... > seg_q > seg_r). Retrying does not help. Copy the conditions of an inner segment into its parent instead of referencing it to reduce the nesting.",
"code": "SEGMENT_REFERENCE_DEPTH_EXCEEDED",
"title": "Segment references nested too deeply",
"description": "Segment references are nested too deeply. A segment filter can reference other segments up to 16 levels deep, and the reference to segment seg_r would be level 17 (chain: seg_b > seg_c > ... > seg_q > seg_r). Retrying does not help. Copy the conditions of an inner segment into its parent instead of referencing it to reduce the nesting.",
"howToFix": "Retrying does not help. Copy the conditions of an inner segment into its parent instead of referencing it to reduce the nesting.",
"docsUrl": "https://docs.sequenzy.com/api-reference/segments/count",
"details": {
"limit": "depth",
"segmentId": "seg_r",
"referenceChain": [
"seg_b",
"seg_c",
"seg_d",
"seg_e",
"seg_f",
"seg_g",
"seg_h",
"seg_i",
"seg_j",
"seg_k",
"seg_l",
"seg_m",
"seg_n",
"seg_o",
"seg_p",
"seg_q"
],
"maxDepth": 16,
"maxReferences": 1000
}
}
{
"success": false,
"error": "Unauthorized"
}
{
"success": false,
"error": "Segment not found"
}
Get the number of active subscribers who currently match a saved segment.
Each request evaluates the saved filters again. The
count matches
activeSubscriberCount from List Segments
when the underlying subscriber data is unchanged.
Custom-attribute filters use asynchronously synced values. After an import,
allow roughly 30–35 seconds for attribute updates to sync, or longer when
background processing is busy, then request the count again. An import with
status completed can still be waiting for this sync; recreating the segment
does not accelerate it.
A segment can use the segment filter to include or exclude another saved
segment, and that segment can reference others in turn. Counting follows up
to 16 levels of these references and up to 1,000 references in total, counting
a segment again each time it is referenced. Nested filter groups inside a
segment do not count toward either limit. Past a limit, the request returns
400 with code SEGMENT_REFERENCE_DEPTH_EXCEEDED or
SEGMENT_REFERENCE_COUNT_EXCEEDED. details names the segment that
exceeded the limit and the chain of segment IDs followed to reach it.
Retrying does not help. For too-deep chains, copy the conditions of an
inner segment into its parent. For too many references, reference fewer
segments or copy the conditions of shared segments into the segments that
use them.
Request
string
required
Segment ID.
curl "https://api.sequenzy.com/api/v1/segments/seg_active_non_buyers/count" \
-H "Authorization: Bearer YOUR_API_KEY"
Responses
{
"success": true,
"segmentId": "seg_active_non_buyers",
"count": 1180
}
{
"success": false,
"error": "Segment references are nested too deeply. A segment filter can reference other segments up to 16 levels deep, and the reference to segment seg_r would be level 17 (chain: seg_b > seg_c > ... > seg_q > seg_r). Retrying does not help. Copy the conditions of an inner segment into its parent instead of referencing it to reduce the nesting.",
"code": "SEGMENT_REFERENCE_DEPTH_EXCEEDED",
"title": "Segment references nested too deeply",
"description": "Segment references are nested too deeply. A segment filter can reference other segments up to 16 levels deep, and the reference to segment seg_r would be level 17 (chain: seg_b > seg_c > ... > seg_q > seg_r). Retrying does not help. Copy the conditions of an inner segment into its parent instead of referencing it to reduce the nesting.",
"howToFix": "Retrying does not help. Copy the conditions of an inner segment into its parent instead of referencing it to reduce the nesting.",
"docsUrl": "https://docs.sequenzy.com/api-reference/segments/count",
"details": {
"limit": "depth",
"segmentId": "seg_r",
"referenceChain": [
"seg_b",
"seg_c",
"seg_d",
"seg_e",
"seg_f",
"seg_g",
"seg_h",
"seg_i",
"seg_j",
"seg_k",
"seg_l",
"seg_m",
"seg_n",
"seg_o",
"seg_p",
"seg_q"
],
"maxDepth": 16,
"maxReferences": 1000
}
}
{
"success": false,
"error": "Unauthorized"
}
{
"success": false,
"error": "Segment not found"
}
⌘I
Get Segment Count
curl --request GET \
--url https://api.sequenzy.com/api/v1/segments/{segmentId}/count \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.sequenzy.com/api/v1/segments/{segmentId}/count"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.sequenzy.com/api/v1/segments/{segmentId}/count', 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.sequenzy.com/api/v1/segments/{segmentId}/count",
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.sequenzy.com/api/v1/segments/{segmentId}/count"
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.sequenzy.com/api/v1/segments/{segmentId}/count")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sequenzy.com/api/v1/segments/{segmentId}/count")
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{
"success": true,
"segmentId": "seg_active_non_buyers",
"count": 1180
}
{
"success": false,
"error": "Segment references are nested too deeply. A segment filter can reference other segments up to 16 levels deep, and the reference to segment seg_r would be level 17 (chain: seg_b > seg_c > ... > seg_q > seg_r). Retrying does not help. Copy the conditions of an inner segment into its parent instead of referencing it to reduce the nesting.",
"code": "SEGMENT_REFERENCE_DEPTH_EXCEEDED",
"title": "Segment references nested too deeply",
"description": "Segment references are nested too deeply. A segment filter can reference other segments up to 16 levels deep, and the reference to segment seg_r would be level 17 (chain: seg_b > seg_c > ... > seg_q > seg_r). Retrying does not help. Copy the conditions of an inner segment into its parent instead of referencing it to reduce the nesting.",
"howToFix": "Retrying does not help. Copy the conditions of an inner segment into its parent instead of referencing it to reduce the nesting.",
"docsUrl": "https://docs.sequenzy.com/api-reference/segments/count",
"details": {
"limit": "depth",
"segmentId": "seg_r",
"referenceChain": [
"seg_b",
"seg_c",
"seg_d",
"seg_e",
"seg_f",
"seg_g",
"seg_h",
"seg_i",
"seg_j",
"seg_k",
"seg_l",
"seg_m",
"seg_n",
"seg_o",
"seg_p",
"seg_q"
],
"maxDepth": 16,
"maxReferences": 1000
}
}
{
"success": false,
"error": "Unauthorized"
}
{
"success": false,
"error": "Segment not found"
}