generate_codes
Generate 1 to 5,000 unique random codes with a chosen length, character set, case, prefix and suffix. Use this when Sweeppea should invent the codes; use create_codes when the user already has them. prefix + length + suffix must not exceed 20 characters in total. NOTE: here the character set is the STRING type ("alphanumeric" or "numeric"); the same concept in update_code_settings is the INTEGER coupon_code_type (1 numeric, 2 alphanumeric). They are two encodings of one idea — do not copy a value from one tool to the other. Requires the Codes & Coupons module enabled on the account — on 403 "module not enabled", do NOT retry; tell the user to contact Sweeppea support.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| case | No | upper, lower or mixed (alphanumeric only). Defaults to upper | |
| type | No | Character set. Defaults to alphanumeric. A STRING here — not the integer used by update_code_settings | |
| value | No | Applied to every code, max 10 characters (e.g. $10, 15%) | |
| length | Yes | Random characters per code, 4 to 20. prefix + length + suffix must not exceed 20 | |
| prefix | No | Letters, digits, - or _ placed before every code | |
| suffix | No | Letters, digits, - or _ placed after every code | |
| quantity | Yes | How many codes to generate, 1 to 5000 | |
| description | No | Applied to every code, max 5,000 characters | |
| external_url | No | https:// link applied to every code, max 500 characters | |
| expiration_date | No | YYYY-MM-DD, not in the past | |
| expiration_time | No | HH:mm, 24-hour clock | |
| sweepstakes_token | Yes | The sweepstakes token (UUID v4) of a sweepstakes of your account |