Lucky Draw Tools
list_lucky_draws
Section titled “list_lucky_draws”List the event’s lucky draws with prize and run counts, plus filter_meta: the tiers, add-ons, approval statuses and select/radio/checkbox custom fields you can use in a draw’s entry_filters.
Access: Read | Scope: Event | Module: play
| Parameter | Type | Required | Description |
|---|---|---|---|
event_id |
integer | Yes | ID of the event to operate on (see list_events). Must belong to an organization your key can access. |
get_lucky_draw
Section titled “get_lucky_draw”One lucky draw: full config (eligibility entry_filters, winner count, rules), its prizes, and a summary of every run with its winners. is_sealed=true means a run has been committed, so the draw type, repeat-winner setting and prizes are locked and the draw can no longer be deleted.
Access: Read | Scope: Event | Module: play
| Parameter | Type | Required | Description |
|---|---|---|---|
event_id |
integer | Yes | ID of the event to operate on (see list_events). Must belong to an organization your key can access. |
lucky_draw_id |
integer | Yes | ID of the draw (see list_lucky_draws). |
create_lucky_draw
Section titled “create_lucky_draw”Create a lucky draw for the event (as Org > Event > Lucky Draw > New Draw). Omitted entry_filters keys take the web form defaults (approved attendees, unpaid excluded). Writes a draw_created row to the lucky-draw audit trail. Sends nothing. Add prizes with create_lucky_draw_prize (required for a Prize Draw).
Access: Write | Scope: Event | Module: play
| Parameter | Type | Required | Description |
|---|---|---|---|
event_id |
integer | Yes | ID of the event to operate on (see list_events). Must belong to an organization your key can access. |
name |
string | Yes | Draw name, e.g. “Grand Lucky Draw”. |
description |
string | No | Optional internal description. |
draw_type |
string | Yes | simple = Random Draw (winners picked from the pool by the sealed seed); prize_wheel = Prize Draw (the operator picks an entry and the wheel assigns one of the prizes). One of: simple, prize_wheel. |
entry_filters |
object | No | Eligibility rules for the pool. Keys: approval_statuses (array of approved|pending|rejected|invited|declined; default [“approved”]), exclude_unpaid (bool, default true: drops attendees whose payment_status is pending/failed/refunded/cancelled), checked_in (true = only checked-in, false = only not checked-in, null = either), tier_ids / addon_ids (arrays of IDs; see list_lucky_draws.filter_meta), registered_from / registered_to (YYYY-MM-DD), custom_fields (object form-field key => required option value; select/radio/checkbox fields only), include_group_members (bool: add group-booking guests as their own entries), exclude_previous_winners (bool: skip anyone who won an earlier run of this event). |
default_winner_count |
integer | No | How many winners a Random Draw run picks (1-1000). Clamped to the pool size at commit. |
allow_repeat_winners |
boolean | No | Prize Draw only: let one attendee win more than one prize (default false). |
disclosed_rules |
string | No | Public rules / terms of the draw. |
animation_style |
string | No | Animation on the conduct / projector screen. One of: wheel, reveal, slot. |
is_active |
boolean | No | Active flag (default true). Deactivate to hide a conducted draw instead of deleting it. |
update_lucky_draw
Section titled “update_lucky_draw”Update a lucky draw (partial: only the fields you pass change; entry_filters keys you pass replace the stored ones, omitted keys keep their stored values). Once a run is committed the draw type and repeat-winner setting are locked; name, description, rules, animation, filters and is_active stay editable (filters only affect future runs). Writes a config_changed audit row. Sends nothing.
Access: Write | Scope: Event | Module: play
| Parameter | Type | Required | Description |
|---|---|---|---|
event_id |
integer | Yes | ID of the event to operate on (see list_events). Must belong to an organization your key can access. |
lucky_draw_id |
integer | Yes | ID of the draw (see list_lucky_draws). |
name |
string | No | Draw name, e.g. “Grand Lucky Draw”. |
description |
string | No | Optional internal description. |
draw_type |
string | No | simple = Random Draw (winners picked from the pool by the sealed seed); prize_wheel = Prize Draw (the operator picks an entry and the wheel assigns one of the prizes). One of: simple, prize_wheel. |
entry_filters |
object | No | Eligibility rules for the pool. Keys: approval_statuses (array of approved|pending|rejected|invited|declined; default [“approved”]), exclude_unpaid (bool, default true: drops attendees whose payment_status is pending/failed/refunded/cancelled), checked_in (true = only checked-in, false = only not checked-in, null = either), tier_ids / addon_ids (arrays of IDs; see list_lucky_draws.filter_meta), registered_from / registered_to (YYYY-MM-DD), custom_fields (object form-field key => required option value; select/radio/checkbox fields only), include_group_members (bool: add group-booking guests as their own entries), exclude_previous_winners (bool: skip anyone who won an earlier run of this event). |
default_winner_count |
integer | No | How many winners a Random Draw run picks (1-1000). Clamped to the pool size at commit. |
allow_repeat_winners |
boolean | No | Prize Draw only: let one attendee win more than one prize (default false). |
disclosed_rules |
string | No | Public rules / terms of the draw. |
animation_style |
string | No | Animation on the conduct / projector screen. One of: wheel, reveal, slot. |
is_active |
boolean | No | Active flag (default true). Deactivate to hide a conducted draw instead of deleting it. |
delete_lucky_draw
Section titled “delete_lucky_draw”Delete a lucky draw with its prizes and any un-committed runs. Refused once a run has been committed (that compliance record must be kept; set is_active=false via update_lucky_draw instead). Cannot be undone.
Access: Write | Scope: Event | Module: play
| Parameter | Type | Required | Description |
|---|---|---|---|
event_id |
integer | Yes | ID of the event to operate on (see list_events). Must belong to an organization your key can access. |
lucky_draw_id |
integer | Yes | ID of the draw (see list_lucky_draws). |
confirm |
boolean | Yes | Must be true. Permanently deletes the draw. |
create_lucky_draw_prize
Section titled “create_lucky_draw_prize”Add a prize to a lucky draw. Refused once a run has been committed (prizes are locked). Set its picture with set_lucky_draw_prize_image. Writes a prize_changed audit row. Returns the draw’s prize list.
Access: Write | Scope: Event | Module: play
| Parameter | Type | Required | Description |
|---|---|---|---|
event_id |
integer | Yes | ID of the event to operate on (see list_events). Must belong to an organization your key can access. |
lucky_draw_id |
integer | Yes | ID of the draw (see list_lucky_draws). |
name |
string | Yes | Prize name, e.g. “iPad Air”. |
description |
string | No | Optional prize description. |
quantity |
integer | Yes | Units of this prize (1-100000). |
value |
number | No | Optional unit value in major currency units (e.g. 899.00). Currency follows the event country. |
update_lucky_draw_prize
Section titled “update_lucky_draw_prize”Update a prize (partial: only the fields you pass change; pass value=null to clear the value). Refused once a run has been committed. Writes a prize_changed audit row. Returns the draw’s prize list.
Access: Write | Scope: Event | Module: play
| Parameter | Type | Required | Description |
|---|---|---|---|
event_id |
integer | Yes | ID of the event to operate on (see list_events). Must belong to an organization your key can access. |
lucky_draw_id |
integer | Yes | ID of the draw (see list_lucky_draws). |
draw_prize_id |
integer | Yes | ID of the prize (see get_lucky_draw.prizes). |
name |
string | No | Prize name, e.g. “iPad Air”. |
description |
string | No | Optional prize description. |
quantity |
integer | No | Units of this prize (1-100000). |
value |
number | No | Optional unit value in major currency units (e.g. 899.00). Currency follows the event country. |
set_lucky_draw_prize_image
Section titled “set_lucky_draw_prize_image”Set (or replace) a prize’s picture, shown on the draw screen, the same as the prize form’s image upload: JPG, PNG or WebP, at most 5 MB, stored privately (image_url is a signed link that works without a login for 7 days; admins and the draw screen use their own session). Refused once a run has been committed. Writes a prize_changed audit row. Pass image_base64 + filename, or image_url. Returns the draw’s prize list.
Access: Write | Scope: Event | Module: play
| Parameter | Type | Required | Description |
|---|---|---|---|
event_id |
integer | Yes | ID of the event to operate on (see list_events). Must belong to an organization your key can access. |
lucky_draw_id |
integer | Yes | ID of the draw (see list_lucky_draws). |
draw_prize_id |
integer | Yes | ID of the prize (see get_lucky_draw.prizes). |
image_base64 |
string | No | The image file, base64-encoded (a data: URI prefix is accepted). Pass with filename. Use image_url instead for large files. |
filename |
string | No | File name for image_base64, e.g. “banner.jpg”. |
image_url |
string | No | Alternatively, a public https:// URL the server downloads the image from (no redirects to private addresses, 15 s timeout). |
delete_lucky_draw_prize
Section titled “delete_lucky_draw_prize”Delete a prize from a lucky draw. Refused once a run has been committed. Writes a prize_changed audit row. Returns the draw’s prize list.
Access: Write | Scope: Event | Module: play
| Parameter | Type | Required | Description |
|---|---|---|---|
event_id |
integer | Yes | ID of the event to operate on (see list_events). Must belong to an organization your key can access. |
lucky_draw_id |
integer | Yes | ID of the draw (see list_lucky_draws). |
draw_prize_id |
integer | Yes | ID of the prize (see get_lucky_draw.prizes). |
confirm |
boolean | Yes | Must be true. Permanently deletes the prize. |
get_lucky_draw_run
Section titled “get_lucky_draw_run”One run of a lucky draw: status (draft > prepared > committed > completed), pool count, commit hash, winners (with forfeits / replacements), the frozen pool entries (first 200), and the seed once the run is completed (so the result can be verified against the commit hash). Also returns conduct_url / present_url for the web conduct and projector screens.
Access: Read | Scope: Event | Module: play
| Parameter | Type | Required | Description |
|---|---|---|---|
event_id |
integer | Yes | ID of the event to operate on (see list_events). Must belong to an organization your key can access. |
lucky_draw_id |
integer | Yes | ID of the draw (see list_lucky_draws). |
draw_run_id |
integer | Yes | ID of the run (see get_lucky_draw.runs). |
create_lucky_draw_run
Section titled “create_lucky_draw_run”Start a new run (one sitting of the draw, e.g. “Dinner draw”). The run starts empty: call snapshot_lucky_draw_run next to freeze the eligible pool. Writes a run_created audit row. Sends nothing.
Access: Write | Scope: Event | Module: play
| Parameter | Type | Required | Description |
|---|---|---|---|
event_id |
integer | Yes | ID of the event to operate on (see list_events). Must belong to an organization your key can access. |
lucky_draw_id |
integer | Yes | ID of the draw (see list_lucky_draws). |
name |
string | Yes | Run name. |
scheduled_for |
string | No | Optional planned time, YYYY-MM-DDTHH:MM in the event timezone. |
snapshot_lucky_draw_run
Section titled “snapshot_lucky_draw_run”Freeze the eligible pool for a run from the draw’s current entry_filters (replaces any earlier snapshot and manual entries; allowed until the run is committed). Writes a pool_snapshot audit row. Returns the run with its pool.
Access: Write | Scope: Event | Module: play
| Parameter | Type | Required | Description |
|---|---|---|---|
event_id |
integer | Yes | ID of the event to operate on (see list_events). Must belong to an organization your key can access. |
lucky_draw_id |
integer | Yes | ID of the draw (see list_lucky_draws). |
draw_run_id |
integer | Yes | ID of the run (see get_lucky_draw.runs). |
add_lucky_draw_entry
Section titled “add_lucky_draw_entry”Add a manual entry (a name not tied to an attendee, e.g. a walk-in) to a run’s pool before commit. Note a later snapshot_lucky_draw_run rebuilds the pool and drops manual entries. Writes an entry_added audit row.
Access: Write | Scope: Event | Module: play
| Parameter | Type | Required | Description |
|---|---|---|---|
event_id |
integer | Yes | ID of the event to operate on (see list_events). Must belong to an organization your key can access. |
lucky_draw_id |
integer | Yes | ID of the draw (see list_lucky_draws). |
draw_run_id |
integer | Yes | ID of the run (see get_lucky_draw.runs). |
name |
string | Yes | Entry display name. |
remove_lucky_draw_entry
Section titled “remove_lucky_draw_entry”Remove one entry from a run’s pool before commit. Writes an entry_removed audit row.
Access: Write | Scope: Event | Module: play
| Parameter | Type | Required | Description |
|---|---|---|---|
event_id |
integer | Yes | ID of the event to operate on (see list_events). Must belong to an organization your key can access. |
lucky_draw_id |
integer | Yes | ID of the draw (see list_lucky_draws). |
draw_run_id |
integer | Yes | ID of the run (see get_lucky_draw.runs). |
draw_entry_id |
integer | Yes | ID of the entry (see get_lucky_draw_run.entries). |
confirm |
boolean | Yes | Must be true. |
commit_lucky_draw_run
Section titled “commit_lucky_draw_run”Seal a prepared run: generates the secret seed and publishes its commit hash, locks the pool, and locks the draw’s prizes, draw type and repeat-winner setting. Requires a snapshotted, non-empty pool (and at least one prize for a Prize Draw). Cannot be undone. Writes a committed audit row. Sends nothing.
Access: Write | Scope: Event | Module: play
| Parameter | Type | Required | Description |
|---|---|---|---|
event_id |
integer | Yes | ID of the event to operate on (see list_events). Must belong to an organization your key can access. |
lucky_draw_id |
integer | Yes | ID of the draw (see list_lucky_draws). |
draw_run_id |
integer | Yes | ID of the run (see get_lucky_draw.runs). |
confirm |
boolean | Yes | Must be true. Sealing is irreversible. |
draw_lucky_draw_winner
Section titled “draw_lucky_draw_winner”Draw the next winner of a committed run and record it permanently in the compliance record. Random Draw: picks the next entry in the sealed seed order (no entry_id). Prize Draw: pass entry_id (the attendee chosen on stage); a prize is assigned from those remaining. The run becomes completed once all winners / prizes are drawn. Only records the winner: no email, SMS or WhatsApp is sent. Writes a drawn audit row.
Access: Write | Scope: Event | Module: play
| Parameter | Type | Required | Description |
|---|---|---|---|
event_id |
integer | Yes | ID of the event to operate on (see list_events). Must belong to an organization your key can access. |
lucky_draw_id |
integer | Yes | ID of the draw (see list_lucky_draws). |
draw_run_id |
integer | Yes | ID of the run (see get_lucky_draw.runs). |
entry_id |
integer | No | Prize Draw only (required there): the pool entry receiving a prize (see get_lucky_draw_run.entries). |
replace_lucky_draw_winner
Section titled “replace_lucky_draw_winner”Random Draw only: forfeit a winner (e.g. absent) and promote the next sealed-rank entry into the same slot. The forfeited winner stays in the record. Writes winner_forfeited + drawn audit rows. Sends nothing.
Access: Write | Scope: Event | Module: play
| Parameter | Type | Required | Description |
|---|---|---|---|
event_id |
integer | Yes | ID of the event to operate on (see list_events). Must belong to an organization your key can access. |
lucky_draw_id |
integer | Yes | ID of the draw (see list_lucky_draws). |
draw_run_id |
integer | Yes | ID of the run (see get_lucky_draw.runs). |
draw_winner_id |
integer | Yes | ID of the winner to forfeit (see get_lucky_draw_run.winners). |
reason |
string | Yes | Why the winner is forfeited (kept in the audit trail). |
confirm |
boolean | Yes | Must be true. Forfeiting is irreversible. |
