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

# Update a fee policy

> Requires the fee_policy.edit permission.

Update an existing fee policy for the authenticated company. All fields are optional,
allowing partial updates. The fee policy must belong to the authenticated company.

**Rule Update Behavior:**
- Rules with IDs: Updates those specific rules while preserving unmentioned rules
- Rules without IDs: Creates new rules and adds them to the policy
- Rules not mentioned: Remain unchanged and preserved
- When updating a rule's conditions, conditions for that rule are replaced (not merged)




## OpenAPI

````yaml /api-spec.yaml patch /v1/pricing/fee-policies/{id}
openapi: 3.1.0
info:
  title: Rinne API
  version: 1.0.0
  description: >
    **Rinne API** is a robust payment platform that offers integration with
    multiple payment providers.


    ## Authentication


    The API uses API Key authentication via the `x-api-key` header. Each company
    has a unique key to access resources.


    ## Response Format


    All responses follow a consistent format:

    - **Success**: Returns the requested data directly

    - **Error**: Returns an `error` object with detailed information


    ## Pagination


    Endpoints that return lists support pagination through parameters:

    - `page`: Page number (default: 1)

    - `limit`: Items per page (default: 20, maximum: 100)


    ## Supported Providers


    The API supports multiple payment providers:

    - **Rinne**: Internal provider

    - **Celcoin**: PIX integration and other financial services


    ## Raw Card Data (PCI Endpoints)


    Card credential fields (`card_data.number`, `card_data.cvv`,
    `card_data.network_token`,

    `card_data.cryptogram`, and the 3DS `card.number`) must always be sent
    encrypted —

    values start with the `ev:` prefix. Plaintext values are rejected with

    `400 VALIDATION_ERROR` on every host.


    There are two ways to send encrypted values:

    - **rinne-js**: card forms and wallet buttons (Apple Pay / Google Pay)
    encrypt
      credentials client-side before they leave the browser.
    - **PCI API host**: server-to-server integrations that handle raw card data
    must call
      `https://pci.api.rinne.com.br/core` (sandbox: `https://pci.api-sandbox.rinne.com.br/core`)
      instead of the regular host. This endpoint encrypts `number` and `cvv` in transit
      before the request reaches the API; all other fields pass through unchanged.

    The PCI host serves only transaction creation and 3DS session creation (both
    the

    self and merchant variants); use the regular host for everything else.
  contact:
    name: Rinne API Support
    email: suporte@rinne.com.br
servers:
  - url: https://api-sandbox.rinne.com.br/core
    description: Sandbox
  - url: https://api.rinne.com.br/core
    description: Production
security: []
tags:
  - name: System
    description: System and API health endpoints
  - name: Authentication
    description: User authentication and authorization endpoints
  - name: Management
    description: >-
      Merchant management endpoints - create, list, get specific, overview,
      update
  - name: Transactions
    description: Transaction operations for merchants - create, list, overview, refunds
  - name: Affiliations
    description: Affiliation management for merchants
  - name: Banking
    description: Banking operations for merchants - balance, cashout, statements
  - name: Bank Accounts
    description: Bank account management for merchants
  - name: Pix Keys
    description: PIX key management for merchants
  - name: Company Transactions
    description: Direct transaction management and query endpoints for companies
  - name: Companies
    description: Company management
  - name: Company Affiliations
    description: Payment provider affiliation management
  - name: Company Banking
    description: Company banking endpoints (balance, etc.)
  - name: Company Pix
    description: Company PIX key management
  - name: Company Ledger
    description: Company ledger entry query endpoints
  - name: Ledger
    description: Ledger entry query endpoints (company and merchants)
  - name: Cards
    description: Stored card management (self and merchant)
  - name: Webhooks
    description: Endpoints for receiving webhooks from external providers
  - name: Pricing
    description: Fee and cost policy management for transaction pricing
  - name: Users
    description: User management endpoints
  - name: Roles
    description: Role management endpoints
  - name: Permissions
    description: Permission management endpoints
