Edit Coupon
Edit one of your existing coupons by its code. Every field in the body is optional and only touches what you send — omitted fields are left unchanged. code, currency, and type cannot be changed directly — type is always derived from mangoes (see that field's description). Setting percentageDiscount always clears any flatDiscount already on the coupon. A coupon linked to a sale cannot be edited here. Every successful edit reactivates the coupon (active is always set to true) — use the deactivate endpoint to turn one off. Changing mangoes, a discount field, startAt/validTill, or targetMangoes/targetUsers re-runs the same checks coupon creation does — mango eligibility, mango-currency consistency (every mango must be priced in the coupon's own, immutable currency), the plan-based discount cap, the 5-minute validTill/startAt gap, and the target-user subscription check — validated against whichever side of each check you are not touching in this request (the coupon's current stored value). Fields you leave out of the request are never re-validated.
Authorization
bearer In: header
Path Parameters
The coupon code to edit (case-insensitive).
Header Parameters
Host name of the dashboard, ex: mydomain.tagmango.com
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X PUT "https://api-prod-new.tagmango.com/api/v1/external/coupons/WELCOME50" \ -H "x-whitelabel-host: string" \ -H "Content-Type: application/json" \ -d '{}'{
"_id": "66a1390268a76f2f5c9f39a3",
"code": "WELCOME50",
"type": "creator_discount_coupon",
"creator": "77b2390268a76f2f5c9f39a4",
"startAt": "2024-08-11T10:20:30Z",
"validTill": "2024-12-31T23:59:59Z",
"active": true,
"flatDiscount": 100,
"percentageDiscount": 10,
"remainingOrder": 50,
"totalUsage": 5,
"currency": "INR",
"createdAt": "2024-08-11T10:20:30Z",
"updatedAt": "2024-08-11T10:20:30Z",
"mangoes": [
"64fbc8d765c6e5b324d45678"
],
"targetMangoes": [
"64fbc8d765c6e5b324d45678"
],
"targetUsers": [
"64fbc8d765c6e5b324d67890"
]
}{
"code": 400,
"type": "Bad Request",
"statusMessage": "BAD_REQUEST",
"errorCode": "COUPON_MANGO_NOT_ELIGIBLE",
"message": "A coupon can only target a one-time-priced mango — free, zero-cost, open-ended, and recurring (subscription) mangoes can never redeem a coupon, so one cannot be created for them.",
"result": "A coupon can only target a one-time-priced mango — free, zero-cost, open-ended, and recurring (subscription) mangoes can never redeem a coupon, so one cannot be created for them.",
"success": false
}{
"code": 401,
"type": "Unauthorized",
"statusMessage": "UNAUTHORIZED",
"message": "Invalid token",
"result": "Invalid token",
"success": false
}{
"code": 403,
"type": "Forbidden",
"statusMessage": "FORBIDDEN",
"errorCode": "COUPON_SALE_LINKED_NOT_EDITABLE",
"message": "A coupon created as part of a sale/sale-item cannot be edited through this endpoint.",
"result": "A coupon created as part of a sale/sale-item cannot be edited through this endpoint.",
"success": false
}{
"code": 404,
"type": "Not Found",
"statusMessage": "NOT_FOUND",
"errorCode": "COUPON_NOT_FOUND",
"message": "No coupon with this code exists among your own coupons.",
"result": "No coupon with this code exists among your own coupons.",
"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
}