Archive and UnArchive an Existing Custom Segment

Archiving and unarchiving through APIs makes it easy to retrieve and reuse custom segments whenever required for purposes such as A/B testing, maintaining regulatory compliance, and improving system performance. You can access the archived segments and utilize them to analyze and market campaigns without the need to recreate them from scratch.

In this article, we will learn how MoEngage enables you to archive and unarchive both File and Filter segments using APIs.

warning

Warning

Archived segments will not be shown beyond 180 days.

Archive Custom Segment

API Endpoint

URL
PATCH https://api-0X.moengage.com/v2/custom-segments/archive

Each customer is hosted on a different data center, you can find your data center number (value of X), by checking the data center and API endpoint mapping page here.

Request Body

Parameter Mandatory Description
name Yes The name of the custom segment to be archived.
segment_id No Contains the unique identifier corresponding to the request segment. When both segment_id and name are populated, the system prioritizes segment_id.

Use callbacks, emails, or both for better visibility and end-to-end integration capability.

Response

Status Code Request State Description Response Body
HTTP 202 Success Custom-segment creation request accepted. { "message": "Successfully archived the custom segment", "success": true, "cs_name": <custom_segment_unique_name> }
HTTP 400 Failure Invalid custom-segment request(invalid payload format). { "title": "Invalid Request", "description": <message> }
HTTP 401 Failure Authentication or Authorization Failure. Invalid key or Secretor Database Name or Authorization Header. { "title": "Authentication required", "description": <message> }
HTTP 404 Failure The custom-segment name or segment_id used in the request does not exist. {
   "title": "Entity Not Found",
   "description": "Custom segment not found for the given name or cs_id: <either name or the cs_id>"
}
HTTP 5xx Failure Server issue { "title": "Internal Server Error", ... }

Example

HTTP
PATCH https://api-0X.moengage.com/v2/custom-segments/archive
Body
{
  "name": "custom_segment_unique_name"
}

UnArchive Custom Segment

API Endpoint

URL
PATCH https://api-0X.moengage.com/v2/custom-segments/unarchive

Each customer is hosted on a different data center, you can find your data center number (value of X), by checking the data center and API endpoint mapping page here.

Request Body

Parameter Mandatory Description
name Yes The name of the custom segment not archived.
segment_id No Contains the unique identifier corresponding to the request segment. When both segment_id and name are populated, the system prioritizes segment_id.

Use callbacks, emails, or both for better visibility and end-to-end integration capability.

Response

Status Code Request State Description Response Body
HTTP 202 Success Custom-segment creation request accepted. { "message": "Successfully unarchived the custom segment", "success": true, "cs_name": <custom_segment_unique_name> }
HTTP 400 Failure Invalid custom-segment request(invalid payload format). { "title": "Invalid Request", "description": <message> }
HTTP 401 Failure Authentication or Authorization Failure. Invalid key or Secretor Database Name or Authorization Header. { "title": "Authentication required", "description": <message> }
HTTP 404 Failure The custom-segment name or segment_id used in the request does not exist. {
   "title": "Entity Not Found",
   "description": "Custom segment not found for the given name or cs_id: <either name or the cs_id>"
}
HTTP 5xx Failure Server issue { "title": "Internal Server Error", ... }

Example

URL
PATCH https://api-0X.moengage.com/v2/custom-segments/unarchive Body { "name": "custom_segment_unique_name" }

Previous

Next

Was this article helpful?
0 out of 0 found this helpful

How can we improve this article?