paths:
  /v1/pricing/fee-policies/{id}:
    patch:
      tags:
        - Pricing
      summary: Update a fee policy
      description: >
        Requires the fee_policy.edit permission.


        Update an existing fee policy for the authenticated company. All fields
        are optional,

        allowing partial updates. The fee policy must belong to the
        authenticated company.


        **Rule Update Behavior:**

        - Rules with IDs: Updates those specific rules while preserving
        unmentioned rules

        - Rules without IDs: Creates new rules and adds them to the policy

        - Rules not mentioned: Remain unchanged and preserved

        - When updating a rule's conditions, conditions for that rule are
        replaced (not merged)
      parameters:
        - name: id
          in: path
          required: true
          description: The ID of the fee policy to update
          schema:
            type: string
            format: uuid
          example: 123e4567-e89b-12d3-a456-426614174000
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateFeePolicyDto'
            examples:
              update-name-and-status:
                summary: Update name and active status
                value:
                  name: updated-fee-policy
                  is_active: false
              update-cashout-price:
                summary: Update cashout price
                value:
                  cashout_price: 500
              update-specific-rule:
                summary: Update a specific rule by ID (others preserved)
                description: >
                  Updates only rule with the given ID. Other rules remain
                  unchanged.

                  Include the rule ID from the policy's existing rules.
                value:
                  rules:
                    - id: 550e8400-e29b-41d4-a716-446655440000
                      conditions:
                        - field: transaction.amount
                          operator: GREATER_THAN
                          value: 10000
                      price:
                        percentage: 1.5
                        flat: 50
                        minimum_price: 50
                      priority: 1
              add-new-rule:
                summary: Add a new rule (existing rules preserved)
                description: |
                  Creates a new rule without affecting existing rules.
                  Omit the ID to create a new rule.
                value:
                  rules:
                    - conditions:
                        - field: transaction.installments
                          operator: GREATER_OR_EQUAL
                          value: 12
                      price:
                        percentage: 4
                        flat: 200
                      priority: 3
              update-multiple-fields:
                summary: Update multiple fields at once
                value:
                  name: premium-card-fees
                  description: Updated premium fee structure
                  is_active: true
                  cashout_price: 750
                  rules:
                    - conditions:
                        - field: transaction.payment_method
                          operator: EQUALS
                          value: CREDIT_CARD
                      price:
                        percentage: 3.5
                      priority: 1
                    - conditions: []
                      price:
                        percentage: 4
                      priority: 99
      responses:
        '200':
          description: Fee policy updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FeePolicyResponseDto'
        '400':
          description: >-
            Validation error (invalid fields, empty payload, duplicate
            priorities, etc.)
        '401':
          description: Unauthorized - Invalid or missing API key
        '404':
          description: Fee policy not found or does not belong to the authenticated company
        '500':
          description: Internal server error
      security:
        - ApiKeyAuth: []
