Skip to content
Start here

Update Zone Bot Management Config

client.BotManagement.Update(ctx, params) (*BotManagementUpdateResponse, error)
PUT/zones/{zone_id}/bot_management

Updates the Bot Management configuration for a zone.

This API is used to update:

  • Bot Fight Mode
  • Super Bot Fight Mode
  • Bot Management for Enterprise

See Bot Plans for more information on the different plans
If you recently upgraded or downgraded your plan, refer to the following examples to clean up old configurations. Copy and paste the example body to remove old zone configurations based on your current plan.

Clean up configuration for Bot Fight Mode plan

{
  "sbfm_likely_automated": "allow", 
  "sbfm_definitely_automated": "allow", 
  "sbfm_verified_bots": "allow", 
  "sbfm_static_resource_protection": false, 
  "optimize_wordpress": false, 
  "suppress_session_score": false
}

Clean up configuration for SBFM Pro plan

{
  "sbfm_likely_automated": "allow", 
  "fight_mode": false 
}

Clean up configuration for SBFM Biz plan

{
  "fight_mode": false
}

Clean up configuration for BM Enterprise Subscription plan

It is strongly recommended that you ensure you have custom rules in place to protect your zone before disabling the SBFM rules. Without these protections, your zone is vulnerable to attacks.

{
  "sbfm_likely_automated": "allow", 
  "sbfm_definitely_automated": "allow", 
  "sbfm_verified_bots": "allow", 
  "sbfm_static_resource_protection": false, 
  "optimize_wordpress": false, 
  "fight_mode": false
}
Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Bot Management Write
ParametersExpand Collapse
params BotManagementUpdateParams
ZoneID param.Field[string]

Path param: Identifier.

maxLength32
BotFightModeConfiguration param.Field[BotFightModeConfiguration]

Body param

ReturnsExpand Collapse
type BotManagementUpdateResponse interface{…}
One of the following:
type BotFightModeConfiguration struct{…}
AIBotsProtection BotFightModeConfigurationAIBotsProtectionoptional

Enable rule to block AI Scrapers and Crawlers. Please note the value only_on_ad_pages is currently not available for Enterprise customers.

One of the following:
const BotFightModeConfigurationAIBotsProtectionBlock BotFightModeConfigurationAIBotsProtection = "block"
const BotFightModeConfigurationAIBotsProtectionDisabled BotFightModeConfigurationAIBotsProtection = "disabled"
const BotFightModeConfigurationAIBotsProtectionOnlyOnADPages BotFightModeConfigurationAIBotsProtection = "only_on_ad_pages"
CfRobotsVariant BotFightModeConfigurationCfRobotsVariantoptional

Specifies the Robots Access Control License variant to use.

One of the following:
const BotFightModeConfigurationCfRobotsVariantOff BotFightModeConfigurationCfRobotsVariant = "off"
const BotFightModeConfigurationCfRobotsVariantPolicyOnly BotFightModeConfigurationCfRobotsVariant = "policy_only"
CrawlerProtection BotFightModeConfigurationCrawlerProtectionoptional

Enable rule to punish AI Scrapers and Crawlers via a link maze.

One of the following:
const BotFightModeConfigurationCrawlerProtectionEnabled BotFightModeConfigurationCrawlerProtection = "enabled"
const BotFightModeConfigurationCrawlerProtectionDisabled BotFightModeConfigurationCrawlerProtection = "disabled"
EnableJS booloptional

Use lightweight, invisible JavaScript detections to improve Bot Management. Learn more about JavaScript Detections.

FightMode booloptional

Whether to enable Bot Fight Mode.

IsRobotsTXTManaged booloptional

Enable cloudflare managed robots.txt. If an existing robots.txt is detected, then managed robots.txt will be prepended to the existing robots.txt.

StaleZoneConfiguration BotFightModeConfigurationStaleZoneConfigurationoptional

A read-only field that shows which unauthorized settings are currently active on the zone. These settings typically result from upgrades or downgrades.

OptimizeWordpress booloptional

Indicates that the zone's wordpress optimization for SBFM is turned on.

SBFMDefinitelyAutomated stringoptional

Indicates that the zone's definitely automated requests are being blocked or challenged.

SBFMLikelyAutomated stringoptional

Indicates that the zone's likely automated requests are being blocked or challenged.

SBFMStaticResourceProtection stringoptional

Indicates that the zone's static resource protection is turned on.

SBFMVerifiedBots stringoptional

Indicates that the zone's verified bot requests are being blocked.

SuppressSessionScore booloptional

Indicates that the zone's session score tracking is disabled.

UsingLatestModel booloptional

