启用 Turnstile
POST
/web/v1/system/workspaces/{workspaceId}/institutions/{institutionBizId}/portals/turnstile/enable WEB启用指定机构的 Cloudflare Turnstile 验证。启用后,所有门户登录流程将需要完成 Turnstile 挑战。
鉴权
需要有效的 JWT token 并拥有 platform:institution:write 权限。网关验证:enableJwtToken=true,enableTurnstile=false。
请求参数
路径参数
| Name | Type | Required | In | Description |
|---|---|---|---|---|
workspaceId | string | Required | path | 工作空间业务 ID |
institutionBizId | string | Required | path | 机构业务 ID |
无需请求体。
成功响应
成功 200
{
"success": true,
"code": "2000",
"message": "SUCCESS",
"data": {
"id": 1,
"institutionBizId": "INST_ACME_001",
"turnstileSiteKey": "0x4AAAAAAABkMYinukE8nMDQ",
"turnstileSecretKey": "****nMDQ",
"enabled": true,
"remark": "生产环境 Turnstile",
"createdAt": "2026-03-21T00:00:00Z",
"updatedAt": "2026-03-23T10:00:00Z"
}
}响应字段
| 字段 | 类型 | 描述 |
|---|---|---|
id | number | 内部记录 ID |
institutionBizId | string | 机构业务 ID |
turnstileSiteKey | string | Cloudflare Turnstile 站点密钥 |
turnstileSecretKey | string | 脱敏后的私密密钥(仅显示最后 4 位) |
enabled | boolean | 此操作后始终为 true |
remark | string|null | 配置备注 |
createdAt | string | ISO 8601 创建时间 |
updatedAt | string | ISO 8601 最后更新时间 |
错误响应
| 错误码 | 描述 |
|---|---|
4010 | 未授权(无效或缺少 JWT token) |
4040 | 机构或 Turnstile 配置未找到 |
说明
- 必须先通过更新 Turnstile 创建 Turnstile 配置后才能启用。
- 如果 Turnstile 已启用,此操作为幂等操作,返回当前状态。
turnstileSecretKey在响应中已脱敏(格式:****xxxx)。