Create Lottery Activity
Updated: 2026-04-09 14:17:35
API Description
1、创建抽奖活动
2、接口支持https协议
API URL
http://api.polyv.net/live/v4/channel/lottery-activity/create
Request Method
POST
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details
- If parameters are incorrect, a 400 error will be returned.
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See details on obtaining keys |
| timestamp | true | Long | Current 13-digit millisecond timestamp, valid for 3 minutes |
| sign | true | String | Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must not be stored or used directly on the client side. All APIs must be called through the customer's own server to relay requests to the POLYV server to obtain response data. See signature generation rules |
| channelId | true | Integer | Channel ID |
Request Body Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| activityName | true | String | Lottery activity name |
| lotteryCondition | true | String | Lottery activity type: none (unconditional), invite (invite friends), duration (watch duration), comment (comment lottery), question (quiz lottery) |
| amount | true | Integer | Number of winners |
| hiddenWinnerAmount | false | String | Whether to hide the number of winners, values: Y/N, default N |
| lotteryRange | false | String | User type for lottery participation: all (all users), customGroup (custom groups) |
| customGroupIds | false | Array | Custom group IDs, valid when lottery user type is custom group |
| customGroupLotteryType | false | String | Group drawing method: average (equal lottery), random (random lottery) |
| customGroupLotteryAmount | false | Integer | Number of draws per group |
| hiddenAttendeeNumber | false | String | Whether to hide the number of participants, values: Y/N, default N |
| repeatWinEnabled | false | String | Allow repeated winning, values: Y/N, default N |
| receiveEnabled | false | String | Whether to fill in shipping information, values: Y/N, default N |
| receiveInfo | false | Array | Shipping field information list, filled in for unconditional lottery See ReceiveInfo |
| prizeName | true | String | Prize name |
| thumbnail | false | String | Prize image |
| activityDuration | false | String | Activity duration, required for non-unconditional lotteries |
| activityDurationType | false | String | Activity duration unit (second, minute, hour), default minute. second is only supported when lotteryCondition is none |
| inviteType | false | String | Invitation method: poster (invitation poster), external (external invitation), required for invitation lottery |
| externalListLink | false | String | External list link, required for invitation lottery with external invitation method |
| externalInviteNumLink | false | String | Link to get invitation count, required for invitation lottery with external invitation method |
| inviteNum | false | Integer | Number of invitations, required for invitation lottery |
| duration | false | Integer | Watch duration, required for watch duration lottery |
| comment | false | String | Comment content, required for comment lottery |
| acceptType | false | String | Prize claim method: form (form), link (external link), qrCode (QR code), required for non-unconditional and non-quiz lotteries |
| formInfo | false | Array | Form field information for prize claim method, filled in when method is form See ReceiveInfo |
| prizeUrl | false | String | Prize link for prize claim method, required when method is external link |
| qrCode | false | String | QR code link for prize claim method, required when method is QR code |
| qrCodeTips | false | String | QR code prompt text for prize claim method, filled in when method is QR code |
| realPrice | false | BigDecimal | Discounted price |
| price | false | BigDecimal | Original prize price |
| prizeInfo | false | Array | Prize information, required for quiz lottery See PrizeInfo |
| questionGroupId | false | Long | Quiz group template ID, required for quiz lottery |
| perAnswerDuration | false | Integer | Duration per question, required for quiz lottery |
| lotteryOnlineEnabled | false | String | Whether viewers must be online when drawing, values: Y/N, default Y (effective for unconditional group lottery) |
| answerType | false | String | Quiz lottery answer method: pushQuestion (answer while pushing), autonomyAnswer (self-paced answer), default: pushQuestion |
| showWinnerCode | false | String | Whether to display the redemption code, default on, values: Y/N, default Y |
| showWinners | false | String | Whether to display the winner list, default on, values: Y/N, default Y |
ReceiveInfo Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| type | false | String | Type: userName (name), userPhone (phone number), custom (custom) |
| field | true | String | Field name |
| tips | true | String | Prompt text |
| required | false | Boolean | Whether required, true/false |
PrizeInfo Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| prizeItem | true | String | Prize item name |
| correctAnswerCount | true | Integer | Number of correct answers |
| prizeName | true | String | Prize name |
| thumbnail | false | String | Prize image |
| realPrice | false | BigDecimal | Discounted price |
| price | false | BigDecimal | Original prize price |
| acceptType | true | String | Prize claim method: form (form), link (external link), qrCode (QR code) |
| formInfo | false | Array | Form field information for prize claim method, filled in when method is form See ReceiveInfo |
| prizeUrl | false | String | Prize link for prize claim method, required when method is external link |
| qrCode | false | String | QR code link for prize claim method, required when method is QR code |
| qrCodeTips | false | String | QR code prompt text for prize claim method, filled in when method is QR code |
| amount | true | Integer | Number of winners |
| hiddenWinnerAmount | false | String | Whether to hide the number of winners, values: Y/N, default N |
Example
http://api.polyv.net/live//v4/channel/lottery-activity/create?appId=frlr1zazn3×tamp=1665629374000&sign=6CFA3141718E1AF0155889EEA2988206&channelId=2974342
Request body JSON parameters:
{
"activityName": "无条件抽奖",
"lotteryCondition": "none",
"amount": 1,
"receiveEnabled": "Y",
"prizeName": "键盘",
"receiveInfo": [{
"field": "姓名",
"tips": "请输入您的名称",
"type": "userName",
"required": true
}, {
"field": "手机",
"tips": "请输入您的手机号码",
"type": "userPhone",
"required": true
}],
"lotteryRange": "all"
}
Response Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Status code, same as HTTP status code, used to determine basic response status |
| status | String | Response result, determined by business logic: success returns success, failure returns error |
| success | Boolean | Whether the request was successful |
| requestId | String | Request ID, a unique UUID generated for each request, only for troubleshooting and debugging, not related to business logic |
| error | Object | Error information when status code is not 200 See Error field description |
| data | Object | Detailed response information See data field description |
Error Response Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Error code, used to determine the specific error reason |
| desc | String | Error description, corresponding to error.code |
data Response Description
| Parameter | Type | Description |
|---|---|---|
| id | Long | Lottery activity ID |
| activityName | String | Lottery activity name |
| lotteryCondition | String | Lottery type |
| status | String | Lottery activity status |
| amount | Integer | Number of winners |
| hiddenWinnerAmount | String | Whether to hide the number of winners |
| lotteryRange | String | User type for lottery participation: all (all users), customGroup (custom groups) |
| customGroup | Array | Custom group information See CustomGroup |
| customGroupLotteryType | String | Group drawing method: average (equal lottery), random (random lottery) |
| customGroupLotteryAmount | Integer | Number of draws per group |
| hiddenAttendeeNumber | String | Whether to hide the number of participants |
| repeatWinEnabled | String | Allow repeated winning |
| receiveEnabled | String | Whether to fill in shipping information |
| receiveInfo | Array | Shipping field information list, filled in for unconditional lottery See ReceiveInfo |
| prizeName | String | Prize name |
| thumbnail | String | Prize image |
| activityDuration | String | Activity duration (minutes) |
| inviteType | String | Invitation method |
| externalListLink | String | External list link |
| externalInviteNumLink | String | Link to get invitation count |
| inviteNum | Integer | Number of invitations |
| duration | Integer | Watch duration |
| comment | String | Comment content |
| acceptType | String | Prize claim method: form (form), link (external link), qrCode (QR code) |
| formInfo | Array | Form field information for prize claim method See ReceiveInfo |
| prizeUrl | String | Prize link for prize claim method |
| qrCode | String | QR code link for prize claim method |
| qrCodeTips | String | QR code prompt text for prize claim method |
| realPrice | BigDecimal | Discounted price |
| price | BigDecimal | Original prize price |
| prizeInfo | Array | Prize information See PrizeInfo |
| questionGroupId | Long | Quiz group template ID |
| perAnswerDuration | Integer | Duration per question |
CustomGroup Response Description
| Parameter | Type | Description |
|---|---|---|
| id | Long | Group ID |
| title | String | Group title |
| type | String | Group type |
| count | String | Group member count |
ReceiveInfo Response Description
| Parameter | Type | Description |
|---|---|---|
| type | String | Type: userName (name), userPhone (phone number), custom (custom) |
| field | String | Field name |
| tips | String | Prompt text |
| required | Boolean | Whether required, true/false |
PrizeInfo Response Description
| Parameter | Type | Description |
|---|---|---|
| prizeItem | String | Prize item name |
| correctAnswerCount | Integer | Number of correct answers |
| prizeName | String | Prize name |
| thumbnail | String | Prize image |
| realPrice | BigDecimal | Discounted price |
| price | BigDecimal | Original prize price |
| acceptType | String | Prize claim method: form (form), link (external link), qrCode (QR code) |
| formInfo | Array | Form field information for prize claim method See ReceiveInfo |
| prizeUrl | String | Prize link for prize claim method |
| qrCode | String | QR code link for prize claim method |
| qrCodeTips | String | QR code prompt text for prize claim method |
| amount | Integer | Number of winners |
| hiddenWinnerAmount | String | Whether to hide the number of winners |
Java Request Example
For quick integration of basic code, please download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source code project. The test cases HttpUtil.java and LiveSignUtil.java are included in the downloaded file.
It is strongly recommended to use the Live Java SDK for API integration. The Live Java SDK provides a unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.
Response Example
For global error descriptions, see Global Error Description
Success Example
{
"code": 200,
"status": "success",
"requestId": "723ed01861804e9aa3dc1cf1aced83d5.72.17097790901718347",
"data": {
"id": 20521,
"activityName": "无条件抽奖",
"lotteryCondition": "none",
"amount": 1,
"receiveEnabled": "Y",
"receiveInfo": [
{
"type": "userName",
"field": "姓名",
"tips": "请输入您的名称",
"required": true
},
{
"type": "userPhone",
"field": "手机",
"tips": "请输入您的手机号码",
"required": true
}
],
"prizeName": "键盘",
"activityDuration": null,
"inviteType": "poster",
"inviteNum": null,
"duration": null,
"comment": null,
"externalListLink": null,
"externalInviteNumLink": null,
"acceptType": null,
"formInfo": null,
"prizeUrl": null,
"qrCode": null,
"qrCodeTips": null,
"thumbnail": null,
"realPrice": null,
"price": null,
"status": null,
"prizeInfo": null,
"questionGroupId": null,
"perAnswerDuration": null,
"lotteryRange": "all",
"repeatWinEnabled": "N",
"customGroup": [],
"hiddenWinnerAmount": "N",
"hiddenAttendeeNumber": "N",
"customGroupLotteryType": "random",
"customGroupLotteryAmount": null
},
"success": true
}
Error Example
{
"code": 400,
"status": "error",
"requestId": "d310b70bc329403f87f77f9203d50f89.128.16360831552223589",
"error": {
"code": 20001,
"desc": "application not found."
},
"success": false
}
