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

# Update a settlement rule

> Update an existing settlement rule. This will replace all existing rules with the new configuration.




## OpenAPI

````yaml https://production.hifi.com/api/v2/openapi.json post /v2/virtual-accounts/settlement-rules/{ruleId}/update
openapi: 3.0.0
info:
  title: Hifi API
  version: 2.0.0
  description: API documentation for Hifi
servers:
  - url: https://production.hifibridge.com
    description: Production server
  - url: https://sandbox.hifibridge.com
    description: Sandbox server
security:
  - bearerAuth: []
tags:
  - name: Common
    description: Common endpoints
  - name: User
    description: User endpoints
  - name: Kyc
    description: Kyc endpoints
  - name: Wallet
    description: Wallet endpoints
  - name: Account
    description: Account endpoints
  - name: External Account
    description: External Account endpoints for managing beneficiary bank accounts
  - name: Fiat Account
    description: Fiat Account endpoints
  - name: Virtual Account
    description: Virtual Account endpoints
  - name: Onramp
    description: Onramp endpoints
  - name: Offramp
    description: Offramp endpoints
  - name: Orchestration Address
    description: >-
      Orchestration Address endpoints — persistent on-chain wallets that
      automatically off-ramp incoming stablecoin deposits to a USD bank account
  - name: Crypto Transfer
    description: Crypto Transfer endpoints
  - name: Cross-Chain Bridge
    description: Cross-Chain Bridge endpoints
  - name: Token Swap
    description: Token Swap endpoints
  - name: Canton Offers
    description: Canton Offers endpoints
  - name: Transfer Rules
    description: Transfer approval rules and configuration
  - name: Transfer Approvals
    description: Transfer approval workflow and admin actions
  - name: File
    description: File endpoints
  - name: Reporting
    description: Reporting and metrics endpoints
paths:
  /v2/virtual-accounts/settlement-rules/{ruleId}/update:
    post:
      tags:
        - Settlement Rules
      summary: Update a settlement rule
      description: >
        Update an existing settlement rule. This will replace all existing rules
        with the new configuration.
      parameters:
        - $ref: '#/components/parameters/RuleIdPathParameter'
      requestBody:
        $ref: '#/components/requestBodies/UpdateSettlementRuleBody'
      responses:
        '200':
          $ref: '#/components/responses/UpdateSettlementRuleResponse'
        '401':
          $ref: '#/components/responses/UnauthorizedResponse'
        '404':
          $ref: '#/components/responses/NotFoundResponse'
        '500':
          $ref: '#/components/responses/InternalServerErrorResponse'
components:
  parameters:
    RuleIdPathParameter:
      name: ruleId
      in: path
      schema:
        type: string
      description: ID of the settlement rule
      required: true
  requestBodies:
    UpdateSettlementRuleBody:
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UpdateSettlementRule'
  responses:
    UpdateSettlementRuleResponse:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SettlementRuleResponse'
          examples:
            SettlementRuleObjectExample:
              $ref: '#/components/examples/SettlementRuleObjectExample'
    UnauthorizedResponse:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Unauthorized'
    NotFoundResponse:
      description: Resource not found
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                enum:
                  - error
              error:
                type: object
                properties:
                  code:
                    type: string
                  message:
                    type: string
    InternalServerErrorResponse:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InternalServerError'
  schemas:
    UpdateSettlementRule:
      type: object
      title: Update Settlement Rule
      properties:
        requestId:
          type: string
          description: Unique identifier for the request (recommend using uuid v4)
          example: '{{$guid}}'
        chain:
          type: string
          enum:
            - BASE
            - POLYGON
            - ETHEREUM
            - SOLANA
            - TRON
          description: Blockchain network for the settlement rule
          example: BASE
        includeHIFIFee:
          type: boolean
          description: Whether to include HiFi's fee in addition to custom rules
          example: false
        rules:
          type: array
          items:
            $ref: '#/components/schemas/SettlementRule'
          description: Array of settlement rules
          minItems: 1
      required:
        - requestId
        - chain
        - includeHIFIFee
        - rules
    SettlementRuleResponse:
      type: object
      title: Settlement Rule Response
      properties:
        id:
          type: string
          description: Unique identifier for the settlement rule
          example: 15c786fb-de7a-520c-a4b3-f312d4a122d2
        chain:
          type: string
          enum:
            - BASE
            - POLYGON
            - ETHEREUM
            - SOLANA
            - TRON
          description: Blockchain network for the settlement rule
          example: BASE
        includeHIFIFee:
          type: boolean
          description: >-
            Whether to include HiFi's fee in addition to custom rules, please
            contact HiFi support if you want to include HiFi's fee
          example: false
        rules:
          type: array
          items:
            $ref: '#/components/schemas/SettlementRule'
          description: Array of settlement rules
      required:
        - id
        - chain
        - includeHIFIFee
        - rules
    Unauthorized:
      type: object
      properties:
        code:
          type: integer
          description: Error code
        error:
          type: string
          description: Error type
        errorDetails:
          type: string
          description: Detailed error message
    InternalServerError:
      type: object
      properties:
        code:
          type: integer
          description: Error code
        error:
          type: string
          description: Error type
        errorDetails:
          type: string
          description: Detailed error message
    SettlementRule:
      type: object
      title: Settlement Rule
      properties:
        type:
          type: string
          enum:
            - PERCENTAGE
            - FIXED
          description: Type of fee calculation
          example: PERCENTAGE
        calculationModel:
          type: string
          enum:
            - FIXED
            - TIERED
          description: Model for calculating the fee
          example: FIXED
        value:
          type: number
          nullable: true
          description: Fixed fee value (omit for tiered calculation model)
          example: 0.001
        tiers:
          type: array
          nullable: true
          items:
            $ref: '#/components/schemas/SettlementRuleTier'
          description: Tiered fee structure (omit for fixed calculation model)
        walletAddress:
          type: string
          description: Wallet address to receive the fee
          example: '0x15FB50680fEB2f726413416665c25f9B397b047b'
      required:
        - type
        - calculationModel
        - walletAddress
    SettlementRuleTier:
      type: object
      title: Settlement Rule Tier
      properties:
        min:
          type: string
          description: >-
            Minimum value for this tier (empty string is required for first
            tier)
          example: '1000'
        max:
          type: string
          description: Maximum value for this tier (empty string is required for last tier)
          example: '2000'
        value:
          type: number
          description: Fee value for this tier
          example: 0.0005
      required:
        - min
        - max
        - value
  examples:
    SettlementRuleObjectExample:
      summary: Settlement Rule Object
      value:
        id: 15c786fb-de7a-520c-a4b3-f312d4a122d2
        chain: BASE
        includeHIFIFee: false
        rules:
          - type: PERCENTAGE
            calculationModel: FIXED
            value: 0.001
            tiers: null
            walletAddress: '0x15FB50680fEB2f726413416665c25f9B397b047b'
          - type: FIXED
            calculationModel: FIXED
            value: 0.5
            tiers: null
            walletAddress: '0x15FB50680fEB2f726413416665c25f9B397b047b'
          - type: PERCENTAGE
            calculationModel: TIERED
            value: null
            tiers:
              - max: '1000'
                min: ''
                value: 0.0007
              - max: '2000'
                min: '1000'
                value: 0.0005
              - max: ''
                min: '2000'
                value: 0.0002
            walletAddress: '0x15FB50680fEB2f726413416665c25f9B397b047b'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````