hosting
PUT /v1/sites/{siteId}/cdn/security
Change a site's CDN security and bot settings.
身份验证
请将 API 密钥作为 bearer 令牌发送。该密钥必须具有 hosting.cdn.manage 权限;缺少该权限的密钥将被拒绝并返回 403 状态码,而非 404。
此端点不需要组织 ID。您的密钥已用于识别其所属的组织,且响应范围也仅限于该组织。
免费试用
将尖括号中的内容替换为您自己的值,并将键占位符替换为您仪表板中的一个键。
curl -X PUT https://api.zinndigital.com/v1/sites/{siteId}/cdn/security \
-H "Authorization: Bearer zdk_live_…" \
-H "Content-Type: application/json" \
-d '{ }'已登录?您仪表板中的 API 控制台会自动填入您真实的组织 ID 和您自己的密钥,并针对实时 API 运行请求,以便您查看实际的响应。 在 API 控制台中打开此端点
详细信息
A merge: only the fields present are changed. A full-object write would turn a customer's AI-crawler policy off every time they changed their security level. The body carries settings and nothing else — additionalProperties: false, for the reason PUT /v1/sites/{siteId}/cdn/settings gives: these are pooled CDN accounts and a Cloudflare zone resolves by name alone, so a body key named domain or zone_id must be refused rather than discarded. The result is read back from the provider rather than echoed, because the provider silently ignores a bot control a zone's plan does not include — "we asked" and "it changed" are different facts. Requires hosting.cdn.manage. Bot management is a sold entitlement (protection_tier). Turning bot_fight_mode on, or setting ai_bots_protection/crawler_protection to block or managed_challenge, needs a plan that includes it and otherwise answers a plan refusal naming the tier held and the tier needed. Three things are deliberately NOT gated. Turning any control off is free on every plan — a customer whose plan changed must always be able to reach the floor rather than be stranded with a setting they cannot undo. allow is an explicit relaxation, not protection, so it is free too. And security_level: under_attack is free on every plan, for ever: it is the emergency DDoS response, and refusing it to a customer under active attack because of their plan is not a product decision this platform will make.
参数
| 名称 | 类型 | 必填 | 内容简介 |
|---|---|---|---|
siteId (path) | Uuid | 是 | Site ID (UUIDv7). |
请求正文
| 名称 | 类型 | 必填 | 内容简介 |
|---|---|---|---|
security_level | CdnSecurityLevel | 否 | The provider's own security-level vocabulary, passed through. Not ordered the way it reads — essentially_off sits between off and low — so nothing may treat it as a… |
bot_fight_mode | boolean | 否 | — |
ai_bots_protection | CdnAiBotMode | 否 | How the edge treats AI crawlers. disabled leaves them alone. This is the control on the screen most able to cost a site traffic, in either direction: blocking AI answer engines… |
crawler_protection | CdnAiBotMode | 否 | How the edge treats AI crawlers. disabled leaves them alone. This is the control on the screen most able to cost a site traffic, in either direction: blocking AI answer engines… |
always_use_https | boolean | 否 | — |
automatic_https_rewrites | boolean | 否 | — |
opportunistic_encryption | boolean | 否 | — |
min_tls_version | CdnMinTlsVersion | 否 | The oldest TLS version the edge will negotiate. A string — 1.10 is not a version. |
响应
| 名称 | 类型 | 必填 | 内容简介 |
|---|---|---|---|
site_id | Uuid | 是 | UUIDv7 identifier — sortable by creation time (docs/02 §8). |
supported | boolean | 是 | Whether the CDN serving this site can express these settings at all. false for a provider with no equivalent vocabulary; the other fields then carry defaults and a client should… |
unreadable | string[] | 否 | Fields the CDN account's credential could not read, so their values here are defaults, not the zone's state. A client renders each listed control disabled and says it could not be… |
protection_tier | string | 是 | The protection level this organisation's plan sells (protection_tier). Absent from a plan means the floor — every site with a CDN already has the provider's baseline protection… |
bot_management_included | boolean | 是 | Whether that tier reaches bot management — enabling bot_fight_mode, or setting ai_bots_protection/crawler_protection to block or managed_challenge. Derived server-side… |
security_level | CdnSecurityLevel | 是 | The provider's own security-level vocabulary, passed through. Not ordered the way it reads — essentially_off sits between off and low — so nothing may treat it as a… |
bot_fight_mode | boolean | 是 | Challenge traffic the provider classifies as automated. Read from the provider's bot-management resource, not from a zone setting — the zone setting of that name does not exist. |
ai_bots_protection | CdnAiBotMode | 是 | How the edge treats AI crawlers. disabled leaves them alone. This is the control on the screen most able to cost a site traffic, in either direction: blocking AI answer engines… |
crawler_protection | CdnAiBotMode | 是 | How the edge treats AI crawlers. disabled leaves them alone. This is the control on the screen most able to cost a site traffic, in either direction: blocking AI answer engines… |
always_use_https | boolean | 是 | Redirect every plain-HTTP request to HTTPS at the edge. |
automatic_https_rewrites | boolean | 是 | Rewrite insecure sub-resource URLs in HTML to HTTPS where possible. |
opportunistic_encryption | boolean | 是 | Advertise HTTP/2 over TLS to clients that arrive over plain HTTP. |
min_tls_version | CdnMinTlsVersion | 是 | The oldest TLS version the edge will negotiate. A string — 1.10 is not a version. |
此端点可能返回的错误
401 · 403 · 404 · 422 · 429 · 502 · 503