Segments
Update Segment
Update a saved subscriber segment
PATCH
/
api
/
v1
/
segments
/
{segmentId}
Update Segment
curl --request PATCH \
--url https://api.sequenzy.com/api/v1/segments/{segmentId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"filters": [
{}
],
"filterJoinOperator": "<string>",
"root": {}
}
'import requests
url = "https://api.sequenzy.com/api/v1/segments/{segmentId}"
payload = {
"name": "<string>",
"filters": [{}],
"filterJoinOperator": "<string>",
"root": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', filters: [{}], filterJoinOperator: '<string>', root: {}})
};
fetch('https://api.sequenzy.com/api/v1/segments/{segmentId}', 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}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'filters' => [
[
]
],
'filterJoinOperator' => '<string>',
'root' => [
]
]),
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://api.sequenzy.com/api/v1/segments/{segmentId}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"filters\": [\n {}\n ],\n \"filterJoinOperator\": \"<string>\",\n \"root\": {}\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.sequenzy.com/api/v1/segments/{segmentId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"filters\": [\n {}\n ],\n \"filterJoinOperator\": \"<string>\",\n \"root\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sequenzy.com/api/v1/segments/{segmentId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"filters\": [\n {}\n ],\n \"filterJoinOperator\": \"<string>\",\n \"root\": {}\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"segment": {
"id": "seg_active_non_buyers",
"name": "Active non-buyers - 30 days",
"filters": [
{
"id": "filter-1",
"field": "event",
"operator": "is_not",
"value": "saas.purchase:30d"
}
],
"filterJoinOperator": "and",
"format": "v2",
"root": {
"kind": "group",
"id": "root",
"joinOperator": "and",
"children": [
{
"kind": "filter",
"id": "filter-1",
"field": "event",
"operator": "is_not",
"value": "saas.purchase:30d"
}
]
}
}
}
{
"success": false,
"error": "Provide either root or filters, not both"
}
{
"success": false,
"error": "Operator \"is not\" is not supported for Tag filters. Use one of: contains, does not contain, is empty, is not empty."
}
{
"success": false,
"error": "Unauthorized"
}
{
"success": false,
"error": "Segment not found"
}
Update a segment name or filter definition. You can send either legacy
Stripe trial subfilters stay under
filters or a nested root, not both.
Request
Segment ID.
New segment name.
Legacy v1 filter array.
and or or for legacy v1 filters.Nested v2 filter group for nested logic, event filters, or segment filters.
field: "stripeTrialProduct":
prod_123:is_canceled, prod_123:end_at:2026-05-26, or
prod_123:start_at:7 days ago.
Every filter field validates its own operator set:
status,segment:is,is_nottag:contains,not_contains,is_empty,is_not_emptyemail:contains,not_containsemailProvider,list:is,is_not,is_empty,is_not_emptyfirstName,lastName:contains,not_contains,is_empty,is_not_emptyadded:less_than,more_thanattribute: equality, empty checks, numeric/date comparisons, and contains checksevent, email engagement fields:is,is_not,at_least,less_than_countemailBounced: also supportsis_temporary_bounce,is_permanent_bounce- Stripe product fields: product-specific purchase/current/trial/date operators
curl -X PATCH "https://api.sequenzy.com/api/v1/segments/seg_active_non_buyers" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Active non-buyers - 30 days",
"root": {
"kind": "group",
"id": "root",
"joinOperator": "and",
"children": [
{
"kind": "filter",
"id": "filter-1",
"field": "event",
"operator": "is_not",
"value": "saas.purchase:30d"
}
]
}
}'
Responses
{
"success": true,
"segment": {
"id": "seg_active_non_buyers",
"name": "Active non-buyers - 30 days",
"filters": [
{
"id": "filter-1",
"field": "event",
"operator": "is_not",
"value": "saas.purchase:30d"
}
],
"filterJoinOperator": "and",
"format": "v2",
"root": {
"kind": "group",
"id": "root",
"joinOperator": "and",
"children": [
{
"kind": "filter",
"id": "filter-1",
"field": "event",
"operator": "is_not",
"value": "saas.purchase:30d"
}
]
}
}
}
{
"success": false,
"error": "Provide either root or filters, not both"
}
{
"success": false,
"error": "Operator \"is not\" is not supported for Tag filters. Use one of: contains, does not contain, is empty, is not empty."
}
{
"success": false,
"error": "Unauthorized"
}
{
"success": false,
"error": "Segment not found"
}
⌘I
Update Segment
curl --request PATCH \
--url https://api.sequenzy.com/api/v1/segments/{segmentId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"filters": [
{}
],
"filterJoinOperator": "<string>",
"root": {}
}
'import requests
url = "https://api.sequenzy.com/api/v1/segments/{segmentId}"
payload = {
"name": "<string>",
"filters": [{}],
"filterJoinOperator": "<string>",
"root": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', filters: [{}], filterJoinOperator: '<string>', root: {}})
};
fetch('https://api.sequenzy.com/api/v1/segments/{segmentId}', 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}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'filters' => [
[
]
],
'filterJoinOperator' => '<string>',
'root' => [
]
]),
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://api.sequenzy.com/api/v1/segments/{segmentId}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"filters\": [\n {}\n ],\n \"filterJoinOperator\": \"<string>\",\n \"root\": {}\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.sequenzy.com/api/v1/segments/{segmentId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"filters\": [\n {}\n ],\n \"filterJoinOperator\": \"<string>\",\n \"root\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sequenzy.com/api/v1/segments/{segmentId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"filters\": [\n {}\n ],\n \"filterJoinOperator\": \"<string>\",\n \"root\": {}\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"segment": {
"id": "seg_active_non_buyers",
"name": "Active non-buyers - 30 days",
"filters": [
{
"id": "filter-1",
"field": "event",
"operator": "is_not",
"value": "saas.purchase:30d"
}
],
"filterJoinOperator": "and",
"format": "v2",
"root": {
"kind": "group",
"id": "root",
"joinOperator": "and",
"children": [
{
"kind": "filter",
"id": "filter-1",
"field": "event",
"operator": "is_not",
"value": "saas.purchase:30d"
}
]
}
}
}
{
"success": false,
"error": "Provide either root or filters, not both"
}
{
"success": false,
"error": "Operator \"is not\" is not supported for Tag filters. Use one of: contains, does not contain, is empty, is not empty."
}
{
"success": false,
"error": "Unauthorized"
}
{
"success": false,
"error": "Segment not found"
}