Fetch a Coupon List

This API allows you to retrieve the specifications of a particular coupon list. It includes information such as configurations, statuses, expiry dates, and alert conditions with real-time counts of added and currently available coupons. Using this API, you can easily access and manage critical data about individual coupon lists.

API Endpoint

API Endpoint
GET https://api-0X.moengage.com/v1/coupon-list/{{coupon_list_id}}

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.

Authentication

The API request will be authenticated through Basic Authentication. Basic Authentication sends a Base64-encoded string containing your username and password with every API request. It encodes a 'username: password' string in Base64 and appends the encoded string with 'Basic '. This string is included in the authorization header as shown below:

{"Authorization": "Basic Base64_ENCODED_APPKEY_APIKEY"}

You can obtain the username and password details from the MoEngage Dashboard.

  1. Navigate to Settings > Account > APIs.
  2. Copy the following details:
    • Username: Under Workspace ID (earlier App ID), click the copy icon to copy the username.
    • Password: In the API keys section, click the copy icon in the Campaign report/Business events/Custom templates/Catalog API tile to copy the API key.
  3. Use these details to authenticate the API requests.

Request Headers

Key Required Sample Values Description

Authorization

Required

{"Authorization": "Basic Base64_ENCODED_APPKEY_APIKEY"}

This authentication parameter, used for access control, must be passed in the request. To generate the authentication header, refer to Authentication.

MOE-APPKEY Required

{“MOE-APPKEY”: “Workspace ID”}

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)

For more information, refer to Authentication.

info

Information

There is no request body or content to send for this request except for headers and parameters.

Response

Status Key Data Type Description
Success

name

string

This field consists of the unique name of the coupon list.

label string

This field consists of the label name for the fetched coupon list.

expires_at string

This field consists of the expiry date of the coupon list in yyyy-mm-dd format.

status string

This field shows one of the following statuses of the fetched coupon list:

  • ACTIVE
  • EXPIRED
  • ARCHIVED
total_coupons integer

This field consists of the total number of coupons in the coupon list.

created_at string

This field consists of the date and time the coupon list was created.

updated_at string

This field consists of the date and time of the most recent update to the coupon list.

email_alert_subscribers string

This field consists of the email address of the coupon list subscriber.

alert_conditions JSON object

This field consists of the alert conditions and their statuses specified while creating the coupon list.

available_coupons integer

This field consists of the available number of coupons in coupon list.

personalization_snippet string

This field consists of the personalization snippet of the coupon list.

created_by string

This field consists of the user name who created the fetched coupon list.

_id string

This field contains the unique ID corresponding to a successful coupon list fetch request. This ID is also used to update and archive coupon lists.

Failure error code String

Each error codes are unique and serve as a shorthand representation for the type of error, providing a quick reference that can be used to diagnose, troubleshoot, and address the problem based on a predefined set of error conditions.

message String

Along with the error code, a detailed message is also provided in the response, describing the specifics of the request failure and the nature of the error.

Refer to the Sample Response section for examples.

Response Codes

Status Code Request State Description

200

Success

Indicates that the request is successful and the coupon list is fetched.

400

Bad request

Possible issues include duplicates, such as coupon list names, invalid data types, or missing mandatory attributes. For more information, refer to Error Messages.

401

Unauthenticated

Your request is unauthorized.

403

Forbidden

Your account does not have access to the Coupon Management features.

500

Internal server error

This response is returned when the system runs into an unexpected error.

Error Messages

Status Code Error code Description
401 request-unauthenticated Your request is unauthorized. Verify your credentials and try again.
403 request-forbidden Your account does not have access to the Coupon Management features. Contact the MoEngage team for further assistance.
500 unexpected-error Something went wrong with your request. Contact the MoEngage team for further assistance.

Sample cURL Request

cURL
curl --location 'https://api-0X.moengage.com/v1/coupon-list/{{coupon_list_id}}' \
--header 'MOE-APPKEY: {{Workspace_ID or APP_ID}}' \
--header 'Authorization: Basic {{Authorization_Key}}' \

Sample Response

200 401 403 500
{
  "name": "signup coupons",
  "label": "signup_coupons",
  "expires_at": "2024-10-26T18:29:00.000Z",
"status": "ACTIVE",
"total_coupons": 0,
"created_at": "2024-10-01T11:29:00.000Z", "updated_at": "2024-10-01T11:39:00.000Z", "email_alert_subscribers": [ "john.doe@example.com" ], "alert_conditions": { "success_alert": true, "failure_alert": true,
"expiry_alert": { "alert": true, "days_before": 100}, "coupon_shortage_alert": { "alert": true, "threshold_count": 100}
}, "available_coupons": 0, "personalization_snippet": "{{Coupons.CouponListName[signup_coupons]}}",
"created_by": "test_user", "_id": "{{coupon_list_id}}" }

Postman Collections

We have made it easy for you to test the APIs. Click here to view it in Postman.

Previous

Next

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

How can we improve this article?