Get Custom Segment by ID
curl --request GET \
--url https://api-{dc}.moengage.com/v3/custom-segments/{id} \
--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/{id}"
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/{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 => "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/{id}"
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/{id}")
.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/{id}")
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
Get Custom Segment by ID
Fetches a specific custom segment (File or Filter) by its ID.
GET
/
v3
/
custom-segments
/
{id}
Get Custom Segment by ID
curl --request GET \
--url https://api-{dc}.moengage.com/v3/custom-segments/{id} \
--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/{id}"
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/{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 => "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/{id}"
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/{id}")
.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/{id}")
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 100 requests/minute, 1000 requests/hour, and 4000 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.
Path Parameters
The ID of the custom segment.
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?