audience.segment.preview
curl --request POST \
--url https://platform.trylath.com/audience/segment/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"segmentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"definition": {
"all": [
{
"property": "<string>",
"value": "<string>"
}
],
"any": [
{
"property": "<string>",
"value": "<string>"
}
],
"none": [
{
"property": "<string>",
"value": "<string>"
}
]
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
segmentId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
definition: {
all: [{property: '<string>', value: '<string>'}],
any: [{property: '<string>', value: '<string>'}],
none: [{property: '<string>', value: '<string>'}]
}
})
};
fetch('https://platform.trylath.com/audience/segment/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://platform.trylath.com/audience/segment/preview"
payload = {
"segmentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"definition": {
"all": [
{
"property": "<string>",
"value": "<string>"
}
],
"any": [
{
"property": "<string>",
"value": "<string>"
}
],
"none": [
{
"property": "<string>",
"value": "<string>"
}
]
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://platform.trylath.com/audience/segment/preview"
payload := strings.NewReader("{\n \"segmentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"definition\": {\n \"all\": [\n {\n \"property\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"any\": [\n {\n \"property\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"none\": [\n {\n \"property\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"activityId": "<string>",
"result": {
"count": 0,
"sample": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "<string>",
"phone": "<string>",
"properties": {}
}
]
}
}audience.segment.preview
Counts the contacts a segment matches and returns a small sample, without sending anything. Pass a saved segmentId or an inline definition.
POST
/
audience
/
segment
/
preview
audience.segment.preview
curl --request POST \
--url https://platform.trylath.com/audience/segment/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"segmentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"definition": {
"all": [
{
"property": "<string>",
"value": "<string>"
}
],
"any": [
{
"property": "<string>",
"value": "<string>"
}
],
"none": [
{
"property": "<string>",
"value": "<string>"
}
]
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
segmentId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
definition: {
all: [{property: '<string>', value: '<string>'}],
any: [{property: '<string>', value: '<string>'}],
none: [{property: '<string>', value: '<string>'}]
}
})
};
fetch('https://platform.trylath.com/audience/segment/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://platform.trylath.com/audience/segment/preview"
payload = {
"segmentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"definition": {
"all": [
{
"property": "<string>",
"value": "<string>"
}
],
"any": [
{
"property": "<string>",
"value": "<string>"
}
],
"none": [
{
"property": "<string>",
"value": "<string>"
}
]
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://platform.trylath.com/audience/segment/preview"
payload := strings.NewReader("{\n \"segmentId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"definition\": {\n \"all\": [\n {\n \"property\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"any\": [\n {\n \"property\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"none\": [\n {\n \"property\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"activityId": "<string>",
"result": {
"count": 0,
"sample": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "<string>",
"phone": "<string>",
"properties": {}
}
]
}
}Authorizations
A Lath API key: lath_live_sk… or lath_test_sk… on a server, lath_live_pk… or lath_test_pk… in a browser.
Body
application/json
Last modified on September 13, 2026
Was this page helpful?

