Sweeppea API v3

Create Rules

Create official rules for a specific sweepstakes. The first rule created will be marked as primary, subsequent rules will be secondary.

POST https://api-v3.sweeppea.com/rules/create

Description

This endpoint creates a new official rule document for a sweepstakes. The sweepstakes must exist and belong to the authenticated user. If no rules exist for the sweepstakes, the new rule will be marked as primary. Otherwise, it will be marked as secondary.

Authentication

This endpoint requires Bearer token authentication via the Authorization header.

Request Body

Parameter Type Required Max Length Description
SweepstakesToken String (UUID v4) Yes 36 The unique identifier of the sweepstakes
Title String Yes 100 The title of the official rules
DocumentContent String Yes 1,000,000 The full HTML content of the official rules

Code Examples

curl -X POST "https://api-v3.sweeppea.com/rules/create" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "SweepstakesToken": "YOUR_SWEEPSTAKES_TOKEN",
    "Title": "Official Rules",
    "DocumentContent": "

Full HTML content of official rules...

" }'

Response

{
  "Response": true,
  "Data": {
    "RulesToken": "bc225a85-c16f-4339-a1d6-d0c6d62fa18d",
    "SweepstakesToken": "1770a839-abeb-42b4-b003-888073ba1e9b",
    "Title": "Test Rule Primary",
    "Primary": true,
    "CreationDate": "2026-01-23T11:30:22.979Z"
  }
}

Error Responses

{
  "Response": false,
  "Message": "SweepstakesToken is Required",
  "Help": {
    "ExpectedBody": {
      "SweepstakesToken": "string (required) \u2014 UUID v4 of the sweepstakes",
      "Title": "string (required) \u2014 rules title, max 100 characters",
      "DocumentContent": "string (required) \u2014 rules body, max 1,000,000 characters"
    }
  },
  "Code": 400
}
{
  "Response": false,
  "Message": "Title is Required",
  "Help": {
    "ExpectedBody": {
      "SweepstakesToken": "string (required) \u2014 UUID v4 of the sweepstakes",
      "Title": "string (required) \u2014 rules title, max 100 characters",
      "DocumentContent": "string (required) \u2014 rules body, max 1,000,000 characters"
    }
  },
  "Code": 400
}
{
  "Response": false,
  "Message": "DocumentContent is Required",
  "Help": {
    "ExpectedBody": {
      "SweepstakesToken": "string (required) \u2014 UUID v4 of the sweepstakes",
      "Title": "string (required) \u2014 rules title, max 100 characters",
      "DocumentContent": "string (required) \u2014 rules body, max 1,000,000 characters"
    }
  },
  "Code": 400
}
{
  "Response": false,
  "Message": "Title exceeds maximum length of 100 characters",
  "Help": {
    "ExpectedBody": {
      "SweepstakesToken": "string (required) \u2014 UUID v4 of the sweepstakes",
      "Title": "string (required) \u2014 rules title, max 100 characters",
      "DocumentContent": "string (required) \u2014 rules body, max 1,000,000 characters"
    }
  },
  "Code": 400
}
{
  "Response": false,
  "Message": "DocumentContent exceeds maximum length of 1000000 characters",
  "Help": {
    "ExpectedBody": {
      "SweepstakesToken": "string (required) \u2014 UUID v4 of the sweepstakes",
      "Title": "string (required) \u2014 rules title, max 100 characters",
      "DocumentContent": "string (required) \u2014 rules body, max 1,000,000 characters"
    }
  },
  "Code": 400
}
{
  "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",
  "Code": 404
}
{
  "Response": false,
  "Message": "Internal server error. Please try again; if it persists, contact support with the time of this request.",
  "Code": 500
}
© Sweeppea. All rights reserved.