A read-only field that indicates whether the zone currently is running the latest ML model.

type SuperBotFightModeDefinitelyConfiguration struct{…}
AIBotsProtection SuperBotFightModeDefinitelyConfigurationAIBotsProtectionoptional

Enable rule to block AI Scrapers and Crawlers. Please note the value only_on_ad_pages is currently not available for Enterprise customers.

One of the following:
const SuperBotFightModeDefinitelyConfigurationAIBotsProtectionBlock SuperBotFightModeDefinitelyConfigurationAIBotsProtection = "block"
const SuperBotFightModeDefinitelyConfigurationAIBotsProtectionDisabled SuperBotFightModeDefinitelyConfigurationAIBotsProtection = "disabled"
const SuperBotFightModeDefinitelyConfigurationAIBotsProtectionOnlyOnADPages SuperBotFightModeDefinitelyConfigurationAIBotsProtection = "only_on_ad_pages"
CfRobotsVariant SuperBotFightModeDefinitelyConfigurationCfRobotsVariantoptional

Specifies the Robots Access Control License variant to use.

One of the following:
const SuperBotFightModeDefinitelyConfigurationCfRobotsVariantOff SuperBotFightModeDefinitelyConfigurationCfRobotsVariant = "off"
const SuperBotFightModeDefinitelyConfigurationCfRobotsVariantPolicyOnly SuperBotFightModeDefinitelyConfigurationCfRobotsVariant = "policy_only"
CrawlerProtection SuperBotFightModeDefinitelyConfigurationCrawlerProtectionoptional

Enable rule to punish AI Scrapers and Crawlers via a link maze.

One of the following:
const SuperBotFightModeDefinitelyConfigurationCrawlerProtectionEnabled SuperBotFightModeDefinitelyConfigurationCrawlerProtection = "enabled"
const SuperBotFightModeDefinitelyConfigurationCrawlerProtectionDisabled SuperBotFightModeDefinitelyConfigurationCrawlerProtection = "disabled"
EnableJS booloptional

Use lightweight, invisible JavaScript detections to improve Bot Management. Learn more about JavaScript Detections.

IsRobotsTXTManaged booloptional

Enable cloudflare managed robots.txt. If an existing robots.txt is detected, then managed robots.txt will be prepended to the existing robots.txt.

OptimizeWordpress booloptional

Whether to optimize Super Bot Fight Mode protections for Wordpress.

SBFMDefinitelyAutomated SuperBotFightModeDefinitelyConfigurationSBFMDefinitelyAutomatedoptional

Super Bot Fight Mode (SBFM) action to take on definitely automated requests.

One of the following:
const SuperBotFightModeDefinitelyConfigurationSBFMDefinitelyAutomatedAllow SuperBotFightModeDefinitelyConfigurationSBFMDefinitelyAutomated = "allow"
const SuperBotFightModeDefinitelyConfigurationSBFMDefinitelyAutomatedBlock SuperBotFightModeDefinitelyConfigurationSBFMDefinitelyAutomated = "block"
const SuperBotFightModeDefinitelyConfigurationSBFMDefinitelyAutomatedManagedChallenge SuperBotFightModeDefinitelyConfigurationSBFMDefinitelyAutomated = "managed_challenge"
SBFMStaticResourceProtection booloptional

Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if static resources on your application need bot protection. Note: Static resource protection can also result in legitimate traffic being blocked.

SBFMVerifiedBots SuperBotFightModeDefinitelyConfigurationSBFMVerifiedBotsoptional

Super Bot Fight Mode (SBFM) action to take on verified bots requests.

One of the following:
const SuperBotFightModeDefinitelyConfigurationSBFMVerifiedBotsAllow SuperBotFightModeDefinitelyConfigurationSBFMVerifiedBots = "allow"
const SuperBotFightModeDefinitelyConfigurationSBFMVerifiedBotsBlock SuperBotFightModeDefinitelyConfigurationSBFMVerifiedBots = "block"
StaleZoneConfiguration SuperBotFightModeDefinitelyConfigurationStaleZoneConfigurationoptional

A read-only field that shows which unauthorized settings are currently active on the zone. These settings typically result from upgrades or downgrades.

FightMode booloptional

Indicates that the zone's Bot Fight Mode is turned on.

SBFMLikelyAutomated stringoptional

Indicates that the zone's likely automated requests are being blocked or challenged.

UsingLatestModel booloptional

A read-only field that indicates whether the zone currently is running the latest ML model.

type SuperBotFightModeLikelyConfiguration struct{…}
AIBotsProtection SuperBotFightModeLikelyConfigurationAIBotsProtectionoptional

