Sweeppea API v3

Delete Group

Delete an existing group from a sweepstakes. Groups can only be deleted if they are not primary, not locked, and have no associated participants, AMOE entries, or optouts.

POST https://api-v3.sweeppea.com/groups/delete

Description

This endpoint allows you to delete a group from a specific sweepstakes. The group must not be primary, must not be locked, and must not have any participants, AMOE entries, or optouts associated with it. Use this to manage your participants & groups data programmatically through the Sweeppea API.

Request Parameters

Parameter Casing: All request parameters are PascalCase. For backward compatibility, camelCase equivalents (e.g. sweepstakesToken) are also accepted.

Parameter Type Required Description
SweepstakesToken String (UUID v4) Required The UUID token of the sweepstakes where the group belongs
GroupToken String (UUID v4) Required The UUID token of the group to be deleted

Code Examples

curl -X POST "https://api-v3.sweeppea.com/groups/delete" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "SweepstakesToken": "uuid-v4-string",
    "GroupToken": "uuid-v4-string"
  }'

Response

{
  "Response": true,
  "Message": "Group deleted successfully"
}

Error Responses

400 Bad Request - Missing Parameters

{
  "Response": false,
  "Message": "Missing required parameters: SweepstakesToken and GroupToken"
}
{
  "Response": false,
  "Message": "Cannot delete primary group",
  "Help": {
    "ExpectedBody": {
      "SweepstakesToken": "string (required) \u2014 UUID v4 of the sweepstakes",
      "GroupToken": "string (required) \u2014 UUID v4 of the group. The primary group, a locked group, and any group still holding participants, AMOE entries or opt-outs cannot be deleted"
    }
  }
}
{
  "Response": false,
  "Message": "Cannot delete locked group",
  "Help": {
    "ExpectedBody": {
      "SweepstakesToken": "string (required) \u2014 UUID v4 of the sweepstakes",
      "GroupToken": "string (required) \u2014 UUID v4 of the group. The primary group, a locked group, and any group still holding participants, AMOE entries or opt-outs cannot be deleted"
    }
  }
}
{
  "Response": false,
  "Message": "Cannot delete group with participants",
  "Help": {
    "ExpectedBody": {
      "SweepstakesToken": "string (required) \u2014 UUID v4 of the sweepstakes",
      "GroupToken": "string (required) \u2014 UUID v4 of the group. The primary group, a locked group, and any group still holding participants, AMOE entries or opt-outs cannot be deleted"
    }
  }
}
{
  "Response": false,
  "Message": "Cannot delete group with AMOE entries",
  "Help": {
    "ExpectedBody": {
      "SweepstakesToken": "string (required) \u2014 UUID v4 of the sweepstakes",
      "GroupToken": "string (required) \u2014 UUID v4 of the group. The primary group, a locked group, and any group still holding participants, AMOE entries or opt-outs cannot be deleted"
    }
  }
}
{
  "Response": false,
  "Message": "Cannot delete group with optouts",
  "Help": {
    "ExpectedBody": {
      "SweepstakesToken": "string (required) \u2014 UUID v4 of the sweepstakes",
      "GroupToken": "string (required) \u2014 UUID v4 of the group. The primary group, a locked group, and any group still holding participants, AMOE entries or opt-outs cannot be deleted"
    }
  }
}
{
  "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": "Sweepstakes not found or does not belong to user"
}
{
  "Response": false,
  "Message": "Group not found or does not belong to user"
}
© Sweeppea. All rights reserved.