Skip to content

启用 Turnstile

POST/web/v1/system/workspaces/{workspaceId}/institutions/{institutionBizId}/portals/turnstile/enable WEB

启用指定机构的 Cloudflare Turnstile 验证。启用后,所有门户登录流程将需要完成 Turnstile 挑战。

鉴权

需要有效的 JWT token 并拥有 platform:institution:write 权限。网关验证:enableJwtToken=trueenableTurnstile=false

请求参数

路径参数

NameTypeRequiredInDescription
workspaceIdstringRequiredpath工作空间业务 ID
institutionBizIdstringRequiredpath机构业务 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"
  }
}

响应字段

字段类型描述
idnumber内部记录 ID
institutionBizIdstring机构业务 ID
turnstileSiteKeystringCloudflare Turnstile 站点密钥
turnstileSecretKeystring脱敏后的私密密钥(仅显示最后 4 位)
enabledboolean此操作后始终为 true
remarkstring|null配置备注
createdAtstringISO 8601 创建时间
updatedAtstringISO 8601 最后更新时间

错误响应

错误码描述
4010未授权(无效或缺少 JWT token)
4040机构或 Turnstile 配置未找到

说明

  • 必须先通过更新 Turnstile 创建 Turnstile 配置后才能启用。
  • 如果 Turnstile 已启用,此操作为幂等操作,返回当前状态。
  • turnstileSecretKey 在响应中已脱敏(格式:****xxxx)。

SlaunchX Internal Documentation