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

# Update a Package

> Use this endpoint to update a specific package. Send only the fields you want to change — any fields not included will remain unchanged. Ideal for partial updates without overwriting the entire configuration.



## OpenAPI

````yaml /en/openapi/v3-current/fees-engine.yaml patch /v1/packages/{id}
openapi: 3.1.0
info:
  title: Fees Engine
  description: ''
  version: 3.2.0
servers:
  - url: https://fees.sandbox.lerian.net
security: []
tags:
  - name: Fees Engine
paths:
  /v1/packages/{id}:
    patch:
      tags:
        - Packages API
      summary: Update a Package
      description: >-
        Use this endpoint to update a specific package. Send only the fields you
        want to change — any fields not included will remain unchanged. Ideal
        for partial updates without overwriting the entire configuration.
      parameters:
        - $ref: '#/components/parameters/PackageId'
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/ContentType'
        - $ref: '#/components/parameters/XOrganizationId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PackageUpdate'
            example:
              feeGroupLabel: Standard Package
              description: Package for testing
              minimumAmount: '3000.00'
              maximumAmount: '6000.00'
              waivedAccounts:
                - customer-brl-1
                - customer-brl-2
                - customer-brl-3
              fees:
                admFee:
                  feeLabel: Administrative Fee
                  calculationModel:
                    applicationRule: flatFee
                    calculations:
                      - type: flat
                        value: '16.00'
                  referenceAmount: originalAmount
                  priority: 1
                  isDeductibleFrom: true
                  creditAccount: business-brl-1
                  routeFrom: 019c96a0-1071-7a0d-9916-a831221de252
                  routeTo: 019c96a0-108c-7a74-8e31-3789daffe1ed
                iof:
                  feeLabel: IOF
                  calculationModel:
                    applicationRule: percentual
                    calculations:
                      - type: percentage
                        value: '6.00'
                  referenceAmount: afterFeesAmount
                  priority: 2
                  isDeductibleFrom: false
                  creditAccount: business-brl-2
              enable: true
      responses:
        '200':
          description: >-
            Indicates that the resource was successfully created and the
            operation was completed as expected.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatePackagesResponse'
              example:
                id: 0194dc48-b6ab-728d-9b02-56bff488489a
                feeGroupLabel: Standard Package
                description: Package for testing
                transactionRoute: 019c96a0-10a0-72d2-9fb0-2b7de8093182
                segmentId: 019c96a0-0b4e-7079-8be0-ab6bdccf975f
                ledgerId: 019c96a0-0ac0-7de9-9f53-9cf842a2ee5a
                minimumAmount: '3000.00'
                maximumAmount: '6000.00'
                waivedAccounts:
                  - customer-brl-1
                  - customer-brl-2
                  - customer-brl-3
                fees:
                  admFee:
                    feeLabel: Administrative Fee
                    calculationModel:
                      applicationRule: flatFee
                      calculations:
                        - type: flat
                          value: '16.00'
                    referenceAmount: originalAmount
                    priority: 1
                    isDeductibleFrom: true
                    creditAccount: business-brl-1
                    routeFrom: 019c96a0-1071-7a0d-9916-a831221de252
                    routeTo: 019c96a0-108c-7a74-8e31-3789daffe1ed
                  iof:
                    feeLabel: IOF
                    calculationModel:
                      applicationRule: percentual
                      calculations:
                        - type: percentage
                          value: '6.00'
                    referenceAmount: afterFeesAmount
                    priority: 2
                    isDeductibleFrom: false
                    creditAccount: business-brl-2
                enable: true
                createdAt: '2025-04-10T03:21:06.782Z'
                updatedAt: '2025-04-09T18:45:17.976Z'
                deletedAt: null
          headers: {}
        '400':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Error0001:
                  $ref: '#/components/examples/Error0001'
                Error0002:
                  $ref: '#/components/examples/Error0002'
                Error0003:
                  $ref: '#/components/examples/Error0003'
                Error0006:
                  $ref: '#/components/examples/Error0006'
                Error0014:
                  $ref: '#/components/examples/Error0014'
                Error0015:
                  $ref: '#/components/examples/Error0015'
                Error0018:
                  $ref: '#/components/examples/Error0018'
                Error0019:
                  $ref: '#/components/examples/Error0019'
                Error0020:
                  $ref: '#/components/examples/Error0020'
                Error0023:
                  $ref: '#/components/examples/Error0023'
                Error0024:
                  $ref: '#/components/examples/Error0024'
                Error0025:
                  $ref: '#/components/examples/Error0025'
                Error0026:
                  $ref: '#/components/examples/Error0026'
                Error0027:
                  $ref: '#/components/examples/Error0027'
                Error0028:
                  $ref: '#/components/examples/Error0028'
                Error0029:
                  $ref: '#/components/examples/Error0029'
                Error0030:
                  $ref: '#/components/examples/Error0030'
                Error0031:
                  $ref: '#/components/examples/Error0031'
                Error0032:
                  $ref: '#/components/examples/Error0032'
                Error0033:
                  $ref: '#/components/examples/Error0033'
                Error0035:
                  $ref: '#/components/examples/Error0035'
                Error0038:
                  $ref: '#/components/examples/Error0038'
                Error0042:
                  $ref: '#/components/examples/Error0042'
                Error0043:
                  $ref: '#/components/examples/Error0043'
                Error0044:
                  $ref: '#/components/examples/Error0044'
                Error0046:
                  $ref: '#/components/examples/Error0046'
                Error0047:
                  $ref: '#/components/examples/Error0047'
                Error0049:
                  $ref: '#/components/examples/Error0049'
                Error0050:
                  $ref: '#/components/examples/Error0050'
          headers: {}
        '401':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Error0013:
                  $ref: '#/components/examples/Error0013'
          headers: {}
        '403':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Error0017:
                  $ref: '#/components/examples/Error0017'
          headers: {}
        '500':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Error0004:
                  $ref: '#/components/examples/Error0004'
          headers: {}
      security: []
