接口请求域名: captcha.intl.tencentcloudapi.com 。
新建验证码:您可以基于不同业务需求创建多个验证,每个验证配置不同的客户端类型、安全策略等。新建验证上限为50个。
默认接口请求频率限制:20次/秒。
以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数。
| 参数名称 | 必选 | 类型 | 描述 |
|---|---|---|---|
| Action | 是 | String | 公共参数,本接口取值:CreateCaptchaInfoInternational。 |
| Version | 是 | String | 公共参数,本接口取值:2019-07-22。 |
| Region | 否 | String | 公共参数,此参数为可选参数。 |
| AppName | 是 | String | 验证码名称 |
| ChannelInfo | 是 | String | 客户端类型 枚举值:
默认值:web |
| VerifyRank | 否 | String | 验证等级 枚举值:
默认值:1 |
| UserSetCapType | 否 | String | 验证类型 枚举值:
|
| DefendMode | 否 | String | 拦截模式 枚举值:
默认值:notify |
| Tags.N | 否 | Array of String | 资源标签, key&value格式 |
| DisableInvisibleSwitch | 否 | String | 验证机制 枚举值:
|
| VerifyDomain | 否 | String | web域名 仅在ChannelInfo为web时传入有效 |
| VerifyBundleId | 否 | String | app BundleId 仅在ChannelInfo为ios时传入有效 |
| VerifyPackage | 否 | String | app package 仅在ChannelInfo为android时传入有效 |
| CheckAppidSwitch | 否 | Integer | 是否开启captcha加密,0:关闭,1:开启 |
| CheckIvSwitch | 否 | Integer | 是否开启一次一密 枚举值:
仅在CheckAppidSwitch为1时允许传入1 |
| CheckBoxStyle | 否 | String | 勾选框展示方式 枚举值:
|
| 参数名称 | 类型 | 描述 |
|---|---|---|
| Data | Integer | 结果数据 |
| CaptchaCode | Integer | 验证码状态码 |
| CaptchaMsg | String | 验证码信息 |
| RequestId | String | 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 |
创建验证码
POST / HTTP/1.1
Host: captcha.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateCaptchaInfo
<公共请求参数>
{
"UserSetCapType": "13",
"AppName": "aaa",
"VerifyRank": "3",
"ChannelInfo": "web",
"VerifyDomain": "\"*******.com\"",
"VerifyBundleId": "\"com.*******",
"VerifyPackage": "\"com.******\""
}
{
"Response": {
"RequestId": "63ade1a9-eae8-49d4-b8be-bf803bfffdbe",
"Data": 179000008,
"CaptchaCode": 11000,
"CaptchaMsg": ""
}
}
云 API 3.0 提供了配套的开发工具集(SDK),支持多种编程语言,能更方便的调用 API。
以下仅列出了接口业务逻辑相关的错误码,其他错误码详见 公共错误码。
| 错误码 | 描述 |
|---|---|
| AuthFailure.UnauthorizedOperation | 请求未CAM授权 |
| InternalError | 内部错误。 |
| InvalidParameter | 参数错误。 |
| UnauthorizedOperation.ErrAuth | 鉴权失败。 |
| UnauthorizedOperation.Unauthorized | 未开通权限/无有效套餐包/账号已欠费。 |
文档反馈