Enable rule to block AI Scrapers and Crawlers. Please note the value only_on_ad_pages is currently not available for Enterprise customers.

One of the following:
const SuperBotFightModeLikelyConfigurationAIBotsProtectionBlock SuperBotFightModeLikelyConfigurationAIBotsProtection = "block"
const SuperBotFightModeLikelyConfigurationAIBotsProtectionDisabled SuperBotFightModeLikelyConfigurationAIBotsProtection = "disabled"
const SuperBotFightModeLikelyConfigurationAIBotsProtectionOnlyOnADPages SuperBotFightModeLikelyConfigurationAIBotsProtection = "only_on_ad_pages"
CfRobotsVariant SuperBotFightModeLikelyConfigurationCfRobotsVariantoptional

Specifies the Robots Access Control License variant to use.

One of the following:
const SuperBotFightModeLikelyConfigurationCfRobotsVariantOff SuperBotFightModeLikelyConfigurationCfRobotsVariant = "off"
const SuperBotFightModeLikelyConfigurationCfRobotsVariantPolicyOnly SuperBotFightModeLikelyConfigurationCfRobotsVariant = "policy_only"
CrawlerProtection SuperBotFightModeLikelyConfigurationCrawlerProtectionoptional

Enable rule to punish AI Scrapers and Crawlers via a link maze.

One of the following:
const SuperBotFightModeLikelyConfigurationCrawlerProtectionEnabled SuperBotFightModeLikelyConfigurationCrawlerProtection = "enabled"
const SuperBotFightModeLikelyConfigurationCrawlerProtectionDisabled SuperBotFightModeLikelyConfigurationCrawlerProtection = "disabled"
EnableJS booloptional

Use lightweight, invisible JavaScript detections to improve Bot Management. Learn more about JavaScript Detections.

IsRobotsTXTManaged booloptional

Enable cloudflare managed robots.txt. If an existing robots.txt is detected, then managed robots.txt will be prepended to the existing robots.txt.

OptimizeWordpress booloptional

Whether to optimize Super Bot Fight Mode protections for Wordpress.

SBFMDefinitelyAutomated SuperBotFightModeLikelyConfigurationSBFMDefinitelyAutomatedoptional

Super Bot Fight Mode (SBFM) action to take on definitely automated requests.

One of the following:
const SuperBotFightModeLikelyConfigurationSBFMDefinitelyAutomatedAllow SuperBotFightModeLikelyConfigurationSBFMDefinitelyAutomated = "allow"
const SuperBotFightModeLikelyConfigurationSBFMDefinitelyAutomatedBlock SuperBotFightModeLikelyConfigurationSBFMDefinitelyAutomated = "block"
const SuperBotFightModeLikelyConfigurationSBFMDefinitelyAutomatedManagedChallenge SuperBotFightModeLikelyConfigurationSBFMDefinitelyAutomated = "managed_challenge"
SBFMLikelyAutomated SuperBotFightModeLikelyConfigurationSBFMLikelyAutomatedoptional

Super Bot Fight Mode (SBFM) action to take on likely automated requests.

One of the following:
const SuperBotFightModeLikelyConfigurationSBFMLikelyAutomatedAllow SuperBotFightModeLikelyConfigurationSBFMLikelyAutomated = "allow"
const SuperBotFightModeLikelyConfigurationSBFMLikelyAutomatedBlock SuperBotFightModeLikelyConfigurationSBFMLikelyAutomated = "block"
const SuperBotFightModeLikelyConfigurationSBFMLikelyAutomatedManagedChallenge SuperBotFightModeLikelyConfigurationSBFMLikelyAutomated = "managed_challenge"
SBFMStaticResourceProtection booloptional

Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if static resources on your application need bot protection. Note: Static resource protection can also result in legitimate traffic being blocked.

SBFMVerifiedBots SuperBotFightModeLikelyConfigurationSBFMVerifiedBotsoptional

Super Bot Fight Mode (SBFM) action to take on verified bots requests.

One of the following:
const SuperBotFightModeLikelyConfigurationSBFMVerifiedBotsAllow SuperBotFightModeLikelyConfigurationSBFMVerifiedBots = "allow"
const SuperBotFightModeLikelyConfigurationSBFMVerifiedBotsBlock SuperBotFightModeLikelyConfigurationSBFMVerifiedBots = "block"
StaleZoneConfiguration SuperBotFightModeLikelyConfigurationStaleZoneConfigurationoptional

A read-only field that shows which unauthorized settings are currently active on the zone. These settings typically result from upgrades or downgrades.

FightMode booloptional

Indicates that the zone's Bot Fight Mode is turned on.

