curl --request PATCH \
--url https://api-{dc}.moengage.com/v3/custom-segments/{id} \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'MOE-APPKEY: <moe-appkey>' \
--data '
{
"name": "segment_example_name_updated",
"included_filters": {
"filter_operator": "and",
"filters": [
{
"filter_type": "user_attributes",
"name": "Name",
"data_type": "string",
"operator": "in",
"value": [
"chandan"
],
"negate": false,
"case_sensitive": false
}
]
},
"updated_by": "admin@example.com"
}
'import requests
url = "https://api-{dc}.moengage.com/v3/custom-segments/{id}"
payload = {
"name": "segment_example_name_updated",
"included_filters": {
"filter_operator": "and",
"filters": [
{
"filter_type": "user_attributes",
"name": "Name",
"data_type": "string",
"operator": "in",
"value": ["chandan"],
"negate": False,
"case_sensitive": False
}
]
},
"updated_by": "admin@example.com"
}
headers = {
"MOE-APPKEY": "<moe-appkey>",
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'MOE-APPKEY': '<moe-appkey>',
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'segment_example_name_updated',
included_filters: {
filter_operator: 'and',
filters: [
{
filter_type: 'user_attributes',
name: 'Name',
data_type: 'string',
operator: 'in',
value: ['chandan'],
negate: false,
case_sensitive: false
}
]
},
updated_by: 'admin@example.com'
})
};
fetch('https://api-{dc}.moengage.com/v3/custom-segments/{id}', 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-{dc}.moengage.com/v3/custom-segments/{id}",
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' => 'segment_example_name_updated',
'included_filters' => [
'filter_operator' => 'and',
'filters' => [
[
'filter_type' => 'user_attributes',
'name' => 'Name',
'data_type' => 'string',
'operator' => 'in',
'value' => [
'chandan'
],
'negate' => false,
'case_sensitive' => false
]
]
],
'updated_by' => 'admin@example.com'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json",
"MOE-APPKEY: <moe-appkey>"
],
]);
$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-{dc}.moengage.com/v3/custom-segments/{id}"
payload := strings.NewReader("{\n \"name\": \"segment_example_name_updated\",\n \"included_filters\": {\n \"filter_operator\": \"and\",\n \"filters\": [\n {\n \"filter_type\": \"user_attributes\",\n \"name\": \"Name\",\n \"data_type\": \"string\",\n \"operator\": \"in\",\n \"value\": [\n \"chandan\"\n ],\n \"negate\": false,\n \"case_sensitive\": false\n }\n ]\n },\n \"updated_by\": \"admin@example.com\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("MOE-APPKEY", "<moe-appkey>")
req.Header.Add("Authorization", "Basic <encoded-value>")
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-{dc}.moengage.com/v3/custom-segments/{id}")
.header("MOE-APPKEY", "<moe-appkey>")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"segment_example_name_updated\",\n \"included_filters\": {\n \"filter_operator\": \"and\",\n \"filters\": [\n {\n \"filter_type\": \"user_attributes\",\n \"name\": \"Name\",\n \"data_type\": \"string\",\n \"operator\": \"in\",\n \"value\": [\n \"chandan\"\n ],\n \"negate\": false,\n \"case_sensitive\": false\n }\n ]\n },\n \"updated_by\": \"admin@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-{dc}.moengage.com/v3/custom-segments/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["MOE-APPKEY"] = '<moe-appkey>'
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"segment_example_name_updated\",\n \"included_filters\": {\n \"filter_operator\": \"and\",\n \"filters\": [\n {\n \"filter_type\": \"user_attributes\",\n \"name\": \"Name\",\n \"data_type\": \"string\",\n \"operator\": \"in\",\n \"value\": [\n \"chandan\"\n ],\n \"negate\": false,\n \"case_sensitive\": false\n }\n ]\n },\n \"updated_by\": \"admin@example.com\"\n}"
response = http.request(request)
puts response.read_bodyUpdate Filter Segment
Updates an existing custom filter segment by its ID.
curl --request PATCH \
--url https://api-{dc}.moengage.com/v3/custom-segments/{id} \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'MOE-APPKEY: <moe-appkey>' \
--data '
{
"name": "segment_example_name_updated",
"included_filters": {
"filter_operator": "and",
"filters": [
{
"filter_type": "user_attributes",
"name": "Name",
"data_type": "string",
"operator": "in",
"value": [
"chandan"
],
"negate": false,
"case_sensitive": false
}
]
},
"updated_by": "admin@example.com"
}
'import requests
url = "https://api-{dc}.moengage.com/v3/custom-segments/{id}"
payload = {
"name": "segment_example_name_updated",
"included_filters": {
"filter_operator": "and",
"filters": [
{
"filter_type": "user_attributes",
"name": "Name",
"data_type": "string",
"operator": "in",
"value": ["chandan"],
"negate": False,
"case_sensitive": False
}
]
},
"updated_by": "admin@example.com"
}
headers = {
"MOE-APPKEY": "<moe-appkey>",
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'MOE-APPKEY': '<moe-appkey>',
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'segment_example_name_updated',
included_filters: {
filter_operator: 'and',
filters: [
{
filter_type: 'user_attributes',
name: 'Name',
data_type: 'string',
operator: 'in',
value: ['chandan'],
negate: false,
case_sensitive: false
}
]
},
updated_by: 'admin@example.com'
})
};
fetch('https://api-{dc}.moengage.com/v3/custom-segments/{id}', 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-{dc}.moengage.com/v3/custom-segments/{id}",
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' => 'segment_example_name_updated',
'included_filters' => [
'filter_operator' => 'and',
'filters' => [
[
'filter_type' => 'user_attributes',
'name' => 'Name',
'data_type' => 'string',
'operator' => 'in',
'value' => [
'chandan'
],
'negate' => false,
'case_sensitive' => false
]
]
],
'updated_by' => 'admin@example.com'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json",
"MOE-APPKEY: <moe-appkey>"
],
]);
$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-{dc}.moengage.com/v3/custom-segments/{id}"
payload := strings.NewReader("{\n \"name\": \"segment_example_name_updated\",\n \"included_filters\": {\n \"filter_operator\": \"and\",\n \"filters\": [\n {\n \"filter_type\": \"user_attributes\",\n \"name\": \"Name\",\n \"data_type\": \"string\",\n \"operator\": \"in\",\n \"value\": [\n \"chandan\"\n ],\n \"negate\": false,\n \"case_sensitive\": false\n }\n ]\n },\n \"updated_by\": \"admin@example.com\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("MOE-APPKEY", "<moe-appkey>")
req.Header.Add("Authorization", "Basic <encoded-value>")
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-{dc}.moengage.com/v3/custom-segments/{id}")
.header("MOE-APPKEY", "<moe-appkey>")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"segment_example_name_updated\",\n \"included_filters\": {\n \"filter_operator\": \"and\",\n \"filters\": [\n {\n \"filter_type\": \"user_attributes\",\n \"name\": \"Name\",\n \"data_type\": \"string\",\n \"operator\": \"in\",\n \"value\": [\n \"chandan\"\n ],\n \"negate\": false,\n \"case_sensitive\": false\n }\n ]\n },\n \"updated_by\": \"admin@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-{dc}.moengage.com/v3/custom-segments/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["MOE-APPKEY"] = '<moe-appkey>'
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"segment_example_name_updated\",\n \"included_filters\": {\n \"filter_operator\": \"and\",\n \"filters\": [\n {\n \"filter_type\": \"user_attributes\",\n \"name\": \"Name\",\n \"data_type\": \"string\",\n \"operator\": \"in\",\n \"value\": [\n \"chandan\"\n ],\n \"negate\": false,\n \"case_sensitive\": false\n }\n ]\n },\n \"updated_by\": \"admin@example.com\"\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
Basic Authentication using your Workspace ID (as username) and Data API Key (as password) from the MoEngage Dashboard.
Headers
The Workspace ID (APP ID) of your MoEngage account.
Path Parameters
The ID of the custom segment.
Body
The updated filter definition for the segment.
Request schema for updating an existing filter-based custom segment.
The updated filtering criteria for the segment. Users satisfying this set of filters will be part of the segment.
Show child attributes
Show child attributes
A new unique name for the custom segment.
Email of the user performing the update (e.g., admin@companyemail.com).
Response
Custom segment updated successfully. Returns the updated segment details including the new filter definition and metadata.
Was this page helpful?