Delete Claimed Coupon Endpoint
Releases a coupon the user claimed but never used. The code returns to the available pool and can be claimed again by anyone.
- Endpoint:
/api/v1/campaigns/coupons/{couponId} - Method:
DELETE - Authentication: Partner token and a signed-in user (Sanctum bearer token).
Headers
| Header | Value | Required | Description |
|---|---|---|---|
Partner-Access-Token | Base64 String | Yes | Your encrypted AES-256 time-sensitive token. |
Authorization | Bearer <token> | Yes | Sanctum token of the signed-in user. |
Accept | application/json | Yes |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
couponId | Integer | Yes | Coupon code row ID — the id from the claim response, or coupon_id from a coupon card. |
Sample Request
DELETE /api/v1/campaigns/coupons/9821
Partner-Access-Token: <your-generated-finalToken>
Authorization: Bearer <user-sanctum-token>
Accept: application/json
Sample Response
{
"result": 1,
"message": "Coupon deleted successfully.",
"data": []
}
Failure Responses
| Condition | Message |
|---|---|
| The ID does not exist, or the coupon belongs to another user | Coupon not found or does not belong to you. |
| The coupon was already redeemed, expired, or voided | Only claimed coupons that have not been used can be deleted. |
{
"result": 0,
"message": "Only claimed coupons that have not been used can be deleted."
}
Notes
- Nothing is deleted from the database. The row is reset to
not_issued, its owner andissued_atare cleared, and its expiry falls back to the campaign-level value. - Resetting the expiry matters for campaigns that count valid days from the claim date: keeping the previous holder's personal deadline would strand a code nobody ever used.
- Failures return HTTP 200 with
result: 0.