List Custom Segments
curl --request GET \
--url https://api-{dc}.moengage.com/v3/custom-segments \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: <content-type>' \
--header 'MOE-APPKEY: <moe-appkey>'import requests
url = "https://api-{dc}.moengage.com/v3/custom-segments"
headers = {
"Content-Type": "<content-type>",
"MOE-APPKEY": "<moe-appkey>",
"Authorization": "Basic <encoded-value>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {
'Content-Type': '<content-type>',
'MOE-APPKEY': '<moe-appkey>',
Authorization: 'Basic <encoded-value>'
}
};
fetch('https://api-{dc}.moengage.com/v3/custom-segments', 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",
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: Basic <encoded-value>",
"Content-Type: <content-type>",
"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"
"net/http"
"io"
)
func main() {
url := "https://api-{dc}.moengage.com/v3/custom-segments"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("MOE-APPKEY", "<moe-appkey>")
req.Header.Add("Authorization", "Basic <encoded-value>")
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-{dc}.moengage.com/v3/custom-segments")
.header("Content-Type", "<content-type>")
.header("MOE-APPKEY", "<moe-appkey>")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-{dc}.moengage.com/v3/custom-segments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = '<content-type>'
request["MOE-APPKEY"] = '<moe-appkey>'
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"data": [
{
"name": "api_test_7",
"id": "6388a97a02adb9071ca84ce9",
"created_time": "2022-12-01T13:17:46.409000",
"type": "ELASTIC_SEARCH",
"source": "API"
}
],
"response_id": "WYanfieM",
"type": "custom_segment"
}
Custom Segments - Filters
List Custom Segments
Lists all custom segments. Can optionally filter by an exact name match.
GET
/
v3
/
custom-segments
List Custom Segments
curl --request GET \
--url https://api-{dc}.moengage.com/v3/custom-segments \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: <content-type>' \
--header 'MOE-APPKEY: <moe-appkey>'import requests
url = "https://api-{dc}.moengage.com/v3/custom-segments"
headers = {
"Content-Type": "<content-type>",
"MOE-APPKEY": "<moe-appkey>",
"Authorization": "Basic <encoded-value>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {
'Content-Type': '<content-type>',
'MOE-APPKEY': '<moe-appkey>',
Authorization: 'Basic <encoded-value>'
}
};
fetch('https://api-{dc}.moengage.com/v3/custom-segments', 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",
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: Basic <encoded-value>",
"Content-Type: <content-type>",
"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"
"net/http"
"io"
)
func main() {
url := "https://api-{dc}.moengage.com/v3/custom-segments"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("MOE-APPKEY", "<moe-appkey>")
req.Header.Add("Authorization", "Basic <encoded-value>")
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-{dc}.moengage.com/v3/custom-segments")
.header("Content-Type", "<content-type>")
.header("MOE-APPKEY", "<moe-appkey>")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-{dc}.moengage.com/v3/custom-segments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = '<content-type>'
request["MOE-APPKEY"] = '<moe-appkey>'
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"data": [
{
"name": "api_test_7",
"id": "6388a97a02adb9071ca84ce9",
"created_time": "2022-12-01T13:17:46.409000",
"type": "ELASTIC_SEARCH",
"source": "API"
}
],
"response_id": "WYanfieM",
"type": "custom_segment"
}
Rate Limit
The rate limit is 50 request/minute, 200 requests/hour, and 1000 requests/day.
Authorizations
Basic Authentication using your Workspace ID (as username) and Data API Key (as password) from the MoEngage Dashboard.
Headers
Set the Content-Type header to application/json.
Example:
"application/json"
The Workspace ID (APP ID) of your MoEngage account.
Query Parameters
The URL-encoded name of the custom segment to retrieve.
Response
Successful retrieval of custom segments. Returns a list of custom segments matching the query criteria. An empty list is returned if no segments match.
Was this page helpful?