create_survey
Create a survey attached to a sweepstakes, optionally with its full question set. Use fetch_sweepstakes first to get the sweepstakes_token. Requires the Surveys module enabled on the account (disabled by default) — on 403 "module is not enabled", do NOT retry; tell the user to contact Sweeppea support. STRUCTURAL LIMITS: max 5 questions per page, 50 pages, 250 questions total, 30 options per question. Validation is all-or-nothing: any invalid question rejects the whole request and nothing is written. Pages are renumbered 1..N without gaps; question Order comes from array position. Visual configuration (Visuals, Pages, LogoFile) is managed in the web app and ignored here. To modify questions later use update_survey — only possible while the survey has no responses. DISPLAY RULE: never show SurveyToken/QuestionToken UUIDs; the PublicLink IS meant to be shared with participants.
create_survey
When to use
Create a survey attached to a sweepstakes, optionally with its full question set. Use fetch_sweepstakes first to get the sweepstakes_token. Requires the Surveys module enabled on the account (disabled by default) — on 403 "module is not enabled", do NOT retry; tell the user to contact Sweeppea support. STRUCTURAL LIMITS: max 5 questions per page, 50 pages, 250 questions total, 30 options per question. Validation is all-or-nothing: any invalid question rejects the whole request and nothing is written. Pages are renumbered 1..N without gaps; question Order comes from array position. Visual configuration (Visuals, Pages, LogoFile) is managed in the web app and ignored here. To modify questions later use update_survey — only possible while the survey has no responses. DISPLAY RULE: never show SurveyToken/QuestionToken UUIDs; the PublicLink IS meant to be shared with participants.
Pre-calls required
fetch_sweepstakesif the user gave you a sweepstakes name instead of a token
Parameters to validate before calling
sweepstakes_token(string, required) — The sweepstakes token (UUID v4) the survey belongs tosurvey_name(string, required) — Survey name (max 200 characters)status(boolean, optional) — Initial enabled state (optional, default true)settings(object, optional) — Optional settings object with PascalCase keys: Description, QuestionsPerPage (1-5), CollectContactInfo, ShowProgressBar, ShuffleQuestions, AllowMultipleResponses, ThankYouMessage, RedirectUrl, StartDate, EndDate, MaxResponses, ShowCountdown, EnableSharing, Language ("en"|"es")questions(array, optional) — Optional questions array with PascalCase keys per item: {"QuestionText" (required), "FieldType" (required: text|textarea|radio|checkbox|select|slider|rating|nps|yesno|date), "Page", "QuestionDescription", "Layout", "Required", "Options": [...max 30, each option is an object {"Label": "..."}], "Settings": {e.g. RatingMax, RatingIcon}}
Notes
Requires the Surveys module enabled on the account — on 403 "module is not enabled", do NOT retry; tell the user to contact Sweeppea support
Structural limits: 5 questions/page, 50 pages, 250 questions total, 30 options/question
Each Option is an object with a Label key, e.g. "Options": [{"Label": "Friend"}, {"Label": "Social media"}] — never plain strings
Validation is all-or-nothing: any invalid question rejects the whole request and nothing is written
Questions can only be replaced later (update_survey) while the survey has no responses
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | No | Initial enabled state (optional, default true) | |
| settings | No | Optional settings object with PascalCase keys: Description, QuestionsPerPage (1-5), CollectContactInfo, ShowProgressBar, ShuffleQuestions, AllowMultipleResponses, ThankYouMessage, RedirectUrl, StartDate, EndDate, MaxResponses, ShowCountdown, EnableSharing, Language ("en"|"es") | |
| questions | No | Optional questions array with PascalCase keys per item: {"QuestionText" (required), "FieldType" (required: text|textarea|radio|checkbox|select|slider|rating|nps|yesno|date), "Page", "QuestionDescription", "Layout", "Required", "Options": [...max 30], "Settings": {e.g. RatingMax, RatingIcon}} | |
| survey_name | Yes | Survey name (max 200 characters) | |
| sweepstakes_token | Yes | The sweepstakes token (UUID v4) the survey belongs to |