TagMangoTagMango Docs
Coupon

Deactivate Coupon

PATCH
/api/v1/external/coupons/{code}/deactivate

Deactivates one of your existing coupons by its code, so it can no longer be redeemed. This is the only way to turn a coupon off — editing a coupon always reactivates it. A coupon linked to a sale cannot be deactivated here, same as edit.

AuthorizationBearer <token>

In: header

Path Parameters

code*string

The coupon code to deactivate (case-insensitive).

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

application/json

curl -X PATCH "https://api-prod-new.tagmango.com/api/v1/external/coupons/WELCOME50/deactivate" \  -H "x-whitelabel-host: string"
{
  "_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",
  "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": "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
}