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

# Update Rule

> Update a Customer Value rule. The rule is addressed by `network_usm_rule_id` **in the request body** — there is no ID in the path.

This is a full replace, not a merge: send every field you want to keep, including the complete `goals` array. Goals are re-created on each update, so they come back with new `network_usm_rule_goal_id` values.


Updates a Customer Value rule.

Two things differ from most Everflow update endpoints:

* **The ID goes in the body, not the path.** Send `network_usm_rule_id` inside the JSON object; the path is the same `/networks/usm/rules` you POST to.
* **It is a full replace, not a merge.** Any field you leave out is reset, and the `goals` array you send replaces the existing goals entirely — they are re-created, so they come back with new `network_usm_rule_goal_id` values. [Fetch the rule](/api-reference/get-networksusmrule) first, change what you need, and send the whole object back.

All the rule combinations listed under [Create Rule](/api-reference/post-networksusmrules) apply here too — including the requirement that `network_offer_payout_revenue_id` be `0` once `network_offer_ids` holds more than one offer.

To pause a rule, send it back with `status` set to `inactive` rather than deleting it.


## OpenAPI

````yaml openapi/customer-value.yaml put /networks/usm/rules
openapi: 3.0.3
info:
  title: Everflow Network API - Customer Value
  description: >
    Endpoints for managing Customer Value — data points and rules — in the
    Everflow network.


    Customer Value was previously called **User Management**, and the API paths
    keep the `usm` prefix from that name.


    A **data point** declares a named customer attribute (`ltv_90d`,
    `plan_tier`) that you send in with conversions. A **rule** watches those
    data points, plus standard conversion metrics, and adjusts payout or revenue
    when a customer's aggregated values meet its goals. For setup, see [Customer
    Value](https://helpdesk.everflow.io/customer/customer-value) in the Help
    Center.
  version: 1.0.0
servers:
  - description: Production Server
    url: https://api.eflow.team/v1
security: []
tags:
  - name: Customer Value
    description: >-
      Data points and rules that drive Customer Value payout and revenue
      adjustments.
  - name: Reporting
    description: Conversion reporting scoped to a single customer.
paths:
  /networks/usm/rules:
    put:
      tags:
        - Customer Value
      summary: Update Rule
      description: >
        Update a Customer Value rule. The rule is addressed by
        `network_usm_rule_id` **in the request body** — there is no ID in the
        path.


        This is a full replace, not a merge: send every field you want to keep,
        including the complete `goals` array. Goals are re-created on each
        update, so they come back with new `network_usm_rule_goal_id` values.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              allOf:
                - type: object
                  required:
                    - network_usm_rule_id
                  properties:
                    network_usm_rule_id:
                      type: integer
                      description: The rule to update.
                - $ref: '#/components/schemas/RuleInput'
            example:
              network_usm_rule_id: 3
              name: High-LTV bonus (Q4)
              status: active
              start_date: '2026-10-01'
              end_date: '2026-12-31'
              network_offer_ids:
                - 1
                - 2
              network_advertiser_ids: []
              network_affiliate_ids: []
              aggregation_level: user_affiliate_offer
              period: monthly
              network_offer_payout_revenue_id: 0
              trigger_type: recurring
              time_window_duration: 30
              goals:
                - metric: data_point
                  metric_data_point_identifier: ltv_90d
                  metric_aggr_function: sum
                  operator: greater_than
                  value_numeric: 400
                - metric: revenue
                  metric_aggr_function: sum
                  operator: greater_than
                  value_numeric: 100
              is_payout_enabled: true
              payout_action: flat_increase
              payout_value: 15
              payout_type: cpa
              payout_percentage: 0
              is_revenue_enabled: false
              revenue_action: unknown
              revenue_value: 0
              revenue_type: blank
              revenue_percentage: 0
      responses:
        '200':
          description: The updated rule.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Rule'
        '400':
          description: A rule constraint was violated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - API Key: []
components:
  schemas:
    RuleInput:
      type: object
      required:
        - name
        - status
        - aggregation_level
        - period
        - trigger_type
        - time_window_duration
        - goals
      properties:
        name:
          type: string
          example: High-LTV bonus
          description: The rule name shown in the Everflow UI.
        status:
          type: string
          enum:
            - active
            - inactive
          description: Whether the rule is evaluated against incoming conversions.
        start_date:
          type: string
          example: '2026-09-01'
          description: 'Date the rule starts applying (format: `YYYY-MM-DD`).'
        end_date:
          type: string
          example: '2026-12-31'
          description: 'Date the rule stops applying (format: `YYYY-MM-DD`).'
        network_offer_ids:
          type: array
          items:
            type: integer
          description: |
            Offers the rule applies to. Leave empty to apply to all offers.
          nullable: true
        network_advertiser_ids:
          type: array
          items:
            type: integer
          description: >-
            Advertisers the rule applies to. Leave empty to apply to all
            advertisers.
          nullable: true
        network_affiliate_ids:
          type: array
          items:
            type: integer
          description: Partners the rule applies to. Leave empty to apply to all partners.
          nullable: true
        aggregation_level:
          type: string
          enum:
            - user
            - user_offer
            - user_affiliate
            - user_advertiser
            - user_affiliate_offer
            - user_affiliate_advertiser
          description: >
            How customer activity is grouped before goals are evaluated. `user`
            aggregates all of a customer's activity across the network; the
            compound levels keep a separate total per partner, offer or
            advertiser.
        period:
          type: string
          enum:
            - daily
            - weekly
            - monthly
            - quarterly
            - global
            - since_user_sign_up
          description: >
            The window the aggregation resets on. `global` and
            `since_user_sign_up` never reset, and are the only periods allowed
            with a `one_time` trigger.
        network_offer_payout_revenue_id:
          type: integer
          description: >
            Restrict the rule to one specific offer payout/revenue entry
            (event). Send `0` to apply to every event on the selected offers.
            Cannot be set when `network_offer_ids` holds more than one offer.
        trigger_type:
          type: string
          enum:
            - one_time
            - recurring
          description: >
            Whether the rule fires once per customer (`one_time`) or every time
            the goals are met (`recurring`). `one_time` requires a non-resetting
            `period`, and forces `payout_action` `exact` with `payout_type`
            `cpa`.
        time_window_duration:
          type: integer
          example: 30
          description: >
            How many days of customer history the rule looks back over. Must be
            greater than `0`.
        goals:
          type: array
          description: >
            The conditions a customer must meet. All goals must match. Replaced
            wholesale on every update.
          items:
            $ref: '#/components/schemas/RuleGoal'
        is_payout_enabled:
          type: boolean
          description: Whether the rule adjusts partner payout.
        payout_action:
          type: string
          enum:
            - exact
            - increase
            - decrease
            - flat_increase
            - flat_decrease
            - unknown
          description: >
            How payout is adjusted. `exact` sets the payout outright,
            `flat_increase` and `flat_decrease` add or subtract `payout_value`,
            and `increase` and `decrease` apply `payout_percentage`. Send
            `unknown` when `is_payout_enabled` is `false`.
        payout_value:
          type: number
          format: double
          description: >-
            The flat amount used by `exact`, `flat_increase` and
            `flat_decrease`.
        payout_type:
          type: string
          enum:
            - cpa
            - cpc
            - cpm
            - cps
            - cpa_cps
            - prv
            - blank
          description: >
            The payout model the adjusted payout is written as. Rules support
            these six models; the SKU variants available on an offer (`cpa_sku`,
            `cps_sku`, …) are not supported here.


            Required with `payout_action: exact` (`blank` is rejected there with
            `Must define a payout type if payout action is 'exact'`), and must
            be `cpa` for `one_time` rules. The flat actions apply `payout_value`
            directly and ignore it — send `blank`.
        payout_percentage:
          type: number
          format: double
          description: The percentage used by the `increase` and `decrease` actions.
        is_revenue_enabled:
          type: boolean
          description: Whether the rule adjusts advertiser revenue.
        revenue_action:
          type: string
          enum:
            - exact
            - increase
            - decrease
            - flat_increase
            - flat_decrease
            - unknown
          description: >
            How revenue is adjusted, mirroring `payout_action`. Send `unknown`
            when `is_revenue_enabled` is `false`.
        revenue_value:
          type: number
          format: double
          description: >-
            The flat amount used by `exact`, `flat_increase` and
            `flat_decrease`.
        revenue_type:
          type: string
          enum:
            - rpa
            - rpc
            - rpm
            - rps
            - rpa_rps
            - blank
          description: >
            The revenue model the adjusted revenue is written as. Rules support
            these five models. Required with `revenue_action: exact` (`blank` is
            rejected there with `Must define a revenue type if revenue action is
            'exact'`); the flat actions ignore it.
        revenue_percentage:
          type: number
          format: double
          description: The percentage used by the `increase` and `decrease` actions.
    Rule:
      allOf:
        - type: object
          properties:
            network_usm_rule_id:
              type: integer
              example: 3
              description: Unique rule ID.
            network_id:
              type: integer
              example: 1
              description: Network ID.
        - $ref: '#/components/schemas/RuleInput'
        - type: object
          properties:
            time_created:
              type: integer
              example: 1788398644
              description: Unix timestamp of creation.
            time_saved:
              type: integer
              example: 1788398704
              description: Unix timestamp of last update.
            relationship:
              type: object
              description: Related objects for the rule.
    Error:
      type: object
      properties:
        error:
          type: string
          description: A human-readable description of what was rejected.
    RuleGoal:
      type: object
      properties:
        network_usm_rule_goal_id:
          type: integer
          description: >
            Unique goal ID. Assigned by Everflow; goals are re-created on every
            rule update, so this value changes.
        metric:
          type: string
          enum:
            - data_point
            - conversion
            - event
            - payout
            - revenue
            - sale_amount
          description: >
            What the goal measures. Use `data_point` to measure one of your own
            data points, named in `metric_data_point_identifier`.


            `event` cannot be combined with a `network_offer_payout_revenue_id`
            that points at the offer's base event — that returns `An event goal
            cannot be defined if the selected event is the base event`. Send
            `network_offer_payout_revenue_id: 0`, or target a non-base event.
        metric_data_point_identifier:
          type: string
          example: ltv_90d
          description: >
            The `identifier` of the data point to measure. Required when
            `metric` is `data_point`, ignored otherwise.
        metric_aggr_function:
          type: string
          enum:
            - sum
            - min
            - max
            - current
            - all
            - some
          description: >
            How values are aggregated over the rule's `period` before
            comparison. Use `current` to compare the latest value only.
        operator:
          type: string
          enum:
            - greater_than
            - less_than
            - equals
            - exact_match
            - contains
            - begins_with
            - ends_with
          description: >
            How the aggregated value is compared. Use the numeric operators with
            `value_numeric` and the string operators with `value_string`.
        value_numeric:
          type: number
          format: double
          description: The threshold for numeric comparisons.
        value_string:
          type: string
          description: The threshold for string comparisons.
  securitySchemes:
    API Key:
      description: The Everflow API key generated from the Control Center > Security.
      in: header
      name: X-Eflow-Api-Key
      type: apiKey

````