Archive a Coupon List
curl --request PUT \
--url https://api-0{dc}.moengage.com/v1/coupon-list/{coupon_list_id}/archive \
--header 'Authorization: Basic <encoded-value>' \
--header 'MOE-APPKEY: <moe-appkey>'import requests
url = "https://api-0{dc}.moengage.com/v1/coupon-list/{coupon_list_id}/archive"
headers = {
"MOE-APPKEY": "<moe-appkey>",
"Authorization": "Basic <encoded-value>"
}
response = requests.put(url, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'MOE-APPKEY': '<moe-appkey>', Authorization: 'Basic <encoded-value>'}
};
fetch('https://api-0{dc}.moengage.com/v1/coupon-list/{coupon_list_id}/archive', 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-0{dc}.moengage.com/v1/coupon-list/{coupon_list_id}/archive",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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-0{dc}.moengage.com/v1/coupon-list/{coupon_list_id}/archive"
req, _ := http.NewRequest("PUT", url, nil)
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.put("https://api-0{dc}.moengage.com/v1/coupon-list/{coupon_list_id}/archive")
.header("MOE-APPKEY", "<moe-appkey>")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-0{dc}.moengage.com/v1/coupon-list/{coupon_list_id}/archive")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["MOE-APPKEY"] = '<moe-appkey>'
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"error": {
"code": "bad-request",
"message": "Possible issues include duplicates, such as coupon list names, invalid data types, or missing mandatory attributes."
}
}{
"error": {
"code": "request-unauthenticated",
"message": "Your request is unauthorized. Please verify your credentials and try again."
}
}{
"error": {
"code": "request-forbidden",
"message": "Your account does not have access to the Coupon Management features. Contact the MoEngage team for further assistance."
}
}{
"error": {
"code": "unexpected-error",
"message": "Something went wrong with your request. Please contact the MoEngage team for further assistance."
}
}Coupons List
Archive a Coupon List
This API transitions an active coupon list to an archived status. Upon archival, the coupon codes within the list are deleted. Consequently, any campaigns that were previously dependent on this list will no longer be able to utilize the dynamic coupon allocation.
PUT
/
coupon-list
/
{coupon_list_id}
/
archive
Archive a Coupon List
curl --request PUT \
--url https://api-0{dc}.moengage.com/v1/coupon-list/{coupon_list_id}/archive \
--header 'Authorization: Basic <encoded-value>' \
--header 'MOE-APPKEY: <moe-appkey>'import requests
url = "https://api-0{dc}.moengage.com/v1/coupon-list/{coupon_list_id}/archive"
headers = {
"MOE-APPKEY": "<moe-appkey>",
"Authorization": "Basic <encoded-value>"
}
response = requests.put(url, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'MOE-APPKEY': '<moe-appkey>', Authorization: 'Basic <encoded-value>'}
};
fetch('https://api-0{dc}.moengage.com/v1/coupon-list/{coupon_list_id}/archive', 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-0{dc}.moengage.com/v1/coupon-list/{coupon_list_id}/archive",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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-0{dc}.moengage.com/v1/coupon-list/{coupon_list_id}/archive"
req, _ := http.NewRequest("PUT", url, nil)
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.put("https://api-0{dc}.moengage.com/v1/coupon-list/{coupon_list_id}/archive")
.header("MOE-APPKEY", "<moe-appkey>")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-0{dc}.moengage.com/v1/coupon-list/{coupon_list_id}/archive")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["MOE-APPKEY"] = '<moe-appkey>'
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"error": {
"code": "bad-request",
"message": "Possible issues include duplicates, such as coupon list names, invalid data types, or missing mandatory attributes."
}
}{
"error": {
"code": "request-unauthenticated",
"message": "Your request is unauthorized. Please verify your credentials and try again."
}
}{
"error": {
"code": "request-forbidden",
"message": "Your account does not have access to the Coupon Management features. Contact the MoEngage team for further assistance."
}
}{
"error": {
"code": "unexpected-error",
"message": "Something went wrong with your request. Please contact the MoEngage team for further assistance."
}
}InformationVerify the usage of a given coupon list in active or planned campaigns before archiving it.
Rate Limit
You can archive 100 coupon lists per day.Authorizations
Uses Workspace ID as username and API Key as password.
Headers
This is the workspace ID (earlier APP ID) of your MoEngage workspace. The MOE-APPKEY has to be passed in the request. You can find your MoEngage Workspace ID in the MoEngage Dashboard: Settings -> Account -> APIs -> Workspace ID (earlier app id).
Path Parameters
The unique identifier for the coupon list.
Response
Success (No content) The request is successful, and the coupon list is archived.
Was this page helpful?