components:
  schemas:
    UpdateFeePolicyDto:
      type: object
      description: >
        Fee policy update request. All fields are optional.

        Rules can be selectively updated by including their ID, or new rules can
        be added by omitting the ID.
      properties:
        name:
          type: string
          pattern: ^[a-zA-Z0-9_-]+$
          minLength: 1
          maxLength: 100
        description:
          type: string
          maxLength: 500
        is_active:
          type: boolean
        cashout_price:
          type: integer
          minimum: 0
          description: Cashout price in cents (fixed fee for cashout operations)
          example: 350
        automatic_anticipation_percentage:
          $ref: '#/components/schemas/AnticipationRate'
        spot_anticipation_percentage:
          $ref: '#/components/schemas/AnticipationRate'
        rules:
          type: array
          minItems: 1
          description: >
            Rules to update or add. Rules with IDs update existing rules (others
            preserved).

            Rules without IDs create new rules. Omitted rules remain unchanged.
          items:
            type: object
            required:
              - conditions
              - price
              - priority
            properties:
              id:
                type: string
                format: uuid
                description: >
                  Optional. Include to update an existing rule (other rules
                  preserved).

                  Omit to create a new rule. Must match an existing rule ID in
                  the policy.
                example: 550e8400-e29b-41d4-a716-446655440000
              conditions:
                type: array
                items:
                  $ref: '#/components/schemas/Condition'
              price:
                $ref: '#/components/schemas/PricingValue'
              priority:
                type: integer
                minimum: 1
    FeePolicyResponseDto:
      type: object
      description: Fee policy response
      properties:
        id:
          type: string
          description: Policy ID
          example: a3dbd0c2-9f79-4f86-8caa-47779b3f2793
        name:
          type: string
          example: standard-card-fees
        description:
          type:
            - string
            - 'null'
          example: Standard fee structure for card transactions
        is_active:
          type: boolean
          example: true
        cashout_price:
          type: integer
          description: Cashout price in cents (fixed fee for cashout operations)
          example: 350
        automatic_anticipation_percentage:
          $ref: '#/components/schemas/AnticipationRate'
        spot_anticipation_percentage:
          $ref: '#/components/schemas/AnticipationRate'
        organization_id:
          type: string
          description: Organization company ID
          example: a3dbd0c2-9f79-4f86-8caa-47779b3f2794
        rules:
          type: array
          items:
            $ref: '#/components/schemas/PricingRule'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    AnticipationRate:
      type: number
      minimum: 0
      maximum: 100
      multipleOf: 0.0001
      description: Monthly anticipation rate as a percentage (up to 4 decimal places)
      example: 2.4999
    Condition:
      type: object
      description: Rule condition for transaction field evaluation
      required:
        - field
        - operator
        - value
      properties:
        field:
          type: string
          pattern: ^transaction(\.[a-zA-Z_][a-zA-Z0-9_]*)+$
          description: >
            Dotted path to any field exposed by the public transaction response
            schema, with arbitrary nesting depth (e.g., "transaction.amount",
            "transaction.card_data.brand", "transaction.consumer.address.city").
            Subkeys under "transaction.metadata" are also accepted because
            metadata is an arbitrary record. Paths that point to a non-primitive
            (e.g., "transaction.card_data") or to a field not present in the
            response schema are rejected at create/update time.
          example: transaction.card_data.brand
        operator:
          type: string
          enum:
            - EQUALS
            - NOT_EQUALS
            - GREATER_THAN
            - LESS_THAN
            - GREATER_OR_EQUAL
            - LESS_OR_EQUAL
            - IN
            - NOT_IN
          description: Comparison operator
          example: EQUALS
        value:
          oneOf:
            - type: string
            - type: number
            - type: boolean
            - type: array
              items:
                oneOf:
                  - type: string
                  - type: number
                  - type: boolean
          description: >
            Value to compare against (array for 'IN'/'NOT_IN' operators). Use
            boolean true/false for boolean fields such as
            automatic_anticipation.
          example: CREDIT_CARD
    PricingValue:
      type: object
      description: >-
        Pricing structure with percentage, flat fee, and minimum price. At least
        one pricing component must be provided.
      anyOf:
        - required:
            - percentage
        - required:
            - flat
        - required:
            - minimum_price
      properties:
        percentage:
          type:
            - number
            - 'null'
          format: float
          minimum: 0
          description: Percentage fee (e.g., 2.5 for 2.5%)
          example: 2.5
        flat:
          type:
            - number
            - 'null'
          format: float
          minimum: 0
          description: Flat fee in cents
          example: 50
        minimum_price:
          type:
            - number
            - 'null'
          format: float
          minimum: 0
          description: Minimum fee in cents
          example: 100
    PricingRule:
      type: object
      description: Individual pricing rule with conditions and pricing
      required:
        - conditions
        - price
        - priority
      properties:
        id:
          type: string
          description: System-generated rule ID
          example: a3dbd0c2-9f79-4f86-8caa-47779b3f2793
        conditions:
          type: array
          items:
            $ref: '#/components/schemas/Condition'
          description: Array of conditions (empty array means applies to all)
        price:
          $ref: '#/components/schemas/PricingValue'
        priority:
          type: integer
          minimum: 1
          description: Rule priority (1 = highest priority)
          example: 1
        created_at:
          type: string
          format: date-time
          description: Rule creation timestamp
        updated_at:
          type: string
          format: date-time
          description: Rule last update timestamp
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Company API key for authentication

````