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
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. |
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 used in the request does not exist. | { "title": "Entity Not Found", "description": "Custom segment not found with the given name: <custom_segment_unique_name>" } |
HTTP 5xx | Failure | Server issue | { "title": "Internal Server Error", ... } |
Example
PATCH https://api-0X.moengage.com/v2/custom-segments/archive
Body
{
"name": "custom_segment_unique_name"
}
UnArchive Custom Segment
API Endpoint
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. |
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 used in the request does not exist. | { "title": "Entity Not Found", "description": "Custom segment not found with the given name: <custom_segment_unique_name>" } |
HTTP 5xx | Failure | Server issue | { "title": "Internal Server Error", ... } |
Example
PATCH https://api-0X
.moengage.com/v2/custom-segments/unarchive Body { "name": "custom_segment_unique_name" }