> ## Documentation Index
> Fetch the complete documentation index at: https://bunny.net/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Add/Update Edge Rule



## OpenAPI

````yaml https://core-api-public-docs.b-cdn.net/docs/v3/public.json post /pullzone/{pullZoneId}/edgerules/addOrUpdate
openapi: 3.0.0
info:
  title: bunny.net API
  description: >-
    <img src='https://bunny.net/v2/images/bunnynet-logo-dark.svg' style='width:
    200px;' alt='bunny.net Logo'>
                   Learn how to use the [bunny.net](https://bunny.net "bunny.net - The content delivery platform that truly hops.") API. Everything that can be done with the control panel can also be achieved with our API documented on this page. To learn how to use the storage API, have a look at our <a href='https://bunnycdnstorage.docs.apiary.io/#'>storage API documentation</a>
                   <h2>Third party API clients:</h2> 
                   <br/>
                   We currently do not maintain an official API library, but you can use one of the third party ones provided here:<br/><br/>
                   <a rel='nofollow' href='https://github.com/codewithmark/bunnycdn'>https://github.com/codewithmark/bunnycdn</a> (bunny.net PHP library, thanks to <a rel="nofollow" href='https://codewithmark.com'>Code With Mark</a>)
                   <br/><br/>
                   <i style='font-size: 11px;'><b>Note that third party clients are not maintained or developed by bunny.net so we unfortunately cannot offer support for them.</b></i>
  termsOfService: https://bunny.net/tos
  contact:
    name: bunny.net
    url: https://docs.bunny.net
    email: support@bunny.net
  version: 1.0.0
servers:
  - url: https://api.bunny.net
    description: bunny.net API Server
security:
  - AccessKey: []
tags:
  - name: Stream Video Library
  - name: User
  - name: AuditLog
  - name: Storage Zone
  - name: Statistics
  - name: Search
  - name: Pull Zone
  - name: Pricing
  - name: Load Balancer
  - name: DNS Zone
  - name: DNSSEC
  - name: Billing
  - name: API Keys
  - name: Affiliate
  - name: Countries
  - name: Purge
  - name: Region
paths:
  /pullzone/{pullZoneId}/edgerules/addOrUpdate:
    post:
      tags:
        - Pull Zone
      summary: Add/Update Edge Rule
      operationId: PullZonePublic_AddEdgeRule
      parameters:
        - name: pullZoneId
          in: path
          required: true
          description: The ID of the Pull Zone where the Edge Rule will be created
          schema:
            type: integer
            format: int64
          x-position: 1
      requestBody:
        x-name: edgeRuleModel
        description: The Edge Rule that will be added
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EdgeRuleV2Model'
        required: true
        x-position: 2
      responses:
        '201':
          description: The Edge Rule was successfully added
        '401':
          description: The request authorization failed
        '404':
          description: The Pull Zone with the requested ID does not exist
        '500':
          description: Internal Server Error
components:
  schemas:
    EdgeRuleV2Model:
      type: object
      additionalProperties: false
      properties:
        Guid:
          type: string
          description: The unique GUID of the edge rule
          nullable: true
        ActionType:
          description: |-
            The action type of the edge rule

            <details>
            <summary>Show all 38 values</summary>

            | Value | Name |
            |---|---|
            | `0` | Force SSL |
            | `1` | Redirect |
            | `2` | Origin URL |
            | `3` | Override Cache Time |
            | `4` | Block Request |
            | `5` | Set Response Header |
            | `6` | Set Request Header |
            | `7` | Force Download |
            | `8` | Disable Token Authentication |
            | `9` | Enable Token Authentication |
            | `10` | Override Cache Time Public |
            | `11` | Ignore Query String |
            | `12` | Disable Optimizer |
            | `13` | Force Compression |
            | `14` | Set Status Code |
            | `15` | Bypass Perma-Cache |
            | `16` | Override Browser Cache Time |
            | `17` | Origin Storage |
            | `18` | Set Network Rate Limit |
            | `19` | Set Connection Limit |
            | `20` | Set Requests Per Second Limit |
            | `21` | Run Edge Script |
            | `22` | Origin Magic Containers |
            | `23` | Disable WAF |
            | `24` | Retry Origin |
            | `25` | Override Browser Cache Response Header |
            | `26` | Remove Browser Cache Response Header |
            | `27` | Disable Shield Challenge |
            | `28` | Disable Shield |
            | `29` | Disable Shield Bot Detection |
            | `30` | Bypass AWS S3 Authentication |
            | `31` | Disable Shield Access Lists |
            | `32` | Disable Shield Rate Limiting |
            | `33` | Enable Request Coalescing |
            | `34` | Disable Request Coalescing |
            | `35` | Use Load Balancer |
            | `36` | Force Load Balancer Sticky Session Mode |
            | `37` | Strip Cookies (Client to Origin) |

            </details>
          oneOf:
            - $ref: '#/components/schemas/EdgeRuleActionType'
        ActionParameter1:
          type: string
          description: >-
            The Action parameter 1. The value depends on other parameters of the
            edge rule.
          nullable: true
        ActionParameter2:
          type: string
          description: >-
            The Action parameter 2. The value depends on other parameters of the
            edge rule.
          nullable: true
        ActionParameter3:
          type: string
          description: >-
            The Action parameter 3. The value depends on other parameters of the
            edge rule.
          nullable: true
        Triggers:
          type: array
          nullable: true
          items:
            $ref: '#/components/schemas/Trigger'
        ExtraActions:
          type: array
          nullable: true
          items:
            $ref: '#/components/schemas/EdgeRuleV2ActionModel'
        TriggerMatchingType:
          description: |-
            The trigger matching type

            0 = Match Any
            1 = Match All
            2 = Match None
          oneOf:
            - $ref: '#/components/schemas/TriggerMatchingTypes'
        Description:
          type: string
          description: The description of the edge rule
          nullable: true
        Enabled:
          type: boolean
          description: Determines if the edge rule is currently enabled or not
        OrderIndex:
          type: integer
          description: The index of the edge rule in the list of execution priority
          format: int32
        ReadOnly:
          type: boolean
          description: >-
            Determines if the edge rule is read-only and cannot be modified or
            deleted
    EdgeRuleActionType:
      type: integer
      description: |-
        0 = Force SSL
        1 = Redirect
        2 = Origin URL
        3 = Override Cache Time
        4 = Block Request
        5 = Set Response Header
        6 = Set Request Header
        7 = Force Download
        8 = Disable Token Authentication
        9 = Enable Token Authentication
        10 = Override Cache Time Public
        11 = Ignore Query String
        12 = Disable Optimizer
        13 = Force Compression
        14 = Set Status Code
        15 = Bypass Perma-Cache
        16 = Override Browser Cache Time
        17 = Origin Storage
        18 = Set Network Rate Limit
        19 = Set Connection Limit
        20 = Set Requests Per Second Limit
        21 = Run Edge Script
        22 = Origin Magic Containers
        23 = Disable WAF
        24 = Retry Origin
        25 = Override Browser Cache Response Header
        26 = Remove Browser Cache Response Header
        27 = Disable Shield Challenge
        28 = Disable Shield
        29 = Disable Shield Bot Detection
        30 = Bypass AWS S3 Authentication
        31 = Disable Shield Access Lists
        32 = Disable Shield Rate Limiting
        33 = Enable Request Coalescing
        34 = Disable Request Coalescing
        35 = Use Load Balancer
        36 = Force Load Balancer Sticky Session Mode
        37 = Strip Cookies (Client to Origin)
      x-enumNames:
        - ForceSSL
        - Redirect
        - OriginUrl
        - OverrideCacheTime
        - BlockRequest
        - SetResponseHeader
        - SetRequestHeader
        - ForceDownload
        - DisableTokenAuthentication
        - EnableTokenAuthentication
        - OverrideCacheTimePublic
        - IgnoreQueryString
        - DisableOptimizer
        - ForceCompression
        - SetStatusCode
        - BypassPermaCache
        - OverrideBrowserCacheTime
        - OriginStorage
        - SetNetworkRateLimit
        - SetConnectionLimit
        - SetRequestsPerSecondLimit
        - RunEdgeScript
        - OriginMagicContainers
        - DisableWAF
        - RetryOrigin
        - OverrideBrowserCacheResponseHeader
        - RemoveBrowserCacheResponseHeader
        - DisableShieldChallenge
        - DisableShield
        - DisableShieldBotDetection
        - BypassAwsS3Authentication
        - DisableShieldAccessLists
        - DisableShieldRateLimiting
        - EnableRequestCoalescing
        - DisableRequestCoalescing
        - UseLoadBalancer
        - ForceLoadBalancerStickySessionMode
        - StripCookiesClientToOrigin
      enum:
        - 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
        - 35
        - 36
        - 37
    Trigger:
      type: object
      additionalProperties: false
      properties:
        Type:
          description: |-
            The type of the trigger

            <details>
            <summary>Show all 14 values</summary>

            | Value | Name |
            |---|---|
            | `0` | URL |
            | `1` | Request Header |
            | `2` | Response Header |
            | `3` | URL Extension |
            | `4` | Country Code |
            | `5` | Remote IP |
            | `6` | URL Query String |
            | `7` | Random Chance |
            | `8` | Status Code |
            | `9` | Request Method |
            | `10` | Cookie Value |
            | `11` | Country State Code |
            | `12` | Origin Retry Attempt Count |
            | `13` | Origin Connection Error |

            </details>
          oneOf:
            - $ref: '#/components/schemas/TriggerTypes'
        PatternMatches:
          type: array
          description: The list of pattern matches that will trigger the edge rule
          nullable: true
          items:
            type: string
        PatternMatchingType:
          description: |-
            The type of pattern matching

            0 = Match Any
            1 = Match All
            2 = Match None
          oneOf:
            - $ref: '#/components/schemas/PatternMatchingTypes'
        Parameter1:
          type: string
          description: The trigger parameter 1. The value depends on the type of trigger.
          nullable: true
    EdgeRuleV2ActionModel:
      type: object
      additionalProperties: false
      properties:
        ActionType:
          description: |-
            <details>
            <summary>Show all 38 values</summary>

            | Value | Name |
            |---|---|
            | `0` | Force SSL |
            | `1` | Redirect |
            | `2` | Origin URL |
            | `3` | Override Cache Time |
            | `4` | Block Request |
            | `5` | Set Response Header |
            | `6` | Set Request Header |
            | `7` | Force Download |
            | `8` | Disable Token Authentication |
            | `9` | Enable Token Authentication |
            | `10` | Override Cache Time Public |
            | `11` | Ignore Query String |
            | `12` | Disable Optimizer |
            | `13` | Force Compression |
            | `14` | Set Status Code |
            | `15` | Bypass Perma-Cache |
            | `16` | Override Browser Cache Time |
            | `17` | Origin Storage |
            | `18` | Set Network Rate Limit |
            | `19` | Set Connection Limit |
            | `20` | Set Requests Per Second Limit |
            | `21` | Run Edge Script |
            | `22` | Origin Magic Containers |
            | `23` | Disable WAF |
            | `24` | Retry Origin |
            | `25` | Override Browser Cache Response Header |
            | `26` | Remove Browser Cache Response Header |
            | `27` | Disable Shield Challenge |
            | `28` | Disable Shield |
            | `29` | Disable Shield Bot Detection |
            | `30` | Bypass AWS S3 Authentication |
            | `31` | Disable Shield Access Lists |
            | `32` | Disable Shield Rate Limiting |
            | `33` | Enable Request Coalescing |
            | `34` | Disable Request Coalescing |
            | `35` | Use Load Balancer |
            | `36` | Force Load Balancer Sticky Session Mode |
            | `37` | Strip Cookies (Client to Origin) |

            </details>
          oneOf:
            - $ref: '#/components/schemas/EdgeRuleActionType'
        ActionParameter1:
          type: string
          nullable: true
        ActionParameter2:
          type: string
          nullable: true
        ActionParameter3:
          type: string
          nullable: true
    TriggerMatchingTypes:
      type: integer
      description: |-
        0 = Match Any
        1 = Match All
        2 = Match None
      x-enumNames:
        - MatchAny
        - MatchAll
        - MatchNone
      enum:
        - 0
        - 1
        - 2
    TriggerTypes:
      type: integer
      description: |-
        0 = URL
        1 = Request Header
        2 = Response Header
        3 = URL Extension
        4 = Country Code
        5 = Remote IP
        6 = URL Query String
        7 = Random Chance
        8 = Status Code
        9 = Request Method
        10 = Cookie Value
        11 = Country State Code
        12 = Origin Retry Attempt Count
        13 = Origin Connection Error
      x-enumNames:
        - Url
        - RequestHeader
        - ResponseHeader
        - UrlExtension
        - CountryCode
        - RemoteIP
        - UrlQueryString
        - RandomChance
        - StatusCode
        - RequestMethod
        - CookieValue
        - CountryStateCode
        - OriginRetryAttemptCount
        - OriginConnectionError
      enum:
        - 0
        - 1
        - 2
        - 3
        - 4
        - 5
        - 6
        - 7
        - 8
        - 9
        - 10
        - 11
        - 12
        - 13
    PatternMatchingTypes:
      type: integer
      description: |-
        0 = Match Any
        1 = Match All
        2 = Match None
      x-enumNames:
        - MatchAny
        - MatchAll
        - MatchNone
      enum:
        - 0
        - 1
        - 2
  securitySchemes:
    AccessKey:
      type: apiKey
      description: API Access Key authorization header
      name: AccessKey
      in: header

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.