Shield API
The Shield API provides a RESTful interface for managing security settings on your pull zones. Configure WAF rules, rate limiting, bot detection, and access controls programmatically.
Setup
<?php
require 'vendor/autoload.php';
use ToshY\BunnyNet\BunnyHttpClient;
use ToshY\BunnyNet\Enum\Endpoint;
$bunnyHttpClient = new BunnyHttpClient(
client: new \Symfony\Component\HttpClient\Psr18Client(),
// Provide the account API key.
apiKey: '2cebf4f8-4bff-429f-86f6-bce2c2163d7e89fb0a86-a1b2-463c-a142-11eba8811989',
baseUrl: Endpoint::SHIELD
);
Usage
Shield Zone
List Shield Zones
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\ShieldZone\ListShieldZones(
query: [
'page' => 1,
'perPage' => 1000,
],
)
);
List Shield Zones Pull Zone Mapping
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\ShieldZone\ListShieldZonesPullzoneMapping()
);
Get Shield Zone
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\ShieldZone\GetShieldZone(
shieldZoneId: 1,
)
);
Get Shield Zone (by PullZoneId)
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\ShieldZone\GetShieldZoneByPullZoneId(
pullZoneId: 1,
)
);
Create Shield Zone
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\ShieldZone\CreateShieldZone(
body: [
'pullZoneId' => 1,
'shieldZone' => [
'shieldZoneId' => 2,
'premiumPlan' => false,
'planType' => 0,
'learningMode' => true,
'learningModeUntil' => 'Y-m-d\TH:i:s',
'wafEnabled' => true,
'wafExecutionMode' => 1,
'wafDisabledRules' => [],
'wafLogOnlyRules' => [],
'wafCustomRuleOrder' => [],
'wafRequestHeaderLoggingEnabled' => true,
'requestBodyLoggingEnabled' => false,
'wafRequestIgnoredHeaders' => [],
'wafRealtimeThreatIntelligenceEnabled' => false,
'wafProfileId' => 1,
'wafEngineConfig' => [],
'wafRequestBodyLimitAction' => 0,
'wafResponseBodyLimitAction' => 0,
'dDoSShieldSensitivity' => 1,
'dDoSExecutionMode' => 1,
'dDoSChallengeWindow' => 1,
'whitelabelResponsePages' => false,
],
],
)
);
Note
- The key
shieldZoneIdis not needed or required when creating a shield zone. - The key
planTypehas the following possible values:0=Basic1=Advanced2=Business3=Enterprise
- The key
wafExecutionModehas the following possible values:0=Log1=Block
- The keys
wafRequestBodyLimitActionandwafResponseBodyLimitActionhave the following possible values:0=Block1=Log2=Ignore
- The key
dDoSShieldSensitivityhas the following possible values:0=Off1=Low2=Medium3=High4=Challenge
- The key
dDoSExecutionModehas the following possible values:0=Log1=Block
Update Shield Zone
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\ShieldZone\UpdateShieldZone(
body: [
'shieldZoneId' => 2,
'shieldZone' => [
'shieldZoneId' => 2,
'premiumPlan' => false,
'planType' => 0,
'learningMode' => true,
'learningModeUntil' => 'Y-m-d\TH:i:s',
'wafEnabled' => true,
'wafExecutionMode' => 1,
'wafDisabledRules' => [],
'wafLogOnlyRules' => [],
'wafCustomRuleOrder' => [],
'wafRequestHeaderLoggingEnabled' => true,
'requestBodyLoggingEnabled' => false,
'wafRequestIgnoredHeaders' => [],
'wafRealtimeThreatIntelligenceEnabled' => false,
'wafProfileId' => 1,
'wafEngineConfig' => [],
'wafRequestBodyLimitAction' => 0,
'wafResponseBodyLimitAction' => 0,
'dDoSShieldSensitivity' => 1,
'dDoSExecutionMode' => 1,
'dDoSChallengeWindow' => 1,
'whitelabelResponsePages' => false,
],
],
)
);
Note
- The key
planTypehas the following possible values:0=Basic1=Advanced2=Business3=Enterprise
- The key
wafExecutionModehas the following possible values:0=Log1=Block
- The keys
wafRequestBodyLimitActionandwafResponseBodyLimitActionhave the following possible values:0=Block1=Log2=Ignore
- The key
dDoSShieldSensitivityhas the following possible values:0=Off1=Low2=Medium3=High4=Challenge
- The key
dDoSExecutionModehas the following possible values:0=Log1=Block
WAF
List WAF Rules
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Waf\ListCustomWafRules()
);
Review Triggered Rules
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Waf\ReviewTriggeredRules(
shieldZoneId: 1,
)
);
Review Triggered Rule
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Waf\ReviewTriggeredRule(
shieldZoneId: 1,
body: [
'ruleId' => '46d1703e-7d63-4138-83b1-78695bee5a07',
'action' => 2,
],
)
);
Note
- The key
actionhas the following possible values:0=Ignore1=LogOnly2=DisableRule
Review Triggered Rule AI Recommendation
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Waf\ReviewTriggeredRuleAiRecommendation(
shieldZoneId: 1,
ruleId: '46d1703e-7d63-4138-83b1-78695bee5a07',
)
);
List Custom WAF Rules
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Waf\ListCustomWafRules(
shieldZoneId: 1,
query: [
'page' => 1,
'perPage' => 1000,
],
)
);
Get Custom WAF Rule
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Waf\GetCustomWafRule(
id: 1,
)
);
Update Custom WAF Rule
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Waf\UpdateCustomWafRule(
id: 1,
body: [
'ruleName' => 'string',
'ruleDescription' => 'string',
'ruleConfiguration' => [
'actionType' => 1,
'variableTypes' => [
'REQUEST_URI' => 'string',
'REQUEST_URI_RAW' => 'string',
'ARGS' => 'string',
'ARGS_COMBINED_SIZE' => 'string',
'ARGS_GET' => 'string',
'ARGS_GET_NAMES' => 'string',
'ARGS_POST' => 'string',
'ARGS_POST_NAMES' => 'string',
'FILES_NAMES' => 'string',
'GEO' => 'string',
'REMOTE_ADDR' => 'string',
'QUERY_STRING' => 'string',
'REQUEST_BASENAME' => 'string',
'REQUEST_BODY' => 'string',
'REQUEST_COOKIES_NAMES' => 'string',
'REQUEST_COOKIES' => 'string',
'REQUEST_FILENAME' => 'string',
'REQUEST_HEADERS_NAMES' => 'string',
'REQUEST_HEADERS' => 'string',
'REQUEST_LINE' => 'string',
'REQUEST_METHOD' => 'string',
'REQUEST_PROTOCOL' => 'string',
'RESPONSE_BODY' => 'string',
'RESPONSE_HEADERS' => 'string',
'RESPONSE_STATUS' => 'string',
'FINGERPRINT' => 'string',
'VERIFIED_BOT_CATEGORY' => 'string',
],
'operatorType' => 0,
'severityType' => 0,
'transformationTypes' => [1],
'value' => 'string',
'isNegated' => false,
'isRegexVariable' => false,
'requestCount' => 0,
'timeframe' => 1,
'blockTime' => 30,
'chainedRuleConditions' => [
[
'variableTypes' => [
'REQUEST_URI' => 'string',
'REQUEST_URI_RAW' => 'string',
'ARGS' => 'string',
'ARGS_COMBINED_SIZE' => 'string',
'ARGS_GET' => 'string',
'ARGS_GET_NAMES' => 'string',
'ARGS_POST' => 'string',
'ARGS_POST_NAMES' => 'string',
'FILES_NAMES' => 'string',
'GEO' => 'string',
'REMOTE_ADDR' => 'string',
'QUERY_STRING' => 'string',
'REQUEST_BASENAME' => 'string',
'REQUEST_BODY' => 'string',
'REQUEST_COOKIES_NAMES' => 'string',
'REQUEST_COOKIES' => 'string',
'REQUEST_FILENAME' => 'string',
'REQUEST_HEADERS_NAMES' => 'string',
'REQUEST_HEADERS' => 'string',
'REQUEST_LINE' => 'string',
'REQUEST_METHOD' => 'string',
'REQUEST_PROTOCOL' => 'string',
'RESPONSE_BODY' => 'string',
'RESPONSE_HEADERS' => 'string',
'RESPONSE_STATUS' => 'string',
'FINGERPRINT' => 'string',
'VERIFIED_BOT_CATEGORY' => 'string',
],
'operatorType' => 0,
'value' => 'string',
'isNegated' => false,
'isRegexVariable' => false,
],
],
],
],
)
);
Note
- The key
actionTypehas the following possible values:1=Block2=Log3=Challenge4=Allow5=Bypass
- The key
operatorType(rule-level and insidechainedRuleConditions) has the following possible values:0=BEGINSWITH1=ENDSWITH2=CONTAINS3=CONTAINSWORD4=STRMATCH5=EQ6=GE7=GT8=LE9=LT12=WITHIN14=RX15=STREQ17=DETECTSQLI18=DETECTXSS
- The key
severityTypehas the following possible values:0=NOTICE1=WARNING2=CRITICAL
- The key
transformationTypesis an array containing any of the following values:1=CMDLINE2=COMPRESSWHITESPACE3=CSSDECODE4=HEXENCODE5=HTMLENTITYDECODE6=JSDECODE7=LENGTH8=LOWERCASE9=MD510=NORMALIZEPATH11=NORMALISEPATH12=NORMALIZEPATHWIN13=NORMALISEPATHWIN14=REMOVECOMMENTS15=REMOVENULLS16=REMOVEWHITESPACE17=REPLACECOMMENTS18=SHA119=URLDECODE20=URLDECODEUNI21=UTF8TOUNICODE
Update Custom WAF Rule (PATCH)
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Waf\UpdateCustomWafRuleByPatch(
id: 1,
body: [
'ruleName' => 'string',
'ruleDescription' => 'string',
'ruleConfiguration' => [
'actionType' => 1,
'variableTypes' => [
'REQUEST_URI' => 'string',
'REQUEST_URI_RAW' => 'string',
'ARGS' => 'string',
'ARGS_COMBINED_SIZE' => 'string',
'ARGS_GET' => 'string',
'ARGS_GET_NAMES' => 'string',
'ARGS_POST' => 'string',
'ARGS_POST_NAMES' => 'string',
'FILES_NAMES' => 'string',
'GEO' => 'string',
'REMOTE_ADDR' => 'string',
'QUERY_STRING' => 'string',
'REQUEST_BASENAME' => 'string',
'REQUEST_BODY' => 'string',
'REQUEST_COOKIES_NAMES' => 'string',
'REQUEST_COOKIES' => 'string',
'REQUEST_FILENAME' => 'string',
'REQUEST_HEADERS_NAMES' => 'string',
'REQUEST_HEADERS' => 'string',
'REQUEST_LINE' => 'string',
'REQUEST_METHOD' => 'string',
'REQUEST_PROTOCOL' => 'string',
'RESPONSE_BODY' => 'string',
'RESPONSE_HEADERS' => 'string',
'RESPONSE_STATUS' => 'string',
'FINGERPRINT' => 'string',
'VERIFIED_BOT_CATEGORY' => 'string',
],
'operatorType' => 0,
'severityType' => 0,
'transformationTypes' => [1],
'value' => 'string',
'isNegated' => false,
'isRegexVariable' => false,
'requestCount' => 0,
'timeframe' => 1,
'blockTime' => 30,
'chainedRuleConditions' => [
[
'variableTypes' => [
'REQUEST_URI' => 'string',
'REQUEST_URI_RAW' => 'string',
'ARGS' => 'string',
'ARGS_COMBINED_SIZE' => 'string',
'ARGS_GET' => 'string',
'ARGS_GET_NAMES' => 'string',
'ARGS_POST' => 'string',
'ARGS_POST_NAMES' => 'string',
'FILES_NAMES' => 'string',
'GEO' => 'string',
'REMOTE_ADDR' => 'string',
'QUERY_STRING' => 'string',
'REQUEST_BASENAME' => 'string',
'REQUEST_BODY' => 'string',
'REQUEST_COOKIES_NAMES' => 'string',
'REQUEST_COOKIES' => 'string',
'REQUEST_FILENAME' => 'string',
'REQUEST_HEADERS_NAMES' => 'string',
'REQUEST_HEADERS' => 'string',
'REQUEST_LINE' => 'string',
'REQUEST_METHOD' => 'string',
'REQUEST_PROTOCOL' => 'string',
'RESPONSE_BODY' => 'string',
'RESPONSE_HEADERS' => 'string',
'RESPONSE_STATUS' => 'string',
'FINGERPRINT' => 'string',
'VERIFIED_BOT_CATEGORY' => 'string',
],
'operatorType' => 0,
'value' => 'string',
'isNegated' => false,
'isRegexVariable' => false,
],
],
],
],
)
);
Note
- The key
actionTypehas the following possible values:1=Block2=Log3=Challenge4=Allow5=Bypass
- The key
operatorType(rule-level and insidechainedRuleConditions) has the following possible values:0=BEGINSWITH1=ENDSWITH2=CONTAINS3=CONTAINSWORD4=STRMATCH5=EQ6=GE7=GT8=LE9=LT12=WITHIN14=RX15=STREQ17=DETECTSQLI18=DETECTXSS
- The key
severityTypehas the following possible values:0=NOTICE1=WARNING2=CRITICAL
- The key
transformationTypesis an array containing any of the following values:1=CMDLINE2=COMPRESSWHITESPACE3=CSSDECODE4=HEXENCODE5=HTMLENTITYDECODE6=JSDECODE7=LENGTH8=LOWERCASE9=MD510=NORMALIZEPATH11=NORMALISEPATH12=NORMALIZEPATHWIN13=NORMALISEPATHWIN14=REMOVECOMMENTS15=REMOVENULLS16=REMOVEWHITESPACE17=REPLACECOMMENTS18=SHA119=URLDECODE20=URLDECODEUNI21=UTF8TOUNICODE
Delete Custom WAF Rule
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Waf\DeleteCustomWafRule(
id: 1,
)
);
Create Custom WAF Rule
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Waf\CreateCustomWafRule(
body: [
'shieldZoneId' => 1,
'ruleName' => 'string',
'ruleDescription' => 'string',
'ruleConfiguration' => [
'actionType' => 1,
'variableTypes' => [
'REQUEST_URI' => 'string',
'REQUEST_URI_RAW' => 'string',
'ARGS' => 'string',
'ARGS_COMBINED_SIZE' => 'string',
'ARGS_GET' => 'string',
'ARGS_GET_NAMES' => 'string',
'ARGS_POST' => 'string',
'ARGS_POST_NAMES' => 'string',
'FILES_NAMES' => 'string',
'GEO' => 'string',
'REMOTE_ADDR' => 'string',
'QUERY_STRING' => 'string',
'REQUEST_BASENAME' => 'string',
'REQUEST_BODY' => 'string',
'REQUEST_COOKIES_NAMES' => 'string',
'REQUEST_COOKIES' => 'string',
'REQUEST_FILENAME' => 'string',
'REQUEST_HEADERS_NAMES' => 'string',
'REQUEST_HEADERS' => 'string',
'REQUEST_LINE' => 'string',
'REQUEST_METHOD' => 'string',
'REQUEST_PROTOCOL' => 'string',
'RESPONSE_BODY' => 'string',
'RESPONSE_HEADERS' => 'string',
'RESPONSE_STATUS' => 'string',
'FINGERPRINT' => 'string',
'VERIFIED_BOT_CATEGORY' => 'string',
],
'operatorType' => 0,
'severityType' => 0,
'transformationTypes' => [1],
'value' => 'string',
'isNegated' => false,
'isRegexVariable' => false,
'requestCount' => 0,
'timeframe' => 1,
'blockTime' => 30,
'chainedRuleConditions' => [
[
'variableTypes' => [
'REQUEST_URI' => 'string',
'REQUEST_URI_RAW' => 'string',
'ARGS' => 'string',
'ARGS_COMBINED_SIZE' => 'string',
'ARGS_GET' => 'string',
'ARGS_GET_NAMES' => 'string',
'ARGS_POST' => 'string',
'ARGS_POST_NAMES' => 'string',
'FILES_NAMES' => 'string',
'GEO' => 'string',
'REMOTE_ADDR' => 'string',
'QUERY_STRING' => 'string',
'REQUEST_BASENAME' => 'string',
'REQUEST_BODY' => 'string',
'REQUEST_COOKIES_NAMES' => 'string',
'REQUEST_COOKIES' => 'string',
'REQUEST_FILENAME' => 'string',
'REQUEST_HEADERS_NAMES' => 'string',
'REQUEST_HEADERS' => 'string',
'REQUEST_LINE' => 'string',
'REQUEST_METHOD' => 'string',
'REQUEST_PROTOCOL' => 'string',
'RESPONSE_BODY' => 'string',
'RESPONSE_HEADERS' => 'string',
'RESPONSE_STATUS' => 'string',
'FINGERPRINT' => 'string',
'VERIFIED_BOT_CATEGORY' => 'string',
],
'operatorType' => 0,
'value' => 'string',
'isNegated' => false,
'isRegexVariable' => false,
],
],
],
],
)
);
Note
- The key
actionTypehas the following possible values:1=Block2=Log3=Challenge4=Allow5=Bypass
- The key
operatorType(rule-level and insidechainedRuleConditions) has the following possible values:0=BEGINSWITH1=ENDSWITH2=CONTAINS3=CONTAINSWORD4=STRMATCH5=EQ6=GE7=GT8=LE9=LT12=WITHIN14=RX15=STREQ17=DETECTSQLI18=DETECTXSS
- The key
severityTypehas the following possible values:0=NOTICE1=WARNING2=CRITICAL
- The key
transformationTypesis an array containing any of the following values:1=CMDLINE2=COMPRESSWHITESPACE3=CSSDECODE4=HEXENCODE5=HTMLENTITYDECODE6=JSDECODE7=LENGTH8=LOWERCASE9=MD510=NORMALIZEPATH11=NORMALISEPATH12=NORMALIZEPATHWIN13=NORMALISEPATHWIN14=REMOVECOMMENTS15=REMOVENULLS16=REMOVEWHITESPACE17=REPLACECOMMENTS18=SHA119=URLDECODE20=URLDECODEUNI21=UTF8TOUNICODE
Warning
If this endpoint is requested for a shield zone on a free tier, it returns a 202 status code with the error message: We do not support Custom WAF Rule creation on our Free Tier of Bunny Shield, please upgrade to Advanced.
List WAF Profiles
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Waf\ListWafProfiles()
);
List WAF Enums
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Waf\ListWafEnums()
);
List WAF Engine Configuration
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Waf\ListWafEngineConfiguration()
);
Get WAF Rules
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Waf\GetWafRules(
shieldZoneId: 1,
)
);
Get WAF Rules Plan Segmentation
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Waf\GetWafRulesPlanSegmentation(
shieldZoneId: 1,
)
);
DDoS
List DDoS Enums
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Ddos\ListDdosEnums()
);
Rate Limiting
List Rate Limits
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\RateLimiting\ListRateLimits(
shieldZoneId: 1,
query: [
'page' => 1,
'perPage' => 1000,
],
)
);
Get Rate Limit
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\RateLimiting\GetRateLimit(
id: 1,
)
);
Update Rate Limit
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\RateLimiting\UpdateRateLimit(
id: 1,
body: [
'ruleName' => 'string',
'ruleDescription' => 'string',
'ruleConfiguration' => [
'actionType' => 1,
'variableTypes' => [
'REQUEST_URI' => 'string',
'REQUEST_URI_RAW' => 'string',
'ARGS' => 'string',
'ARGS_COMBINED_SIZE' => 'string',
'ARGS_GET' => 'string',
'ARGS_GET_NAMES' => 'string',
'ARGS_POST' => 'string',
'ARGS_POST_NAMES' => 'string',
'FILES_NAMES' => 'string',
'GEO' => 'string',
'REMOTE_ADDR' => 'string',
'QUERY_STRING' => 'string',
'REQUEST_BASENAME' => 'string',
'REQUEST_BODY' => 'string',
'REQUEST_COOKIES_NAMES' => 'string',
'REQUEST_COOKIES' => 'string',
'REQUEST_FILENAME' => 'string',
'REQUEST_HEADERS_NAMES' => 'string',
'REQUEST_HEADERS' => 'string',
'REQUEST_LINE' => 'string',
'REQUEST_METHOD' => 'string',
'REQUEST_PROTOCOL' => 'string',
'RESPONSE_BODY' => 'string',
'RESPONSE_HEADERS' => 'string',
'RESPONSE_STATUS' => 'string',
'FINGERPRINT' => 'string',
'VERIFIED_BOT_CATEGORY' => 'string',
],
'operatorType' => 0,
'severityType' => 0,
'transformationTypes' => [1],
'value' => 'string',
'isNegated' => false,
'isRegexVariable' => false,
'requestCount' => 0,
'counterKeyType' => 0,
'timeframe' => 1,
'blockTime' => 30,
'chainedRuleConditions' => [
[
'variableTypes' => [
'REQUEST_URI' => 'string',
'REQUEST_URI_RAW' => 'string',
'ARGS' => 'string',
'ARGS_COMBINED_SIZE' => 'string',
'ARGS_GET' => 'string',
'ARGS_GET_NAMES' => 'string',
'ARGS_POST' => 'string',
'ARGS_POST_NAMES' => 'string',
'FILES_NAMES' => 'string',
'GEO' => 'string',
'REMOTE_ADDR' => 'string',
'QUERY_STRING' => 'string',
'REQUEST_BASENAME' => 'string',
'REQUEST_BODY' => 'string',
'REQUEST_COOKIES_NAMES' => 'string',
'REQUEST_COOKIES' => 'string',
'REQUEST_FILENAME' => 'string',
'REQUEST_HEADERS_NAMES' => 'string',
'REQUEST_HEADERS' => 'string',
'REQUEST_LINE' => 'string',
'REQUEST_METHOD' => 'string',
'REQUEST_PROTOCOL' => 'string',
'RESPONSE_BODY' => 'string',
'RESPONSE_HEADERS' => 'string',
'RESPONSE_STATUS' => 'string',
'FINGERPRINT' => 'string',
'VERIFIED_BOT_CATEGORY' => 'string',
],
'operatorType' => 0,
'value' => 'string',
'isNegated' => false,
'isRegexVariable' => false,
],
],
],
],
)
);
Note
- The key
actionTypehas the following possible values:1=RateLimit2=Log3=Challenge
- The key
operatorType(rule-level and insidechainedRuleConditions) has the following possible values:0=BEGINSWITH1=ENDSWITH2=CONTAINS3=CONTAINSWORD4=STRMATCH5=EQ6=GE7=GT8=LE9=LT12=WITHIN14=RX15=STREQ17=DETECTSQLI18=DETECTXSS
- The key
severityTypehas the following possible values:0=NOTICE1=WARNING2=CRITICAL
- The key
transformationTypesis an array containing any of the following values:1=CMDLINE2=COMPRESSWHITESPACE3=CSSDECODE4=HEXENCODE5=HTMLENTITYDECODE6=JSDECODE7=LENGTH8=LOWERCASE9=MD510=NORMALIZEPATH11=NORMALISEPATH12=NORMALIZEPATHWIN13=NORMALISEPATHWIN14=REMOVECOMMENTS15=REMOVENULLS16=REMOVEWHITESPACE17=REPLACECOMMENTS18=SHA119=URLDECODE20=URLDECODEUNI21=UTF8TOUNICODE
- The key
counterKeyTypehas the following possible values:0=IP1=Host2=Country3=City4=ASN5=Organization6=JA47=IP_JA4
- The key
timeframehas the following possible values:1=PerSecond10=PerTenSeconds60=PerOneMinute300=PerFiveMinutes900=PerFifteenMinutes3600=PerOneHour
- The key
blockTimehas the following possible values:30=ForThirtySeconds60=ForOneMinute300=ForFiveMinutes900=ForFifteenMinutes1800=ForThirtyMinutes3600=ForOneHour
Delete Rate Limit
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\RateLimiting\DeleteRateLimit(
id: 1,
)
);
Create Rate Limit
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\RateLimiting\CreateRateLimit(
id: 1,
body: [
'shieldZoneId' => 1,
'ruleName' => 'string',
'ruleDescription' => 'string',
'ruleConfiguration' => [
'actionType' => 1,
'variableTypes' => [
'REQUEST_URI' => 'string',
'REQUEST_URI_RAW' => 'string',
'ARGS' => 'string',
'ARGS_COMBINED_SIZE' => 'string',
'ARGS_GET' => 'string',
'ARGS_GET_NAMES' => 'string',
'ARGS_POST' => 'string',
'ARGS_POST_NAMES' => 'string',
'FILES_NAMES' => 'string',
'GEO' => 'string',
'REMOTE_ADDR' => 'string',
'QUERY_STRING' => 'string',
'REQUEST_BASENAME' => 'string',
'REQUEST_BODY' => 'string',
'REQUEST_COOKIES_NAMES' => 'string',
'REQUEST_COOKIES' => 'string',
'REQUEST_FILENAME' => 'string',
'REQUEST_HEADERS_NAMES' => 'string',
'REQUEST_HEADERS' => 'string',
'REQUEST_LINE' => 'string',
'REQUEST_METHOD' => 'string',
'REQUEST_PROTOCOL' => 'string',
'RESPONSE_BODY' => 'string',
'RESPONSE_HEADERS' => 'string',
'RESPONSE_STATUS' => 'string',
'FINGERPRINT' => 'string',
'VERIFIED_BOT_CATEGORY' => 'string',
],
'operatorType' => 0,
'severityType' => 0,
'transformationTypes' => [1],
'value' => 'string',
'isNegated' => false,
'isRegexVariable' => false,
'requestCount' => 0,
'counterKeyType' => 0,
'timeframe' => 1,
'blockTime' => 30,
'chainedRuleConditions' => [
[
'variableTypes' => [
'REQUEST_URI' => 'string',
'REQUEST_URI_RAW' => 'string',
'ARGS' => 'string',
'ARGS_COMBINED_SIZE' => 'string',
'ARGS_GET' => 'string',
'ARGS_GET_NAMES' => 'string',
'ARGS_POST' => 'string',
'ARGS_POST_NAMES' => 'string',
'FILES_NAMES' => 'string',
'GEO' => 'string',
'REMOTE_ADDR' => 'string',
'QUERY_STRING' => 'string',
'REQUEST_BASENAME' => 'string',
'REQUEST_BODY' => 'string',
'REQUEST_COOKIES_NAMES' => 'string',
'REQUEST_COOKIES' => 'string',
'REQUEST_FILENAME' => 'string',
'REQUEST_HEADERS_NAMES' => 'string',
'REQUEST_HEADERS' => 'string',
'REQUEST_LINE' => 'string',
'REQUEST_METHOD' => 'string',
'REQUEST_PROTOCOL' => 'string',
'RESPONSE_BODY' => 'string',
'RESPONSE_HEADERS' => 'string',
'RESPONSE_STATUS' => 'string',
'FINGERPRINT' => 'string',
'VERIFIED_BOT_CATEGORY' => 'string',
],
'operatorType' => 0,
'value' => 'string',
'isNegated' => false,
'isRegexVariable' => false,
],
],
],
],
)
);
Note
- The key
actionTypehas the following possible values:1=RateLimit2=Log3=Challenge
- The key
operatorType(rule-level and insidechainedRuleConditions) has the following possible values:0=BEGINSWITH1=ENDSWITH2=CONTAINS3=CONTAINSWORD4=STRMATCH5=EQ6=GE7=GT8=LE9=LT12=WITHIN14=RX15=STREQ17=DETECTSQLI18=DETECTXSS
- The key
severityTypehas the following possible values:0=NOTICE1=WARNING2=CRITICAL
- The key
transformationTypesis an array containing any of the following values:1=CMDLINE2=COMPRESSWHITESPACE3=CSSDECODE4=HEXENCODE5=HTMLENTITYDECODE6=JSDECODE7=LENGTH8=LOWERCASE9=MD510=NORMALIZEPATH11=NORMALISEPATH12=NORMALIZEPATHWIN13=NORMALISEPATHWIN14=REMOVECOMMENTS15=REMOVENULLS16=REMOVEWHITESPACE17=REPLACECOMMENTS18=SHA119=URLDECODE20=URLDECODEUNI21=UTF8TOUNICODE
- The key
counterKeyTypehas the following possible values:0=IP1=Host2=Country3=City4=ASN5=Organization6=JA47=IP_JA4
- The key
timeframehas the following possible values:1=PerSecond10=PerTenSeconds60=PerOneMinute300=PerFiveMinutes900=PerFifteenMinutes3600=PerOneHour
- The key
blockTimehas the following possible values:30=ForThirtySeconds60=ForOneMinute300=ForFiveMinutes900=ForFifteenMinutes1800=ForThirtyMinutes3600=ForOneHour
Metrics
Get Shield Zone Monthly Overages
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Metrics\GetShieldZoneMonthlyOverages(
shieldZoneId: 1,
query: [
'year' => 2025,
'month' => 1,
],
)
);
Get Overview Metrics
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Metrics\GetOverviewMetrics(
shieldZoneId: 1,
)
);
List Rate Limit Metrics
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Metrics\ListRateLimitMetrics(
shieldZoneId: 1,
)
);
Get Rate Limit Metrics
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Metrics\GetRateLimitMetrics(
id: 1,
)
);
Get WAF Rule Metrics
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Metrics\GetWafRuleMetrics(
shieldZoneId: 1,
ruleId: '68332416-124a-4a55-b3fd-4f6c995a3bdf',
)
);
Get Bot Detection Metrics
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Metrics\GetBotDetectionMetrics(
shieldZoneId: 1,
)
);
Get Upload Scanning Metrics
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Metrics\GetUploadScanningMetrics(
shieldZoneId: 1,
)
);
Get Metrics Overview Detailed
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Metrics\GetMetricsOverviewDetailed(
shieldZoneId: 1,
query: [
'StartDate' => 'm-d-Y',
'EndDate' => 'm-d-Y',
'Resolution' => 0,
],
)
);
Note
- The key
Resolutionhas the following possible values:0=Auto1=TwoMinutes2=TenMinutes3=Hourly4=Daily5=Weekly6=Monthly
Get Shield Zone API Guardian Metrics
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Metrics\GetShieldZoneApiGuardianMetrics(
shieldZoneId: 1,
)
);
Get API Guardian Endpoint Metrics
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Metrics\GetApiGuardianEndpointMetrics(
shieldZoneId: 1,
endpointId: 2,
)
);
API Guardian
Get API Guardian
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\ApiGuardian\GetApiGuardian(
shieldZoneId: 1,
)
);
Update API Guardian
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\ApiGuardian\UpdateApiGuardian(
shieldZoneId: 1,
endpointId: 2,
body: [
'isEnabled' => true,
'validateRequestBodySchema' => true,
'validateResponseBodySchema' => false,
'validateAuthorization' => false,
'injectionDetectionParameters' => [
'Path' => ['string'],
'Query' => ['string'],
'Header' => ['string'],
'Cookie' => ['string'],
],
'detectParameterXss' => true,
'detectParameterSqli' => true,
'rateLimitingEnabled' => false,
'rateLimitingType' => 'Global',
'rateLimitingRequestCount' => 100,
'rateLimitingTimeframe' => 60,
],
)
);
Warning
- This endpoint returns a
403status code if you do not have Advanced plan or higher.
Note
- The key
rateLimitingTypehas the following possible values:GlobalIP
- The key
rateLimitingTimeframehas the following possible values:1= PerSecond10= PerTenSeconds60= PerOneMinute300= PerFiveMinutes900= PerFifteenMinutes3600= PerOneHour
Upload OpenAPI Specification
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\ApiGuardian\UploadOpenapiSpecification(
shieldZoneId: 1,
body: [
'content' => '{"openapi":"3.0.0","info":{"title":"My API","version":"1.0.0"}}',
'enforceAuthorisationValidation' => false,
],
)
);
Update OpenAPI Specification
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\ApiGuardian\UpdateOpenapiSpecification(
shieldZoneId: 1,
body: [
'isEnabled' => true,
'executionMode' => 0,
'bodyLimitAction' => 0,
'unmatchedPathAction' => 0,
],
)
);
Note
- The key
executionModehas the following possible values:0=Log1=Block
- The key
bodyLimitActionhas the following possible values:0=Block1=Log2=Ignore
- The key
unmatchedPathActionhas the following possible values:0=Block1=Log2=Ignore
Upload Your OpenAPI Specification
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\ApiGuardian\UploadYourOpenapiSpecification(
shieldZoneId: 1,
body: [
'content' => '{"openapi":"3.0.0","info":{"title":"My API","version":"1.0.0"}}',
'enforceAuthorizationValidation' => false,
],
)
);
Update Your OpenAPI Specification
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\ApiGuardian\UpdateYourOpenapiSpecification(
shieldZoneId: 1,
body: [
'content' => '{"openapi":"3.0.0","info":{"title":"My API","version":"2.0.0"}}',
'enforceAuthorizationValidation' => true,
],
)
);
Get API Guardian Enums
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\ApiGuardian\GetApiGuardianEnums(
shieldZoneId: '46d1703e-7d63-4138-83b1-78695bee5a07',
)
);
Event Logs
List Event Logs
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\EventLogs\ListEventLogs(
shieldZoneId: 1,
date: 'Y-m-d\TH:i:s',
continuationToken: 'string',
)
);
Search Event Logs
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\EventLogs\SearchEventLogs(
shieldZoneId: 1,
body: [
'from' => 1704067200,
'to' => 1706745600,
'query' => 'action:block',
'filters' => [
[
'field' => 'country',
'op' => 'eq',
'value' => ['US'],
],
],
'groupBy' => ['country'],
'page' => 1,
'pageSize' => 100,
],
)
);
Export Event Logs
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\EventLogs\ExportEventLogs(
shieldZoneId: 1,
body: [
'from' => 1704067200,
'to' => 1706745600,
'query' => 'action:block',
'filters' => [
[
'field' => 'country',
'op' => 'eq',
'value' => ['US'],
],
],
],
)
);
Access Lists
List Shield Zone Access Lists
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\AccessLists\ListShieldZoneAccessLists(
shieldZoneId: 1,
)
);
Get Shield Zone Access List
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\AccessLists\GetShieldZoneAccessList(
id: 2,
shieldZoneId: 1,
)
);
Get Shield Zone Access List Enums
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\AccessLists\GetShieldZoneAccessListEnums(
shieldZoneId: 1,
)
);
Create Shield Zone Access List
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\AccessLists\CreateShieldZoneAccessList(
shieldZoneId: 1,
body: [
'name' => 'Custom Access List',
'description' => 'This is a description for the access list',
'type' => 0,
'content' => '192.168.0.1',
'checksum' => '37d7a80604871e579850a658c7add2ae7557d0c6abcc9b31ecddc4424207eba3',
],
)
);
Note
- The key
typehas the following possible values:0=IP1=CIDR2=ASN3=Country4=Organization5=JA4
Warning
If this endpoint is requested for a shield zone on a free tier, it returns a 202 status code with the error message: Custom Access List limit exceeded. You can have a maximum of 1 custom lists. Please upgrade your Bunny Shield tier or contact support for assistance.
Update Shield Zone Access List
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\AccessLists\UpdateShieldZoneAccessList(
id: 2,
shieldZoneId: 1,
body: [
'name' => 'Custom Access List Updated',
'content' => '192.168.0.1',
'checksum' => '37d7a80604871e579850a658c7add2ae7557d0c6abcc9b31ecddc4424207eba3',
],
)
);
Update Shield Zone Curated Threat List
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\AccessLists\UpdateShieldZoneCuratedThreatList(
id: 2,
shieldZoneId: 1,
body: [
'isEnabled' => true,
'action' => 4,
],
)
);
Note
- The key
actionhas the following possible values:0=None1=Allow2=Block3=Challenge4=Log5=Bypass
Delete Shield Zone Access List
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\AccessLists\DeleteShieldZoneAccessList(
id: 2,
shieldZoneId: 1,
)
);
Bot Detection
Get Shield Zone Bot Detection
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\BotDetection\GetShieldZoneBotDetection(
shieldZoneId: 1,
)
);
Create Or Update Shield Zone Bot Detection
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\BotDetection\CreateOrUpdateShieldZoneBotDetection(
shieldZoneId: 1,
body: [
'shieldZoneId' => 1,
'executionMode' => 0,
'requestIntegrity' => [
'sensitivity' => 0,
],
'ipAddress' => [
'sensitivity' => 0,
],
'browserFingerprint' => [
'sensitivity' => 0,
'aggression' => 0,
'complexEnabled' => false,
],
]
)
);
Note
- The key
executionModehas the following possible values:0=LogOnly1=Challenge
- The key
sensitivityhas the following possible values:0=Off1=Low2=Medium3=High
- The key
aggressionhas the following possible values:0=Unknown1=Low2=Medium3=High4=Custom
Bot Categorization
List Bot Categorizations
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\BotCategorization\ListBotCategorizations(
shieldZoneId: 1,
)
);
Set Bot Categorization Action
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\BotCategorization\SetBotCategorizationAction(
shieldZoneId: 1,
botId: 1,
body: [
'action' => 2,
],
)
);
Set Bot Category Action
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\BotCategorization\SetBotCategoryAction(
shieldZoneId: 1,
category: 1,
body: [
'action' => 2,
],
)
);
Note
- The key
actionhas the following possible values:0=None1=Allow2=Block3=Challenge4=Log5=Bypass
Promotions
Get Shield Zone Current Promotions
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\Promo\GetCurrentPromotions()
);
Upload Scanning
Get Shield Zone Upload Scanning
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\UploadScanning\GetShieldZoneUploadScanning(
shieldZoneId: 1,
)
);
Create Or Update Shield Zone Upload Scanning
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\UploadScanning\CreateOrUpdateShieldZoneUploadScanning(
shieldZoneId: 1,
body: [
'shieldZoneId' => 1,
'isEnabled' => false,
'csamScanningMode' => 2,
'antivirusScanningMode' => 1,
]
)
);
Note
- The key
csamScanningModehas the following possible values:0=1= Log2= Block
- The key
antivirusScanningModehas the following possible values:0=1= Log2= Block
Custom Response Pages
Upload Custom Response Page
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\CustomResponsePages\UploadCustomResponsePage(
shieldZoneId: 1,
pageType: 'blocked',
)
);
Get Custom Response Page
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\CustomResponsePages\GetCustomResponsePage(
shieldZoneId: 1,
pageType: 'blocked',
)
);
Delete Custom Response Page
$bunnyHttpClient->request(
new \ToshY\BunnyNet\Model\Api\Shield\CustomResponsePages\DeleteCustomResponsePage(
shieldZoneId: 1,
pageType: 'blocked',
)
);