Polyv Help Center

Help Center

Group Account: Obtain External Authorization Secret Key Using Channel ID

Updated: 2026-08-13 17:32:38

Interface Description

1、集团账号通过频道号查询频道外部授权观看的secretKey
2、仅支持查询当前集团账号及其分账号下的频道
3、频道需要已开启外部授权观看
4、接口支持https协议

Interface URL

http://api.polyv.net/live/v4/group/channel/external-auth-key/get

Online API Call

Request Method

GET

Interface Constraints

  1. The interface supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. Interface calls have frequency limits. See details

  2. For group account interfaces, use the appId and appSecret of the primary group account when calculating the signature.

  3. appSecret is only used for signature generation and does not need to be transmitted as a request parameter.

  4. Interface results have approximately 60 seconds of server-side caching. After modifying the channel's external authorization viewing configuration, it is recommended to wait for the cache to refresh before querying again.

Request Parameter Description

Parameter Required Type Description
appId true String Primary group account appId [See Group Account 2.0 Key Acquisition]
timestamp true Long Current 13-digit millisecond timestamp, valid for 3 minutes
sign true String Signature, a 32-character uppercase MD5 value. The appSecret used to generate the signature is critical for communication data security. It must never be saved or used directly on the client side. All APIs must be relayed through the customer's own server to call the POLYV server for response data. [See Signature Generation Rules]
channelId true Integer Channel ID, must be greater than 0

Example

http://api.polyv.net/live/v4/group/channel/external-auth-key/get?appId=g8dtv537aq&timestamp=1710000000000&channelId=123456&sign=YOUR_UPPERCASE_MD5_SIGN

Response Parameter Description

Parameter Type Description
code Integer Status code, same as HTTP status code, used to determine the basic response status
status String Response result, determined by business logic. Returns "success" on success, "error" on failure
success Boolean Whether the response was successful
requestId String Request ID, a unique UUID generated for each request. Only used for troubleshooting and debugging, not tied to business logic
error Object Error information when status code is not 200 [See Error Field Description]
data Object Channel external authorization viewing secret key information [See Data Field Description]

Error Parameter Description

Parameter Type Description
code Integer Error code, used to identify the specific error cause
desc String Error description, corresponding to error.code

Data Parameter Description

Parameter Type Description
channelId Integer Channel ID
secretKey String Channel external authorization viewing secretKey

Java Request Example

For quick integration of basic code, download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source project. The test cases include HttpUtil.java and LiveSignUtil.java in the downloaded file.

It is strongly recommended to use the Live Java SDK for API integration. The Live Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.

private static final Logger log = LoggerFactory.getLogger(ChannelOperateTest.class);

/**
 * 通过频道号获取外部授权频道secretKey
 * @throws IOException
 * @throws NoSuchAlgorithmException
 */
@Test
public void groupChannelExternalAuthKeyTest() throws IOException, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String appId = super.groupAppId;
    String appSecret = super.groupAppSecret;
    String timestamp = String.valueOf(System.currentTimeMillis());

    //业务参数
    String url = "http://api.polyv.net/live/v4/group/channel/external-auth-key/get";
    String channelId = "123456";

    //http调用逻辑
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("channelId", channelId);
    requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));

    String response = HttpUtil.get(url, requestMap);

    log.info("测试通过频道号获取外部授权频道secretKey成功:{}", response);
    //do somethings
}

Response Example

For global system error descriptions, see Global Error Description

Success Example

{
    "code": 200,
    "status": "success",
    "requestId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "data": {
        "channelId": 123456,
        "secretKey": "**********"
    },
    "success": true
}

Error Example

{
    "code": 400,
    "status": "error",
    "requestId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "data": null,
    "error": {
        "code": 1097,
        "desc": "非法的频道ID"
    },
    "success": false
}

Error Code Description

Error Code Error Description Explanation
10001 channelId cannot be empty channelId not provided
10001 channelId must be greater than 0 channelId is less than or equal to 0
10002 Signature error sign verification failed
30004 Channel not found Channel does not exist, or does not belong to the current group account or its sub-accounts
1169 Channel external authorization viewing not enabled Channel does not have external authorization viewing enabled, or no valid external authorization secretKey is configured
20000 appId is required. appId not provided

Notes

  1. This interface only returns the secretKey from the external authorization viewing configuration. When the channel does not have external authorization viewing enabled, no other viewing restriction configurations are returned.

  2. Channels not belonging to the current group account or its sub-accounts will uniformly return "Invalid channel ID" without revealing channel ownership information.

  3. The secretKey is sensitive information. It is recommended to use and store it only on the server side, and not output it to frontend pages, client code, or public logs.

联系客服,在线咨询