Skip to content

BotManagement

Source: src/Cloudflare/BotManagement/BotManagement.ts

The bot-management configuration of a Cloudflare zone — a zone-scoped singleton: every zone always has exactly one bot-management config, so there is no create or delete on the Cloudflare side. Reconciling this resource adopts the singleton and PUTs only the fields you explicitly set, leaving every other field untouched.

Which fields are writable depends on the zone’s plan (see Settings). Setting a field outside the zone’s plan shape fails validation on Cloudflare’s side.

On destroy, the resource restores the fields it managed to the values observed before its first write (the initialSettings snapshot). Fields that were never set by this resource are not touched. Settings changed out-of-band after the snapshot was taken, or fields the zone’s plan no longer accepts, cannot be restored.

Challenge definitely automated traffic (Pro and above)

yield* Cloudflare.BotManagement.BotManagement("Bots", {
zoneId: zone.zoneId,
sbfmDefinitelyAutomated: "managed_challenge",
sbfmVerifiedBots: "allow",
});

Static resource protection and WordPress optimization

yield* Cloudflare.BotManagement.BotManagement("Bots", {
zoneId: zone.zoneId,
sbfmDefinitelyAutomated: "block",
sbfmStaticResourceProtection: true,
optimizeWordpress: true,
});
yield* Cloudflare.BotManagement.BotManagement("Bots", {
zoneId: zone.zoneId,
aiBotsProtection: "block",
crawlerProtection: "enabled",
});
yield* Cloudflare.BotManagement.BotManagement("Bots", {
zoneId: zone.zoneId,
fightMode: true,
});