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 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 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

200 OK

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

Error Responses

400 Bad Request - Missing Parameters
{ "Response": false, "Message": "Missing required parameters: sweepstakesToken and groupToken" }

400 Bad Request - Primary Group

{ "Response": false, "Message": "Cannot delete primary group" }

400 Bad Request - Locked Group

{ "Response": false, "Message": "Cannot delete locked group" }

400 Bad Request - Has Participants

{ "Response": false, "Message": "Cannot delete group with participants" }

400 Bad Request - Has AMOE

{ "Response": false, "Message": "Cannot delete group with AMOE entries" }

400 Bad Request - Has Optouts

{ "Response": false, "Message": "Cannot delete group with optouts" }

401 Unauthorized

{ "Response": false, "Message": "Invalid or Missing Bearer Token", "Code": 401 }

403 Forbidden

{ "Response": false, "Message": "Invalid API Token", "Code": 403 }

404 Not Found - Sweepstakes

{ "Response": false, "Message": "Sweepstakes not found or does not belong to user" }

404 Not Found - Group

{ "Response": false, "Message": "Group not found or does not belong to user" }