> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bunny.net/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: 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 successfuly 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. 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
          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. MatchAny = 0, MatchAll = 1, MatchNone = 2
          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 = ForceSSL
        1 = Redirect
        2 = OriginUrl
        3 = OverrideCacheTime
        4 = BlockRequest
        5 = SetResponseHeader
        6 = SetRequestHeader
        7 = ForceDownload
        8 = DisableTokenAuthentication
        9 = EnableTokenAuthentication
        10 = OverrideCacheTimePublic
        11 = IgnoreQueryString
        12 = DisableOptimizer
        13 = ForceCompression
        14 = SetStatusCode
        15 = BypassPermaCache
        16 = OverrideBrowserCacheTime
        17 = OriginStorage
        18 = SetNetworkRateLimit
        19 = SetConnectionLimit
        20 = SetRequestsPerSecondLimit
        21 = RunEdgeScript
        22 = OriginMagicContainers
        23 = DisableWAF
        24 = RetryOrigin
        25 = OverrideBrowserCacheResponseHeader
        26 = RemoveBrowserCacheResponseHeader
        27 = DisableShieldChallenge
        28 = DisableShield
        29 = DisableShieldBotDetection
        30 = BypassAwsS3Authentication
        31 = DisableShieldAccessLists
        32 = DisableShieldRateLimiting
        33 = EnableRequestCoalescing
        34 = DisableRequestCoalescing
      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
      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
    Trigger:
      type: object
      additionalProperties: false
      properties:
        Type:
          description: >-
            The type of the trigger. Url = 0, RequestHeader = 1, ResponseHeader
            = 2, UrlExtension = 3, CountryCode = 4, RemoteIP = 5, UrlQueryString
            = 6, RandomChance = 7
          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. MatchAny = 0, MatchAll = 1, MatchNone
            = 2
          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:
          $ref: '#/components/schemas/EdgeRuleActionType'
        ActionParameter1:
          type: string
          nullable: true
        ActionParameter2:
          type: string
          nullable: true
        ActionParameter3:
          type: string
          nullable: true
    TriggerMatchingTypes:
      type: integer
      description: |-
        0 = MatchAny
        1 = MatchAll
        2 = MatchNone
      x-enumNames:
        - MatchAny
        - MatchAll
        - MatchNone
      enum:
        - 0
        - 1
        - 2
    TriggerTypes:
      type: integer
      description: |-
        0 = Url
        1 = RequestHeader
        2 = ResponseHeader
        3 = UrlExtension
        4 = CountryCode
        5 = RemoteIP
        6 = UrlQueryString
        7 = RandomChance
        8 = StatusCode
        9 = RequestMethod
        10 = CookieValue
        11 = CountryStateCode
        12 = OriginRetryAttemptCount
        13 = OriginConnectionError
      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 = MatchAny
        1 = MatchAll
        2 = MatchNone
      x-enumNames:
        - MatchAny
        - MatchAll
        - MatchNone
      enum:
        - 0
        - 1
        - 2
  securitySchemes:
    AccessKey:
      type: apiKey
      description: API Access Key authorization header
      name: AccessKey
      in: header

````