Lottery (Draw) API
Draws provide random selection functionality where winners are selected from entered consumers at a scheduled time.Get Draw
Retrieve draw details and current status.GET /api/v1/draws/:drawId
Authentication
- Publishable key required
- Consumer authentication not required
Path Parameters
| Parameter | Type | Description |
|---|---|---|
drawId | string | The draw ID |
Response
Example
Error Responses
| Status | Error | Description |
|---|---|---|
| 404 | Draw not found | The draw ID does not exist |
Enter Draw
Enter a draw for a chance to win.POST /api/v1/draws/:drawId/enter
Authentication
- Publishable key required
- Consumer authentication required
Headers
| Header | Required | Description |
|---|---|---|
X-Fingerprint | Recommended | Device fingerprint for bot mitigation |
Path Parameters
| Parameter | Type | Description |
|---|---|---|
drawId | string | The draw ID |
Response
Example
Error Responses
| Status | Error | Description |
|---|---|---|
| 400 | Draw is closed | Entry period has ended |
| 401 | Authentication required | Missing consumer authentication |
| 404 | Draw not found | The draw ID does not exist |
| 423 | Draw is not open yet | Draw opens in the future |
Special Headers on Error
| Header | Value | Description |
|---|---|---|
Retry-After | ISO timestamp | When to retry (for 423) |
X-Fingerprint-Error | true | Fingerprint validation failed |
Denied Entry Response
If the consumer is denied entry (e.g., order limit exceeded):Leave Draw
Withdraw from a draw before the drawing takes place.POST /api/v1/draws/:drawId/leave
Authentication
- Publishable key required
- Consumer authentication required
Path Parameters
| Parameter | Type | Description |
|---|---|---|
drawId | string | The draw ID |
Response
ReturnsDrawConsumerState with status DENIED (treated as self-removal).
Example
Get Draw Status
Get the consumer’s current entry status.GET /api/v1/draws/:drawId/status
Authentication
- Publishable key required
- Consumer authentication required
Path Parameters
| Parameter | Type | Description |
|---|---|---|
drawId | string | The draw ID |
Response
ReturnsDrawConsumerState with current status.
Example
Complete Draw Win (Server-Side)
Complete a draw win and mark the consumer as having claimed their prize.POST /api/v1/draws/:drawId/complete
Authentication
- Secret key required
Path Parameters
| Parameter | Type | Description |
|---|---|---|
drawId | string | The draw ID |
Request Body
Example
Deny Consumer (Server-Side)
Deny a consumer from the draw.POST /api/v1/draws/:drawId/deny
Authentication
- Secret key required
Path Parameters
| Parameter | Type | Description |
|---|---|---|
drawId | string | The draw ID |
Request Body
Deny Reasons
| Reason | Description |
|---|---|
ORDER_LIMIT_EXCEEDED | Consumer has exceeded order limits |
DRAW_CLOSED | Consumer left or draw was closed |
FRAUD_DETECTED | Suspicious activity detected |
ADMIN_ACTION | Manual denial by administrator |
Example
Validate Win Token (Server-Side)
Validate that a consumer has won and their token is valid.POST /api/v1/draws/:drawId/validate
Authentication
- Secret key required
Path Parameters
| Parameter | Type | Description |
|---|---|---|
drawId | string | The draw ID |
Request Body
Response
Returnstrue if the consumer is a valid winner, or an error object with details.
Example
Draw Consumer Statuses
| Status | Description |
|---|---|
ENTERED | Consumer has entered the draw |
WON | Consumer was selected as a winner |
COMPLETED | Winner has claimed their prize |
LOST | Consumer was not selected |
DENIED | Consumer was denied entry or left |
Draw Lifecycle
- Pending: Draw created but not yet open for entries
- Open: Entry period is active
- Closed: Entry period ended, awaiting draw
- Drawn: Winners have been selected