TagMangoTagMango Docs
Analytics

Get Coupon Analytics Summary

GET
/api/v1/external/analytics/coupons/summary

Reports the size and health of the authenticated creator’s discount-coupon inventory: how many coupons exist, how many are switched on and not expired, and how many are switched off or expired.

Use this to render a coupon-inventory tile, or to decide whether to create more coupons before a campaign. It answers "how many coupons does this creator have?" — for "how much discount did they give away?", use Get Coupon Performance Analytics instead. This operation returns counts only; it never returns coupon codes, discount amounts, or the products a coupon applies to.

Scope. There is no creator to select: the response always covers the coupons of the creator you authenticated as. By default the count is all-time. Pass startDate and endDate together to restrict it to coupons created inside that window — note this filters on creation date, not on when a coupon is valid, so a coupon created last year and still running today is excluded from a window covering only today. Both bounds are inclusive, they must be sent as a pair, and they may be at most 90 days apart. Sending just one of the two is rejected rather than treated as open-ended.

What is counted. The three figures cover the coupons the creator dashboard itself lists. Excluded everywhere are the internal zero-cost checkout coupon, coupons whose code is empty, coupons with machine-generated UUID codes, and coupons created by TagMango’s historical product-migration backfill. Coupons that never expire and coupons that have run out of remaining uses are all counted in total.

Status semantics. active means only that the coupon is switched on and its expiry is at or after the request time; it does not check startAt or remaining uses, so it is not a guarantee that the coupon can be redeemed immediately. inactive means the coupon is switched off or already expired. These two figures can together be less than total: a coupon that is switched on and has no expiry date falls into neither. This mirrors the creator dashboard’s own status filters and is not a rounding artefact. Never derive one figure by subtracting the others.

Freshness. Analytics are served from TagMango’s reporting store rather than the live transactional one, so a coupon created or deactivated moments ago — including one you just created through the coupon API — may not be reflected yet, and no staleness bound is guaranteed. Two identical requests can therefore differ slightly as that store catches up; there is nothing to refresh.

Rejected date pairs. A lone bound, an unparseable value, an out-of-order pair, or a pair more than 90 days apart is rejected before any data is read, and every failing rule is reported at once rather than one at a time. The body carries the failures as a list of messages such as "End date is required when start date is provided" or "endDate must be on or after startDate and within 90 days".

AuthorizationBearer <token>

In: header

Query Parameters

startDate?string

Inclusive start of the window, as an ISO 8601 date-time, matched against the date each coupon was created. Coupons created at exactly this instant are counted. Omit both dates for an all-time count; if you send this you must also send endDate, and the two must be at most 90 days apart.

Formatdate-time
endDate?string

Inclusive end of the window, as an ISO 8601 date-time, matched against the date each coupon was created. Coupons created at exactly this instant are counted. Omit both dates for an all-time count; if you send this you must also send startDate.

Formatdate-time

Header Parameters

x-whitelabel-host*string

Host name of the dashboard, ex: mydomain.tagmango.com

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://api-prod-new.tagmango.com/api/v1/external/analytics/coupons/summary" \  -H "x-whitelabel-host: string"
{
  "total": 8,
  "active": 5,
  "inactive": 2
}
{
  "code": 400,
  "type": "Bad Request",
  "statusMessage": "BAD_REQUEST",
  "success": false,
  "message": "Invalid request",
  "result": "Invalid request"
}
{
  "code": 401,
  "type": "Unauthorized",
  "statusMessage": "UNAUTHORIZED",
  "message": "Invalid token",
  "result": "Invalid token",
  "success": false
}
{
  "code": 403,
  "type": "Forbidden",
  "statusMessage": "FORBIDDEN",
  "errorCode": "WORKSHOP_MANGO_FORBIDDEN",
  "message": "You can not access this api with a TagMango account, only available for whitelabel hosts",
  "result": "You can not access this api with a TagMango account, only available for whitelabel hosts",
  "success": false
}
{
  "code": 429,
  "type": "Too Many Requests",
  "statusMessage": "TOO_MANY_REQUESTS",
  "message": "Request limit exceeded. try after 10 seconds",
  "result": "Request limit exceeded. try after 10 seconds",
  "success": false
}