UsingLatestModel booloptional

A read-only field that indicates whether the zone currently is running the latest ML model.

type SubscriptionConfiguration struct{…}
AIBotsProtection SubscriptionConfigurationAIBotsProtectionoptional

Enable rule to block AI Scrapers and Crawlers. Please note the value only_on_ad_pages is currently not available for Enterprise customers.

One of the following:
const SubscriptionConfigurationAIBotsProtectionBlock SubscriptionConfigurationAIBotsProtection = "block"
const SubscriptionConfigurationAIBotsProtectionDisabled SubscriptionConfigurationAIBotsProtection = "disabled"
const SubscriptionConfigurationAIBotsProtectionOnlyOnADPages SubscriptionConfigurationAIBotsProtection = "only_on_ad_pages"
AutoUpdateModel booloptional

Automatically update to the newest bot detection models created by Cloudflare as they are released. Learn more.

CfRobotsVariant SubscriptionConfigurationCfRobotsVariantoptional

Specifies the Robots Access Control License variant to use.

One of the following:
const SubscriptionConfigurationCfRobotsVariantOff SubscriptionConfigurationCfRobotsVariant = "off"
const SubscriptionConfigurationCfRobotsVariantPolicyOnly SubscriptionConfigurationCfRobotsVariant = "policy_only"
CrawlerProtection SubscriptionConfigurationCrawlerProtectionoptional

Enable rule to punish AI Scrapers and Crawlers via a link maze.

One of the following:
const SubscriptionConfigurationCrawlerProtectionEnabled SubscriptionConfigurationCrawlerProtection = "enabled"
const SubscriptionConfigurationCrawlerProtectionDisabled SubscriptionConfigurationCrawlerProtection = "disabled"
EnableJS booloptional

Use lightweight, invisible JavaScript detections to improve Bot Management. Learn more about JavaScript Detections.

IsRobotsTXTManaged booloptional

Enable cloudflare managed robots.txt. If an existing robots.txt is detected, then managed robots.txt will be prepended to the existing robots.txt.

StaleZoneConfiguration SubscriptionConfigurationStaleZoneConfigurationoptional

A read-only field that shows which unauthorized settings are currently active on the zone. These settings typically result from upgrades or downgrades.

FightMode booloptional

Indicates that the zone's Bot Fight Mode is turned on.

OptimizeWordpress booloptional

Indicates that the zone's wordpress optimization for SBFM is turned on.

SBFMDefinitelyAutomated stringoptional

Indicates that the zone's definitely automated requests are being blocked or challenged.

SBFMLikelyAutomated stringoptional

Indicates that the zone's likely automated requests are being blocked or challenged.

SBFMStaticResourceProtection stringoptional

Indicates that the zone's static resource protection is turned on.

SBFMVerifiedBots stringoptional

Indicates that the zone's verified bot requests are being blocked.

SuppressSessionScore booloptional

Whether to disable tracking the highest bot score for a session in the Bot Management cookie.

UsingLatestModel booloptional

A read-only field that indicates whether the zone currently is running the latest ML model.

Update Zone Bot Management Config

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/bot_management"
  "github.com/cloudflare/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  botManagement, err := client.BotManagement.Update(context.TODO(), bot_management.BotManagementUpdateParams{
    ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    Body: bot_management.BotFightModeConfigurationParam{

    },
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", botManagement)
}
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "ai_bots_protection": "block",
    "cf_robots_variant": "policy_only",
    "crawler_protection": "enabled",
    "enable_js": true,
    "fight_mode": true,
    "is_robots_txt_managed": false,
    "stale_zone_configuration": {
      "optimize_wordpress": true,
      "sbfm_definitely_automated": "sbfm_definitely_automated",
      "sbfm_likely_automated": "sbfm_likely_automated",
      "sbfm_static_resource_protection": "sbfm_static_resource_protection",
      "sbfm_verified_bots": "sbfm_verified_bots",
      "suppress_session_score": true
    },
    "using_latest_model": true
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "ai_bots_protection": "block",
    "cf_robots_variant": "policy_only",
    "crawler_protection": "enabled",
    "enable_js": true,
    "fight_mode": true,
    "is_robots_txt_managed": false,
    "stale_zone_configuration": {
      "optimize_wordpress": true,
      "sbfm_definitely_automated": "sbfm_definitely_automated",
      "sbfm_likely_automated": "sbfm_likely_automated",
      "sbfm_static_resource_protection": "sbfm_static_resource_protection",
      "sbfm_verified_bots": "sbfm_verified_bots",
      "suppress_session_score": true
    },
    "using_latest_model": true
  }
}