Skip to main content
POST
/
pullzone
/
{pullZoneId}
/
edgerules
/
addOrUpdate
Add/Update Edge Rule
curl --request POST \
  --url https://api.bunny.net/pullzone/{pullZoneId}/edgerules/addOrUpdate \
  --header 'AccessKey: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "Guid": "<string>",
  "ActionParameter1": "<string>",
  "ActionParameter2": "<string>",
  "ActionParameter3": "<string>",
  "Triggers": [
    {
      "PatternMatches": [
        "<string>"
      ],
      "Parameter1": "<string>"
    }
  ],
  "ExtraActions": [
    {
      "ActionParameter1": "<string>",
      "ActionParameter2": "<string>",
      "ActionParameter3": "<string>"
    }
  ],
  "Description": "<string>",
  "Enabled": true,
  "OrderIndex": 123,
  "ReadOnly": true
}
'
import requests

url = "https://api.bunny.net/pullzone/{pullZoneId}/edgerules/addOrUpdate"

payload = {
"Guid": "<string>",
"ActionParameter1": "<string>",
"ActionParameter2": "<string>",
"ActionParameter3": "<string>",
"Triggers": [
{
"PatternMatches": ["<string>"],
"Parameter1": "<string>"
}
],
"ExtraActions": [
{
"ActionParameter1": "<string>",
"ActionParameter2": "<string>",
"ActionParameter3": "<string>"
}
],
"Description": "<string>",
"Enabled": True,
"OrderIndex": 123,
"ReadOnly": True
}
headers = {
"AccessKey": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {AccessKey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
Guid: '<string>',
ActionParameter1: '<string>',
ActionParameter2: '<string>',
ActionParameter3: '<string>',
Triggers: [{PatternMatches: ['<string>'], Parameter1: '<string>'}],
ExtraActions: [
{
ActionParameter1: '<string>',
ActionParameter2: '<string>',
ActionParameter3: '<string>'
}
],
Description: '<string>',
Enabled: true,
OrderIndex: 123,
ReadOnly: true
})
};

fetch('https://api.bunny.net/pullzone/{pullZoneId}/edgerules/addOrUpdate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.bunny.net/pullzone/{pullZoneId}/edgerules/addOrUpdate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'Guid' => '<string>',
'ActionParameter1' => '<string>',
'ActionParameter2' => '<string>',
'ActionParameter3' => '<string>',
'Triggers' => [
[
'PatternMatches' => [
'<string>'
],
'Parameter1' => '<string>'
]
],
'ExtraActions' => [
[
'ActionParameter1' => '<string>',
'ActionParameter2' => '<string>',
'ActionParameter3' => '<string>'
]
],
'Description' => '<string>',
'Enabled' => true,
'OrderIndex' => 123,
'ReadOnly' => true
]),
CURLOPT_HTTPHEADER => [
"AccessKey: <api-key>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.bunny.net/pullzone/{pullZoneId}/edgerules/addOrUpdate"

payload := strings.NewReader("{\n \"Guid\": \"<string>\",\n \"ActionParameter1\": \"<string>\",\n \"ActionParameter2\": \"<string>\",\n \"ActionParameter3\": \"<string>\",\n \"Triggers\": [\n {\n \"PatternMatches\": [\n \"<string>\"\n ],\n \"Parameter1\": \"<string>\"\n }\n ],\n \"ExtraActions\": [\n {\n \"ActionParameter1\": \"<string>\",\n \"ActionParameter2\": \"<string>\",\n \"ActionParameter3\": \"<string>\"\n }\n ],\n \"Description\": \"<string>\",\n \"Enabled\": true,\n \"OrderIndex\": 123,\n \"ReadOnly\": true\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("AccessKey", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.bunny.net/pullzone/{pullZoneId}/edgerules/addOrUpdate")
.header("AccessKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"Guid\": \"<string>\",\n \"ActionParameter1\": \"<string>\",\n \"ActionParameter2\": \"<string>\",\n \"ActionParameter3\": \"<string>\",\n \"Triggers\": [\n {\n \"PatternMatches\": [\n \"<string>\"\n ],\n \"Parameter1\": \"<string>\"\n }\n ],\n \"ExtraActions\": [\n {\n \"ActionParameter1\": \"<string>\",\n \"ActionParameter2\": \"<string>\",\n \"ActionParameter3\": \"<string>\"\n }\n ],\n \"Description\": \"<string>\",\n \"Enabled\": true,\n \"OrderIndex\": 123,\n \"ReadOnly\": true\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.bunny.net/pullzone/{pullZoneId}/edgerules/addOrUpdate")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["AccessKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"Guid\": \"<string>\",\n \"ActionParameter1\": \"<string>\",\n \"ActionParameter2\": \"<string>\",\n \"ActionParameter3\": \"<string>\",\n \"Triggers\": [\n {\n \"PatternMatches\": [\n \"<string>\"\n ],\n \"Parameter1\": \"<string>\"\n }\n ],\n \"ExtraActions\": [\n {\n \"ActionParameter1\": \"<string>\",\n \"ActionParameter2\": \"<string>\",\n \"ActionParameter3\": \"<string>\"\n }\n ],\n \"Description\": \"<string>\",\n \"Enabled\": true,\n \"OrderIndex\": 123,\n \"ReadOnly\": true\n}"

response = http.request(request)
puts response.read_body

Authorizations

AccessKey
string
header
required

API Access Key authorization header

Path Parameters

pullZoneId
integer<int64>
required

The ID of the Pull Zone where the Edge Rule will be created

Body

application/json

The Edge Rule that will be added

Guid
string | null

The unique GUID of the edge rule

ActionType
enum<integer>

The action type of the edge rule. ForceSSL = 0, Redirect = 1, OriginUrl = 2, OverrideCacheTime = 3, BlockRequest = 4, SetResponseHeader = 5, SetRequestHeader = 6, ForceDownload = 7, DisableTokenAuthentication = 8, EnableTokenAuthentication = 9, OverrideCacheTimePublic = 10, IgnoreQueryString = 11, DisableOptimizer = 12, ForceCompression = 13, SetStatusCode = 14, BypassPermaCache = 15, OverrideBrowserCacheTime = 16

Available options:
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
37
ActionParameter1
string | null

The Action parameter 1. The value depends on other parameters of the edge rule.

ActionParameter2
string | null

The Action parameter 2. The value depends on other parameters of the edge rule.

ActionParameter3
string | null

The Action parameter 3. The value depends on other parameters of the edge rule.

Triggers
object[] | null
ExtraActions
object[] | null
TriggerMatchingType
enum<integer>

The trigger matching type. MatchAny = 0, MatchAll = 1, MatchNone = 2

Available options:
0,
1,
2
Description
string | null

The description of the edge rule

Enabled
boolean

Determines if the edge rule is currently enabled or not

OrderIndex
integer<int32>

The index of the edge rule in the list of execution priority

ReadOnly
boolean

Determines if the edge rule is read-only and cannot be modified or deleted

Response

The Edge Rule was successfuly added

Last modified on July 9, 2026