openapi: 3.1.0
info:
  title: Brand Routing Rules API
  version: v11
  description: "Routing Rules control where traffic is sent when they click on a link. \nTraffic can be redirected, blocked, or shown an interstitial page based on \nspecific conditions like IP address, country, or device type.\n"
servers:
- url: https://api.impact.com
security:
- basicAuth: []
paths:
  /Advertisers/{AccountSID}/Programs/{ProgramId}/BlockRedirectRules:
    get:
      operationId: listRoutingRules
      tags:
      - Routing Rules
      summary: List all routing rules
      description: Returns a list of all routing rules within a specific program.
      parameters:
      - name: AccountSID
        in: path
        required: true
        description: The unique identifier for the account.
        schema:
          type: string
      - name: ProgramId
        in: path
        required: true
        description: The ID of the program the rules belong to.
        schema:
          type: integer
      - name: Name
        in: query
        required: false
        description: Filter rules by name.
        schema:
          type: string
      - name: Condition
        in: query
        required: false
        schema:
          type: string
          enum:
          - IP_ADDRESS
          - SHARED_ID
          - COUNTRY
          - REGION
          - AD_STATUS
          - SUB_ID1
          - SUB_ID2
          - SUB_ID3
          - MP_ID
          - DEVICE_TYPE
          - REF_URL
          - LANDING_PAGE
          - SKU
          - AD_ID
          - CURRENT_DATE
          - RANDOM
          - MOBILE_FALLBACK
      - name: Action
        in: query
        required: false
        schema:
          type: string
          enum:
          - REDIRECT
          - BLOCK
          - INTERSTITIAL
      - name: Rank
        in: query
        required: false
        schema:
          type: string
          enum:
          - HIGH
          - MEDIUM
          - LOW
      - name: State
        in: query
        required: false
        schema:
          type: string
          enum:
          - RUNNING
          - PAUSED
          - ENDED
          - ARCHIVED
      - name: StartDateBefore
        in: query
        description: Return routing rules that start before a specific date and time (ISO 8601).
        schema:
          type: string
          format: date-time
      - name: StartDateAfter
        in: query
        description: Return routing rules that start after a specific date and time (ISO 8601).
        schema:
          type: string
          format: date-time
      - name: EndDateBefore
        in: query
        description: Return routing rules that end before a specific date and time (ISO 8601).
        schema:
          type: string
          format: date-time
      - name: EndDateAfter
        in: query
        description: Return routing rules that end after a specific date and time (ISO 8601).
        schema:
          type: string
          format: date-time
      - name: DateLastUpdateBefore
        in: query
        description: Return routing rules that were last updated before a specific date and time (ISO 8601).
        schema:
          type: string
          format: date-time
      - name: DateLastUpdatedAfter
        in: query
        description: Return routing rules that were last updated after a specific date and time (ISO 8601).
        schema:
          type: string
          format: date-time
      - name: DateCreatedBefore
        in: query
        description: Return routing rules that were created before a specific date and time (ISO 8601).
        schema:
          type: string
          format: date-time
      - name: DateCreatedAfter
        in: query
        description: Return routing rules that were created after a specific date and time (ISO 8601).
        schema:
          type: string
          format: date-time
      - name: CreatedBy
        in: query
        description: Return routing rules that were created by a specific account user.
        schema:
          type: string
      - name: LastUpdatedBy
        in: query
        description: Return routing rules that were last updated by a specific account user.
        schema:
          type: string
      - name: Source
        in: query
        description: "From where the routing rule was created. Possible values:\n- `GENERIC` — Created via the Create-a-routing-rule endpoint or the Blocking and Redirect Technical Settings screen.\n- `AD` — Created when an associated ad was created.\n- `COMPLIANCE` — Created as the result of a Compliance violation.\n- `TASK` — Created from the web app's Task Management system."
        schema:
          type: string
      responses:
        '200':
          description: A list of routing rule objects.
          content:
            application/json:
              schema:
                type: object
                properties:
                  BlockRedirectRules:
                    type: array
                    description: The list of routing rule objects.
                    items:
                      $ref: '#/components/schemas/RoutingRule'
  /Advertisers/{AccountSID}/Programs/{ProgramId}/BlockRedirectRules/{RuleId}:
    get:
      operationId: getRoutingRule
      tags:
      - Routing Rules
      summary: Retrieve a routing rule
      description: Retrieves the full object details for a specific routing rule.
      parameters:
      - name: AccountSID
        in: path
        required: true
        description: The unique identifier for the account.
        schema:
          type: string
      - name: ProgramId
        in: path
        required: true
        description: The ID of the program the rule belongs to.
        schema:
          type: integer
      - name: RuleId
        in: path
        required: true
        description: The unique identifier for the routing rule.
        schema:
          type: integer
      responses:
        '200':
          description: A single routing rule object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoutingRule'
