> ## Documentation Index
> Fetch the complete documentation index at: https://omniflow-vpn.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Put v1panelriskrules

> Requires risk.write. A rule that would be skipped at evaluation time — no window, or an alert threshold below the warning — is refused here instead.



## OpenAPI

````yaml https://raw.githubusercontent.com/kewldan/omniflow/main/api/openapi.yaml put /v1/panel/risk/rules/{metric}
openapi: 3.0.3
info:
  title: Omniflow API
  version: 1.0.0
  description: >-
    Customer, commerce, payment, wallet, fulfillment, and operations API for
    Omniflow.
servers: []
security: []
paths:
  /v1/panel/risk/rules/{metric}:
    put:
      tags:
        - panel
      description: >-
        Requires risk.write. A rule that would be skipped at evaluation time —
        no window, or an alert threshold below the warning — is refused here
        instead.
      operationId: savePanelAnomalyRule
      parameters:
        - in: path
          name: metric
          required: true
          schema:
            $ref: '#/components/schemas/PanelAnomalyMetric'
        - $ref: '#/components/parameters/CSRFToken'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PanelAnomalyRuleInput'
      responses:
        '200':
          description: Saved
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PanelAnomalyRule'
        '403':
          $ref: '#/components/responses/Problem'
        '422':
          $ref: '#/components/responses/Problem'
components:
  schemas:
    PanelAnomalyMetric:
      type: string
      enum:
        - traffic
        - purchase
        - refund
        - referral
    PanelAnomalyRuleInput:
      type: object
      required:
        - enabled
        - windowSeconds
        - warnThreshold
        - alertThreshold
        - minimumSample
      properties:
        enabled:
          type: boolean
        windowSeconds:
          type: integer
          format: int64
          minimum: 300
        warnThreshold:
          type: integer
          format: int64
          minimum: 1
        alertThreshold:
          type: integer
          format: int64
          minimum: 1
        minimumSample:
          type: integer
          minimum: 0
    PanelAnomalyRule:
      type: object
      required:
        - metric
        - enabled
        - windowSeconds
        - warnThreshold
        - alertThreshold
        - minimumSample
        - updatedAt
      properties:
        metric:
          $ref: '#/components/schemas/PanelAnomalyMetric'
        enabled:
          type: boolean
        windowSeconds:
          type: integer
          format: int64
          minimum: 300
        warnThreshold:
          type: integer
          format: int64
          minimum: 1
          description: 'In the metric''s own unit: bytes, minor units, or a count.'
        alertThreshold:
          type: integer
          format: int64
          minimum: 1
        minimumSample:
          type: integer
          minimum: 0
        updatedAt:
          type: string
          format: date-time
    Problem:
      type: object
      required:
        - type
        - title
        - status
      properties:
        type:
          type: string
          format: uri
        title:
          type: string
        status:
          type: integer
        detail:
          type: string
        request_id:
          type: string
  parameters:
    CSRFToken:
      in: header
      name: X-CSRF-Token
      required: true
      description: >-
        Echoes the token from the current session. Required on every unsafe
        method.
      schema:
        type: string
  responses:
    Problem:
      description: Request failed
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'

````

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