Segment Lists (dry-run)
Dry-run a segment query (sample rows)
Preview the rows a Segment List SQL query would match, without committing it to a list. Returns up to the top 10 matched rows for the columns selected. Use this to spot-check a query before creating a Segment List or committing a new version.
POST
/
v1
/
subscriber_list
/
~
/
dry_run
/
Dry-run (sample rows)
curl -X POST "https://hub.suprsend.com/v1/subscriber_list/~/dry_run/" \
--header 'Authorization: Bearer __YOUR_API_KEY__' \
--header 'Content-Type: application/json' \
--data '{
"query_text": "SELECT distinct_id, active_emails FROM users LIMIT 40"
}'import requests
url = "https://hub.suprsend.com/v1/subscriber_list/~/dry_run/"
payload = { "query_text": "SELECT distinct_id, active_emails FROM users LIMIT 40" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({query_text: 'SELECT distinct_id, active_emails FROM users LIMIT 40'})
};
fetch('https://hub.suprsend.com/v1/subscriber_list/~/dry_run/', 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://hub.suprsend.com/v1/subscriber_list/~/dry_run/",
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([
'query_text' => 'SELECT distinct_id, active_emails FROM users LIMIT 40'
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://hub.suprsend.com/v1/subscriber_list/~/dry_run/"
payload := strings.NewReader("{\n \"query_text\": \"SELECT distinct_id, active_emails FROM users LIMIT 40\"\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))
}HttpResponse<String> response = Unirest.post("https://hub.suprsend.com/v1/subscriber_list/~/dry_run/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query_text\": \"SELECT distinct_id, active_emails FROM users LIMIT 40\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://hub.suprsend.com/v1/subscriber_list/~/dry_run/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query_text\": \"SELECT distinct_id, active_emails FROM users LIMIT 40\"\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"distinct_id": "01KN7Q7NS31C01S6CR4Y9EDKPX",
"active_emails": []
},
{
"distinct_id": "01KN7Q7NS31C01S6CR4Y9EDKPT",
"active_emails": []
},
{
"distinct_id": "01KRWTYB7MX8B7HTK619XHMHJK",
"active_emails": []
}
]
}{
"code": 400,
"error_code": "error",
"type": "ValidationError",
"message": "{\"query_text\": \"Schema error: No field named name. Valid fields are users.distinct_id, users.created_at, users.updated_at, users.language, users.locale, users.timezone, users.user_properties, users.active_channels, users.active_emails, users.active_phone_numbers\"}",
"detail": {
"query_text": "Schema error: No field named name. Valid fields are users.distinct_id, users.created_at, users.updated_at, users.language, users.locale, users.timezone, users.user_properties, users.active_channels, users.active_emails, users.active_phone_numbers"
}
}Authorizations
Pass as Bearer <API_KEY>. Get API Key from SuprSend dashboard Developers -> API Keys section.
Body
application/json
The SQL query to preview. Must return a distinct_id column and reference only the users and events tables. See the Segment Lists doc for the dialect, available columns, and query rules.
Example:
"SELECT distinct_id, active_emails FROM users LIMIT 40"
Response
200
Up to the top 10 matched rows, each containing distinct_id and any additional columns you selected.
Show child attributes
Show child attributes
Was this page helpful?
Previous
Segment dry-run (count)Return the total number of users a [Segment List](/docs/segment-lists) SQL query would match, without returning the rows. Use this when you only need to size the audience.
Next
⌘I
Dry-run (sample rows)
curl -X POST "https://hub.suprsend.com/v1/subscriber_list/~/dry_run/" \
--header 'Authorization: Bearer __YOUR_API_KEY__' \
--header 'Content-Type: application/json' \
--data '{
"query_text": "SELECT distinct_id, active_emails FROM users LIMIT 40"
}'import requests
url = "https://hub.suprsend.com/v1/subscriber_list/~/dry_run/"
payload = { "query_text": "SELECT distinct_id, active_emails FROM users LIMIT 40" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({query_text: 'SELECT distinct_id, active_emails FROM users LIMIT 40'})
};
fetch('https://hub.suprsend.com/v1/subscriber_list/~/dry_run/', 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://hub.suprsend.com/v1/subscriber_list/~/dry_run/",
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([
'query_text' => 'SELECT distinct_id, active_emails FROM users LIMIT 40'
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://hub.suprsend.com/v1/subscriber_list/~/dry_run/"
payload := strings.NewReader("{\n \"query_text\": \"SELECT distinct_id, active_emails FROM users LIMIT 40\"\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))
}HttpResponse<String> response = Unirest.post("https://hub.suprsend.com/v1/subscriber_list/~/dry_run/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query_text\": \"SELECT distinct_id, active_emails FROM users LIMIT 40\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://hub.suprsend.com/v1/subscriber_list/~/dry_run/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query_text\": \"SELECT distinct_id, active_emails FROM users LIMIT 40\"\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"distinct_id": "01KN7Q7NS31C01S6CR4Y9EDKPX",
"active_emails": []
},
{
"distinct_id": "01KN7Q7NS31C01S6CR4Y9EDKPT",
"active_emails": []
},
{
"distinct_id": "01KRWTYB7MX8B7HTK619XHMHJK",
"active_emails": []
}
]
}{
"code": 400,
"error_code": "error",
"type": "ValidationError",
"message": "{\"query_text\": \"Schema error: No field named name. Valid fields are users.distinct_id, users.created_at, users.updated_at, users.language, users.locale, users.timezone, users.user_properties, users.active_channels, users.active_emails, users.active_phone_numbers\"}",
"detail": {
"query_text": "Schema error: No field named name. Valid fields are users.distinct_id, users.created_at, users.updated_at, users.language, users.locale, users.timezone, users.user_properties, users.active_channels, users.active_emails, users.active_phone_numbers"
}
}