components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
  schemas:
    RoutingRule:
      type: object
      properties:
        Id:
          type: string
          description: The unique identifier for the routing rule.
          example: '50000'
        Name:
          type: string
          description: Name of the routing rule.
          example: Redirect 4
        Condition:
          type: array
          description: What triggers the routing rule.
          items:
            $ref: '#/components/schemas/Condition'
        Action:
          type: string
          description: What traffic will experience if the routing rule is triggered.
          enum:
          - REDIRECT
          - BLOCK
          - INTERSTITIAL
          example: REDIRECT
        RedirectUrl:
          type: string
          format: uri
          description: The destination URL for REDIRECT-type rules.
          example: http://impact.com
        Interstitial:
          $ref: '#/components/schemas/Interstitial'
          description: Interstitial page configuration for INTERSTITIAL-type rules.
        Rank:
          type: string
          description: This determines the specific routing rule's rank in relation to others that have the same conditions.
          enum:
          - HIGH
          - MEDIUM
          - LOW
          example: HIGH
        State:
          type: string
          description: What state of use the routing rule is in.
          enum:
          - RUNNING
          - PAUSED
          - ENDED
          - ARCHIVED
          example: RUNNING
        Source:
          type: string
          description: From where the routing rule was created.
          enum:
          - GENERIC
          - AD
          - COMPLIANCE
          - TASK
          example: GENERIC
        StartDate:
          type: string
          format: date-time
          nullable: true
          description: The date and time the rule becomes active.
          example: '2026-01-01T00:00:00-08:00'
        EndDate:
          type: string
          format: date-time
          nullable: true
          description: The date and time the rule expires.
          example: '2026-12-31T23:59:59-08:00'
        DateCreated:
          type: string
          format: date-time
          description: The date and time the rule was created.
          example: '2019-10-28T17:53:01-04:00'
        DateLastUpdated:
          type: string
          format: date-time
          description: The date and time the rule was last updated.
          example: '2019-10-28T17:53:01-04:00'
        CreatedBy:
          type: string
          description: The account user that created the rule.
          example: ACME Corp
        LastUpdatedBy:
          type: string
          description: The account user that last updated the rule.
          example: ACME Corp
        Uri:
          type: string
          format: uri-reference
          description: The unique reference to this routing rule in the impact.com API.
          example: /Advertisers/<AccountSID>/Programs/1000/BlockRedirectRules/50000
    Condition:
      type: object
      properties:
        SubConditions:
          type: array
          description: A group of sub-conditions that must all be true for this condition to match (AND logic).
          items:
            $ref: '#/components/schemas/SubCondition'
    SubCondition:
      type: object
      properties:
        Variable:
          type: string
          description: The variable to evaluate against.
          enum:
          - IP_ADDRESS
          - SHARED_ID
          - COUNTRY
          - REGION
          - AD_STATUS
          - SUB_ID1
          - SUB_ID2
          - SUB_ID3
          - MP_ID
          - DEVICE_TYPE
          - REF_URL
          - LANDING_PAGE
          - SKU
          - AD_ID
          - CURRENT_DATE
          - RANDOM
          - MOBILE_FALLBACK
          example: COUNTRY
        Operator:
          type: string
          description: How the variable is compared to the values.
          enum:
          - CONTAINS
          - STARTS_WITH
          - ENDS_WITH
          - EQUALS
          - MATCHES
          - IP_RANGE
          - IN
          - NOT_CONTAINS
          - NOT_STARTS_WITH
          - NOT_ENDS_WITH
          - NOT_EQUALS
          - NOT_IN
          - REGEX
          - LT
          - GT
          example: IN
        Values:
          type: array
          description: The values the variable is compared to.
          items:
            type: string
            example: US
    Interstitial:
      type: object
      properties:
        HeaderText:
          type: string
          description: Header text displayed on the interstitial page.
          example: Welcome to Acme
        BodyText:
          type: string
          description: Body text displayed on the interstitial page.
          example: Please confirm your details to continue.
        RequireUserAcknowledgement:
          type: boolean
          description: Whether the user must acknowledge before continuing.
          example: true
        ButtonText:
          type: string
          description: Text shown on the acknowledgement button.
          example: Continue
        ButtonColor:
          type: string
          description: Color of the acknowledgement button.
          example: '#FF0000'
        RequireUserInput:
          type: boolean
          description: Whether the user must provide input before continuing.
          example: true
        UserInputs:
          type: array
          description: User input fields shown on the interstitial.
          items:
            $ref: '#/components/schemas/UserInput'
        IncludeSkipOption:
          type: boolean
          description: Whether to include a skip option.
          example: false
        ShowPageAtLeastOnce:
          type: boolean
          description: Whether the page must be shown at least once per session.
          example: true
        CoBranded:
          type: boolean
          description: Whether the interstitial is co-branded.
          example: false
        CustomizeCss:
          type: boolean
          description: Whether custom CSS is used.
          example: false
        CustomCss:
          type: string
          description: Custom CSS for styling the interstitial page.
          example: ''
    UserInput:
      type: object
      properties:
        Variable:
          type: string
          description: The variable the user input populates.
          enum:
          - SHARED_ID
          - SUB_ID1
          - SUB_ID2
          - SUB_ID3
          - PARAM1
          - PARAM2
          - PARAM3
          - CUSTOMER_ID
        DisplayValue:
          type: string
          description: Display label shown to the user.
          example: Email Address
        RegularExpression:
          type: string
          description: Validation pattern for the input.
          example: ^[^@]+@[^@]+\.[^@]+$
        ErrorMessage:
          type: string
          description: Error message shown if validation fails.
          example: Please enter a valid email address.
