Activate Coupon List
curl --request PUT \
--url https://api-0{dc}.moengage.com/v1/coupon-list/{coupon_list_id}/activate \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'MOE-APPKEY: <moe-appkey>' \
--data '
{
"expires_at": "2023-12-25"
}
'import requests
url = "https://api-0{dc}.moengage.com/v1/coupon-list/{coupon_list_id}/activate"
payload = { "expires_at": "2023-12-25" }
headers = {
"MOE-APPKEY": "<moe-appkey>",
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'MOE-APPKEY': '<moe-appkey>',
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/json'
},
body: JSON.stringify({expires_at: '2023-12-25'})
};
fetch('https://api-0{dc}.moengage.com/v1/coupon-list/{coupon_list_id}/activate', 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}/activate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'expires_at' => '2023-12-25'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-0{dc}.moengage.com/v1/coupon-list/{coupon_list_id}/activate"
payload := strings.NewReader("{\n \"expires_at\": \"2023-12-25\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("MOE-APPKEY", "<moe-appkey>")
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
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}/activate")
.header("MOE-APPKEY", "<moe-appkey>")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"expires_at\": \"2023-12-25\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-0{dc}.moengage.com/v1/coupon-list/{coupon_list_id}/activate")
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>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"expires_at\": \"2023-12-25\"\n}"
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. 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
Activate Coupon List
This API reactivates archived coupon lists, provided the expiry date is in the future.
PUT
/
coupon-list
/
{coupon_list_id}
/
activate
Activate Coupon List
curl --request PUT \
--url https://api-0{dc}.moengage.com/v1/coupon-list/{coupon_list_id}/activate \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'MOE-APPKEY: <moe-appkey>' \
--data '
{
"expires_at": "2023-12-25"
}
'import requests
url = "https://api-0{dc}.moengage.com/v1/coupon-list/{coupon_list_id}/activate"
payload = { "expires_at": "2023-12-25" }
headers = {
"MOE-APPKEY": "<moe-appkey>",
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'MOE-APPKEY': '<moe-appkey>',
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/json'
},
body: JSON.stringify({expires_at: '2023-12-25'})
};
fetch('https://api-0{dc}.moengage.com/v1/coupon-list/{coupon_list_id}/activate', 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}/activate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'expires_at' => '2023-12-25'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-0{dc}.moengage.com/v1/coupon-list/{coupon_list_id}/activate"
payload := strings.NewReader("{\n \"expires_at\": \"2023-12-25\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("MOE-APPKEY", "<moe-appkey>")
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
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}/activate")
.header("MOE-APPKEY", "<moe-appkey>")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"expires_at\": \"2023-12-25\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-0{dc}.moengage.com/v1/coupon-list/{coupon_list_id}/activate")
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>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"expires_at\": \"2023-12-25\"\n}"
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. 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."
}
}Information
- Only active coupon lists can be utilized in campaigns.
- If you need to modify the expiry date and activate a coupon list, you must use the Update a Coupon List API.
Rate Limit
You can activate 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.
Body
application/json
Add a new expiry date for the coupon list in yyyy-mm-dd format.
Note: Your request could fail if the mandatory attributes are absent from your payload.
Response
Success (No content) Coupon list activation is successful.
Was this page helpful?
⌘I