You need to enable JavaScript to run this app.
导航
UpdateAuthKey - 添加或更新推拉流鉴权
最近更新时间:2025.09.29 16:54:42首次发布时间:2023.09.25 14:32:22
复制全文
我的收藏
有用
有用
无用
无用

调用 UpdateAuthKey 接口,为推拉流域名创建或更新 URL 鉴权配置。使用此接口更新鉴权配置时,调用成功后,会对全部鉴权参数做全量更新。

注意事项

请求频率:单用户请求频率限制为 10 次/秒

请求说明

  • 请求方式:POST
  • 请求地址:https://live.volcengineapi.com?Action=UpdateAuthKey&Version=2023-01-01

调试

请求参数

下表仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数

Query

参数类型是否必选示例值描述
ActionStringUpdateAuthKey接口名称。当前 API 的名称为 UpdateAuthKey
VersionString2023-01-01接口版本。当前 API 的版本为 2023-01-01

Body

参数类型是否必选示例值描述
DomainStringpush.example.com直播流使用的域名。您可以调用 ListDomainDetail 接口或在视频直播控制台的域名管理页面,查看直播流使用的域名。

PushPullEnable

Boolean

true

是否开启 URL 地址鉴权,取值及含义如下所示。

  • false:关闭(默认值);
  • true:开启。

SceneType

String

push

鉴权场景类型,取值及含义如下所示。

  • push:推流鉴权;
  • pull:拉流鉴权。
AuthDetailListArray of AuthDetailList-鉴权配置参数,包括鉴权密钥、鉴权参数、加密字符串生成算法等。
ValidDurationInteger60鉴权生效时长,单位为秒,默认值为 0,取值范围为 [0,2592000],超出生效时长后 URL 无法使用。

TimeStampBase

Integer

10

时间戳进制。默认值为 10,但当 AuthType 取值为 TypeC 时,默认值为 16。取值如下:

  • 2:二进制
  • 8:八进制
  • 10:十进制
  • 16:十六进制

说明

SceneType 取值为 push 时,该参数取值固定为 10

AuthDetailList

参数类型是否必选示例值描述
SecretKeyString1*****1自定义鉴权密钥,支持由大小写字母(A - Z、a - z)和数字(0 - 9)组成,长度为 1 到 100 个字符。

AuthType

String

TypeB

鉴权类型。取值如下:

  • TypeA:A 类型。
  • TypeB:B 类型。
  • TypeC:C 类型。
  • TypeCustom:自定义类型。

说明

  • SceneType 取值为 push 时,取值仅支持 TypeBTypeCustom
  • 更多有关 A、B、C 类型鉴权的信息,详见配置 URL 鉴权

EncryptionAlgorithm

String

md5

加密字符串生成算法,取值及含义如下所示。

  • md5:标准 MD5 算法。当 AuthType 取值为 TypeATypeBTypeC 时,该参数取值必须为 md5
  • md5_custom:自定义 MD5 算法。当 AuthType 取值为 TypeCustom 时,该参数取值必须为 md5_custom

AuthField

JSON Map

{ "volcSecret":"sign", "volcTime":"expire" }

鉴权参数的名称。仅当 AuthType 取值为 TypeCustom 时,需配置该参数。
该参数取值为 Key-Value 对。默认值为 {"volcSecret":"volcSecret","volcTime":"volcTime"}。您可以自定义 volcSecretvolcTime 对应的 value,例如 {"volcSecret":"sign","volcTime":"expire"},表示分别将 sign 作为加密字符串的鉴权参数名称、expire 作为时间戳的鉴权参数名称,从而实现 URL 鉴权。

EncryptField

Array of String

["SecretKey","volcTime","Domain"]

生成加密字符串所需字段。仅当 AuthType 取值为 TypeCustom 时,需配置该参数。
默认无加密字段,但推荐至少包含 SecretKey(鉴权密钥)和 volcTime(时间戳)。 例如参数取值为 ["SecretKey","volcTime","Domain"],则加密字符串可根据 md5({SecretKey}{volcTime}{Domain}) 计算得出。

返回参数

本接口无特有的返回参数。更多信息请见返回结构

请求示例

POST https://live.volcengineapi.com?Action=UpdateAuthKey&Version=2023-01-01
{
    "AuthDetailList": [
        {
            "SecretKey": "1*****1",
            "EncryptionAlgorithm": "md5",
            "AuthType": "TypeB"
        }
    ],
    "Domain": "push.example.com",
    "PushPullEnable": true,
    "SceneType": "push",
    "ValidDuration": 60,
    "TimeStampBase": 10
}

返回示例

{
    "ResponseMetadata": {
        "RequestId": "201806041104200100100232280022D30",
        "Action": "UpdateAuthKey",
        "Version": "2023-01-01",
        "Service": "live",
        "Region": "cn-north-1"
    }
}

错误码

下表仅列出本接口特有的错误码。更多信息请参见公共错误码获取详细信息。

状态码错误码错误信息说明
200CommonErr-未分类错误。建议重试,如果仍返回该错误码,请联系技术支持
400InvalidParam-输入的参数无效或不符合要求,请参照请求参数说明进行检查。
400InvalidParam.BindErrorRequest parameter error, please check input data参数未通过校验,请检查参数类型是否正确。
400InvalidParam.Length%s should not be longer than %d参数长度错误,请检查错误消息中指定参数的长度是否超过限制。
403RequestForbidden-请求被拒绝,当前账号下无请求的资源(域名空间、域名、应用、配置模版、证书)。
403RequestForbidden.AccountIDNotAllowedthis AccountID does not have permission to access the corresponding resource, please check the request parameters请求被拒绝,当前账号下无请求的资源(域名空间、域名、应用、配置模版、证书)。
403RequestForbidden.BillingStatusBilling status is not available for the AccountID, please activate the service or recharge.未开通视频直播服务或账号欠费,造成账单不可用,请检查服务开通情况和账号欠费情况。
404ResourceNotFound-未找到资源(域名空间、域名、应用、配置模版、证书)。建议重试,如果仍返回该错误码,请联系技术支持
404ResourceNotFound.VhostNotExistvhost not found未找到域名空间(Vhost)。请检查传入的域名空间是否与实际使用的域名空间一致。
500InternalErroran internal error occurred, please contact the administrator.出现内部错误,请联系技术支持
500InternalError.DBan internal error related to database occurred, please contact the administrator.出现与数据库相关的内部错误,请联系技术支持
502InternalServiceErroran internal error occurred, please contact the administrator.服务间出现错误,请联系技术支持
502InternalServiceError.BadResponsean internal error occurred, please contact the administrator.服务间出现错误,请联系技术支持
504InternalServiceTimeoutInternal Service is timeout. please contact the administrator.内部服务超时,请联系技术支持

服务端 SDK

视频直播提供了配套的开发工具集 SDK,支持多种编程语言,帮助您更方便的调用 API。