Sweeppea API v3

Unredeem Code

Reverse a redemption made by mistake.

POST https://api-v3.sweeppea.com/codes/unredeem

Description

This endpoint returns a redeemed code to status not-redeemed and clears its redemption date and time. Only a code that is redeemed changes — a voided code can never be brought back into circulation this way. The participant assignment, if any, is kept.

Authentication

This endpoint requires Bearer token authentication via the Authorization header. Because it changes data, the Codes & Coupons module must also be enabled for your account.

Request Body

Field Type Required Description
CouponToken String Yes UUID v4 of a redeemed code

Code Examples

curl -X POST "https://api-v3.sweeppea.com/codes/unredeem" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
        "CouponToken": "uuid-v4-string"
    }'

Response

{
  "Response": true,
  "Telemetry": {
    "DataConsumed": 0,
    "APICalls": 312,
    "MaxAPICalls": 1500000
  },
  "Data": {
    "Code": {
      "CouponToken": "uuid-v4-string",
      "SweepstakesToken": "uuid-v4-string",
      "CouponCode": "SUMMER-7QK2P9",
      "Description": "$10 off your next order",
      "Value": "$10",
      "ExternalURL": "https://shop.example.com/redeem",
      "ExpirationDate": "2026-12-31T00:00:00.000Z",
      "ExpirationTime": "23:59",
      "Status": "not-redeemed",
      "ParticipantToken": "uuid-v4-string",
      "AssignedTo": null,
      "RedemptionDate": null,
      "RedemptionTime": null,
      "CreationDate": "2026-09-20T14:02:11.004Z"
    }
  },
  "Message": "Redemption reversed"
}

Response Fields

Field Type Description
Code Object The code after the reversal (same fields as Fetch Single Code), Status: "not-redeemed". AssignedTo is null in this response

Error Responses

{
  "Response": false,
  "Message": "Missing required parameter: CouponToken",
  "Code": 400,
  "Help": {
    "ExpectedBody": {
      "CouponToken": "string (required) — UUID v4 of a redeemed code",
      "CalledFromMCP": "boolean (optional) — Set by the MCP server, ignore it",
      "CalledFromCLI": "boolean (optional) — Set by the CLI, ignore it"
    }
  }
}
{
  "Response": false,
  "Message": "Code not found. It must exist and belong to your account.",
  "Code": 404
}
{
  "Response": false,
  "Message": "This code is not redeemed (status \"voided\").",
  "Code": 409,
  "Data": {
    "Status": "voided"
  }
}
{
  "Response": false,
  "Message": "Missing or invalid Bearer token. Send your API token in the Authorization header as: Authorization: Bearer YOUR_API_TOKEN",
  "Code": 401
}
{
  "Response": false,
  "Message": "Invalid API token. It does not match any account.",
  "Code": 403
}
{
  "Response": false,
  "Message": "The Codes & Coupons module is not enabled for your account. Contact support to enable it.",
  "Code": 403
}
{
  "Response": false,
  "Message": "Rate limit exceeded. Your plan allows 60 API calls per minute. Wait a few seconds and try again.",
  "Code": 429
}
{
  "Response": false,
  "Message": "Internal server error. Please try again; if it persists, contact support with the time of this request.",
  "Code": 500
}

Every 400 carries a Help.ExpectedBody block listing every accepted parameter. A disabled or hibernating account and an exhausted monthly API quota answer 403; the per-minute limit answers 429 — see Concurrency & Rate Limiting.

Important Notes

  • Requires the Codes & Coupons module on the account (403 otherwise).
  • Writes an entry to the account log at level 2, prefixed [ API v3 ].
  • Every 200 response carries Telemetry with your API calls this month (APICalls) and the plan maximum (MaxAPICalls).
  • Purging all the codes of a sweepstakes, removing duplicates and importing codes from a CSV file stay in the Sweeppea app. Every write endpoint of this category requires the Codes & Coupons module; reads do not.
© Sweeppea. All rights reserved.