components:
  parameters:
    PackageId:
      name: id
      in: path
      description: Unique identifier of the package that you want to update.
      required: true
      schema:
        type: string
        example: 019c96a0-10ce-75fc-a273-dc799079a99c
    Authorization:
      name: Authorization
      in: header
      description: >-
        The authorization token in the 'Bearer <token>' format.  


        **Important:** This header is required if your environment has Access
        Manager enabled. For more information, refer to the [Access
        Manager](/en/access-manager) documentation.
      required: false
      schema:
        type: string
    ContentType:
      name: Content-Type
      in: header
      description: The type of media of the resource. Must be `application/json`.
      required: true
      schema:
        type: string
        example: application/json
    XOrganizationId:
      name: X-Organization-Id
      in: header
      description: The unique identifier of the Organization associated with the request.
      required: true
      schema:
        type: string
        example: 019c96a0-0a98-7287-9a31-786e0809c769
  schemas:
    PackageUpdate:
      type: object
      properties:
        feeGroupLabel:
          type: string
          description: Name of the tax group, used to identify the configured tax package.
        description:
          type: string
          description: Short summary of what this Fee Package is designed to handle.
        minimumAmount:
          type: string
          description: >-
            Minimum transaction amount below which the fees in the package don't
            apply. **Important:** Use a dot (`.`) as the decimal separator —
            commas are not accepted.
        maximumAmount:
          type: string
          description: >-
            Maximum transaction amount above which the fees in the package don't
            apply. **Important:** Use a dot (`.`) as the decimal separator —
            commas are not accepted.
        waivedAccounts:
          type: array
          items:
            type: string
          description: >-
            List of accounts that are exempt from the taxes defined in the
            package.
        fees:
          description: >-
            Object containing custom-named tax rules. Each key is defined by the
            client (e.g., `admFee`, `iof`, and its value must follow the `Fee`
            object schema.
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Fee'
        enable:
          type: boolean
          description: If `true` it indicates that the package is active.
    CreatePackagesResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of the package, in UUIDv7 format.
        feeGroupLabel:
          type: string
          description: Name of the tax group, used to identify the configured tax package.
        description:
          type: string
          nullable: true
          description: Short summary of for the package explaining what it covers.
        transactionRoute:
          type: string
          nullable: true
          description: >-
            The main accounting route that defines the nature of the
            transaction. Helps group related operations in the ledger.
        segmentId:
          type: string
          nullable: true
          description: >-
            Unique identifier of the Segment this Fee Package is linked to in
            the Midaz Ledger.
        ledgerId:
          type: string
          description: >-
            Unique identifier of the Ledger this Fee Package is linked to in the
            Midaz Ledger.
        minimumAmount:
          type: string
          description: >-
            Minimum transaction amount below which the fees in the package don't
            apply.
        maximumAmount:
          type: string
          description: >-
            Maximum transaction amount above which the fees in the package don't
            apply.
        waivedAccounts:
          type: array
          nullable: true
          items:
            type: string
          description: >-
            List of accounts that are exempt from the taxes defined in the
            package.
        fees:
          description: >-
            Object containing custom-named tax rules. Each key is defined by the
            client (e.g., `admFee`, `iof`, and its value must follow the `Fee`
            object schema.
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Fee'
        enable:
          type: boolean
          description: If `true` it indicates that the package is active.
        createdAt:
          type: string
          format: date-time
          description: Date when the package was created.
        updatedAt:
          type: string
          format: date-time
          nullable: true
          description: Date when the package was last updated.
        deletedAt:
          type: string
          format: date-time
          nullable: true
          description: Date when the package was deleted.
      required:
        - id
        - feeGroupLabel
        - ledgerId
        - minimumAmount
        - maximumAmount
        - enable
        - fees
    Error:
      type: object
      properties:
        code:
          type: string
          description: A unique, stable identifier for the error.
        title:
          type: string
          description: A brief summary of the issue.
        message:
          type: string
          description: Detailed guidance for resolving the error.
      required:
        - code
        - title
        - message
      description: The response message error.
    Fee:
      type: object
      description: >-
        Represents a tax rule defined under a custom key in the `fees` object.
        The key name (e.g., `admFee`, `iof`) is defined by the client and must
        follow `camelCase` formatting.
      required:
        - feeLabel
        - calculationModel
        - referenceAmount
        - priority
        - isDeductibleFrom
        - creditAccount
      properties:
        feeLabel:
          type: string
          description: Display name for the fee, like 'Administrative Fee' or 'IOF'.
        calculationModel:
          type: object
          description: Object that defines the calculation model for the fee.
          required:
            - applicationRule
            - calculations
          properties:
            applicationRule:
              type: string
              description: >-
                Defines how the fee is calculated. Options: `maxBetweenTypes`,
                `percentual`, or `flatFee`.
              enum:
                - maxBetweenTypes
                - percentual
                - flatFee
            calculations:
              type: array
              description: >-
                List of values to be applied according to the `applicationRule`
                field.
              items:
                type: object
                required:
                  - type
                  - value
                properties:
                  type:
                    type: string
                    description: Type of calculation used, like `flat` or `percentage`.
                  value:
                    type: string
                    description: Tax amount.
        referenceAmount:
          type: string
          description: Defines which amount to use as the base for tax calculation.
          enum:
            - originalAmount
            - afterFeesAmount
        priority:
          type: integer
          description: Sets the order in which fees are applied.
        isDeductibleFrom:
          type: boolean
          description: >-
            If `true`, it indicates that the fee is deducted from the base
            amount.
        creditAccount:
          type: string
          description: >-
            The alias of the account that will receive the credits generated by
            the fee.
        routeFrom:
          type: string
          description: Specifies the accounting route for the debit operation.
        routeTo:
          type: string
          description: Specifies the accounting route for the credit operation.
  examples:
    Error0001:
      summary: Unexpected fields in the request
      value:
        code: FEE-0001
        title: Unexpected fields in the request
        message: >-
          The request body contains more fields than expected. Please send only
          the allowed fields as per the documentation. The unexpected fields are
          listed in the fields object.
    Error0002:
      summary: Missing fields in request
      value:
        code: FEE-0002
        title: Missing fields in request
        message: >-
          Your request is missing one or more required fields. Please refer to
          the documentation to ensure all necessary fields are included in your
          request.
    Error0003:
      summary: Bad request
      value:
        code: FEE-0003
        title: Bad request
        message: >-
          The server could not understand the request due to malformed syntax.
          Please check the listed fields and try again.
    Error0006:
      summary: Invalid query parameter
      value:
        code: FEE-0006
        title: Invalid query parameter
        message: >-
          One or more query parameters are in an incorrect format. Please check
          the following parameters 'parametros_erros' and ensure they meet the
          required format before trying again.
    Error0014:
      summary: Account not found Midaz
      value:
        code: FEE-0014
        title: Account not found Midaz
        message: >-
          Failed to find account on Midaz. Please check the credit account
          passed.
    Error0015:
      summary: minimumAmount greater than maximumAmount
      value:
        code: FEE-0015
        title: minimumAmount greater than maximumAmount
        message: minimumAmount value is greater than maximumAmount.
    Error0018:
      summary: Package already exists
      value:
        code: FEE-0018
        title: Package already exists
        message: >-
          There is a Package with same index values for [organizationId,
          ledgerId, segmentId, transactionRoute, minimumAmount, maximumAmount]
    Error0019:
      summary: Invalid header parameter
      value:
        code: FEE-0019
        title: Invalid header parameter
        message: >-
          One or more headers parameters are in an incorrect format. Please
          check the following parameters and ensure they meet the required
          format before trying again.
    Error0020:
      summary: Missing header
      value:
        code: FEE-0020
        title: Missing header
        message: >-
          Headers parameters is required. Please check the following header
          parameters %v and ensure they are passing the values correctly.
    Error0023:
      summary: Missing calculation model
      value:
        code: FEE-0023
        title: Missing calculation model
        message: The calculation model is required to Fee.
    Error0024:
      summary: originalAmount is required when priority is one
      value:
        code: FEE-0024
        title: originalAmount is required when priority is one
        message: >-
          For Priority equals to one, referenceAmount must be 'originalAmount'
          for fee.
    Error0025:
      summary: 'Failed to apply rule: flatFee or percentual'
      value:
        code: FEE-0025
        title: 'Failed to apply rule: flatFee or percentual'
        message: >-
          applicationRule flatFee or percentual must have exactly 1 calculation
          for Fee.
    Error0026:
      summary: 'Invalid calculation type: percentual'
      value:
        code: FEE-0026
        title: 'Invalid calculation type: percentual'
        message: The calculation type percentual must be 'percentage' for Fee.
    Error0027:
      summary: 'Invalid calculation type: flatFee'
      value:
        code: FEE-0027
        title: 'Invalid calculation type: flatFee'
        message: The calculation type flatFee must be 'flat' for Fee.
    Error0028:
      summary: Missing required fee fields
      value:
        code: FEE-0028
        title: Missing required fee fields
        message: >-
          All fields of a new Fee must be filled. Please check again the payload
          passed.
    Error0029:
      summary: Calculation field is required for fee
      value:
        code: FEE-0029
        title: Calculation field is required for fee
        message: >-
          Please fill the Calculation object correctly. All calculation fields
          must be filled.
    Error0030:
      summary: referenceAmount is not valid
      value:
        code: FEE-0030
        title: referenceAmount is not valid
        message: Field reference amount must be originalAmount or afterFeesAmount.
    Error0031:
      summary: Invalid applicationRule
      value:
        code: FEE-0031
        title: Invalid applicationRule
        message: Field application rule must be maxBetweenTypes, flatFee or percentual.
    Error0032:
      summary: Error Calculation Type Invalid
      value:
        code: FEE-0032
        title: Error Calculation Type Invalid
        message: Field calculation type must be percentage or flat.
    Error0033:
      summary: maximumAmount less than minimumAmount
      value:
        code: FEE-0033
        title: maximumAmount less than minimumAmount
        message: maximumAmount value is less than minimumAmount.
    Error0035:
      summary: Package amount range overlap
      value:
        code: FEE-0035
        title: Package amount range overlap
        message: >-
          The maximumAmount and minimumAmount of the new package overlap with
          the amount range of an existing package.
    Error0038:
      summary: 'Failed to apply rule: maxBetweenTypes'
      value:
        code: FEE-0038
        title: 'Failed to apply rule: maxBetweenTypes'
        message: >-
          applicationRule maxBetweenTypes must have more than 1 calculation for
          Fee %v.
    Error0042:
      summary: Error to convert values
      value:
        code: FEE-0042
        title: Error to convert values
        message: >-
          The value of the field %s is invalid. Remember to use dot (.) as
          decimal separator instead of comma (,). Example: use 1000.50 instead
          of 1000,50.
    Error0043:
      summary: originalAmount is required when isDeductibleFrom is true
      value:
        code: FEE-0043
        title: originalAmount is required when isDeductibleFrom is true
        message: >-
          For isDeductibleFrom 'true', referenceAmount must be 'originalAmount'
          for '%s’.
    Error0044:
      summary: applicationRule invalid value
      value:
        code: FEE-0044
        title: applicationRule invalid value
        message: 'applicationRule is invalid, Err: %v.'
    Error0046:
      summary: calculation value percentage invalid
      value:
        code: FEE-0046
        title: calculation value percentage invalid
        message: >-
          Calculation value is invalid can not utrapass 100%%. Please check the
          calculation value for Fee %v.
    Error0047:
      summary: calculation value flat invalid
      value:
        code: FEE-0047
        title: calculation value flat invalid
        message: >-
          Calculation value is invalid can not utrapass the minimum amount %v.
          Please check the calculation value for Fee %v.
    Error0049:
      summary: deductible value forbidden
      value:
        code: FEE-0049
        title: deductible value forbidden
        message: >-
          Can not update deductible value to true. The calculation value is
          bigger than 100%% for Fee %v.
    Error0050:
      summary: deductible value forbidden
      value:
        code: FEE-0050
        title: deductible value forbidden
        message: >-
          Can not update deductible value to true. Calculation value is bigger
          than the minimum amount %v for Fee %v.
    Error0013:
      summary: Invalid fee priority
      value:
        code: FEE-0013
        title: Invalid fee priority
        message: The priority field in fees is invalid. Field can not be repeated.
    Error0017:
      summary: Nothing to update
      value:
        code: FEE-0017
        title: Nothing to update
        message: Fields not passed correctly. There is nothing to update.
    Error0004:
      summary: Internal Server Error
      value:
        code: FEE-0004
        title: Internal Server Error
        message: >-
          The server encountered an unexpected error. Please try again later or
          contact support.

````