> ## 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 fee schedule

> Use this endpoint to update the fields of a specific fee schedule by its identifier.



## OpenAPI

````yaml /pt/openapi/v3-current/matcher.yaml patch /v1/fee-schedules/{scheduleId}
openapi: 3.1.0
info:
  title: Matcher APIs
  description: >-
    Complete API reference for the Matcher reconciliation engine, providing
    automated transaction matching between Midaz Ledger and external systems.
  version: 5.0.4
  license:
    name: Lerian Studio General License
servers:
  - url: https://matcher.sandbox.lerian.net
security: []
paths:
  /v1/fee-schedules/{scheduleId}:
    patch:
      tags:
        - Configuration Fee Schedules
      summary: Update a fee schedule
      description: >-
        Use this endpoint to update the fields of a specific fee schedule by its
        identifier.
      operationId: updateFeeSchedule
      parameters:
        - description: A unique identifier for tracing the request across services.
          in: header
          name: X-Request-Id
          schema:
            type: string
        - description: The unique identifier of the fee schedule.
          in: path
          name: scheduleId
          required: true
          schema:
            description: Schedule ID
            format: uuid
            type: string
        - $ref: '#/components/parameters/XIdempotency'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateFeeScheduleRequest'
        description: Fee schedule updates
        required: true
      responses:
        '200':
          description: Successfully updated fee schedule.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FeeScheduleResponse'
          headers:
            X-Idempotency-Replayed:
              $ref: '#/components/headers/XIdempotencyReplayed'
        '400':
          description: Invalid request payload
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                mtch-0001-fee-schedule-name-is-required:
                  $ref: >-
                    #/components/examples/mtch-0001-fee-schedule-name-is-required
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: Fee schedule not found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Detail'
              examples:
                mtch-0115-fee-schedule-not-found:
                  $ref: >-
                    #/components/examples/mtch-0115-fee-schedule-not-found--patch-v1-fee-schedules-scheduleid
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - BearerAuth: []
components:
  parameters:
    XIdempotency:
      name: X-Idempotency
      in: header
      required: false
      description: >-
        Optional idempotency key for safe retries. Matcher reads the key only
        from this header, and only when you send one. A request that carries a
        key only in `X-Idempotency-Key` or `Idempotency-Key` is refused with
        `400` (`MTCH-0015`), and nothing is processed. If the same key is sent
        again and the original request was already processed, the stored
        response is returned with `X-Idempotency-Replayed: true`. A malformed
        key returns `400`, a key whose first request is still in progress
        returns `409`, and an idempotency storage failure returns `500`. These
        refusals are problem documents.
      schema:
        type: string
  schemas:
    UpdateFeeScheduleRequest:
      additionalProperties: false
      properties:
        applicationOrder:
          description: >-
            How items combine. PARALLEL applies every item to the same gross
            base; CASCADING applies each item to the net remaining after prior
            items.
          enum:
            - PARALLEL
            - CASCADING
          examples:
            - CASCADING
          type: string
        name:
          description: New human-readable name of the fee schedule.
          examples:
            - Updated Schedule
          type: string
        roundingMode:
          description: >-
            Rounding strategy. HALF_UP rounds halves away from zero; BANKERS
            rounds halves to the nearest even digit; FLOOR rounds down; CEIL
            rounds up; TRUNCATE drops extra digits.
          enum:
            - HALF_UP
            - BANKERS
            - FLOOR
            - CEIL
            - TRUNCATE
          examples:
            - BANKERS
          type: string
        roundingScale:
          description: Number of decimal places fee amounts are rounded to.
          examples:
            - 4
          format: int64
          type: integer
      type: object
    FeeScheduleResponse:
      additionalProperties: false
      properties:
        applicationOrder:
          description: >-
            How items combine. PARALLEL applies every item to the same gross
            base; CASCADING applies each item to the net remaining after prior
            items.
          enum:
            - PARALLEL
            - CASCADING
          examples:
            - PARALLEL
          type: string
        createdAt:
          description: Creation timestamp in RFC 3339 format.
          examples:
            - '2025-01-15T10:30:00Z'
          type: string
        currency:
          description: ISO 4217 currency code the schedule's amounts are denominated in.
          examples:
            - USD
          type: string
        id:
          description: Unique identifier of the fee schedule.
          examples:
            - 550e8400-e29b-41d4-a716-446655440000
          type: string
        items:
          description: Fee items that make up the schedule.
          items:
            $ref: '#/components/schemas/FeeScheduleItemResponse'
          maxItems: 100
          type:
            - array
            - 'null'
        name:
          description: Human-readable name of the fee schedule.
          examples:
            - Card Processing - Visa
          type: string
        roundingMode:
          description: >-
            Rounding strategy. HALF_UP rounds halves away from zero; BANKERS
            rounds halves to the nearest even digit; FLOOR rounds down; CEIL
            rounds up; TRUNCATE drops extra digits.
          enum:
            - HALF_UP
            - BANKERS
            - FLOOR
            - CEIL
            - TRUNCATE
          examples:
            - HALF_UP
          type: string
        roundingScale:
          description: Number of decimal places fee amounts are rounded to.
          examples:
            - 2
          format: int64
          type: integer
        tenantId:
          description: Identifier of the tenant that owns the schedule.
          examples:
            - 550e8400-e29b-41d4-a716-446655440000
          type: string
        updatedAt:
          description: Last update timestamp in RFC 3339 format.
          examples:
            - '2025-01-15T10:30:00Z'
          type: string
        usedByContexts:
          description: >-
            Number of distinct contexts whose fee rules reference this schedule.
            Computed at read time from the fee rules that reference this
            schedule (never persisted).
          examples:
            - 2
          format: int64
          type: integer
      required:
        - id
        - tenantId
        - name
        - currency
        - applicationOrder
        - roundingScale
        - roundingMode
        - items
        - usedByContexts
        - createdAt
        - updatedAt
      type: object
    Detail:
      additionalProperties: false
      properties:
        code:
          description: >-
            Stable, machine-readable domain error code scoped to the emitting
            service (format: <SERVICE>-NNNN).
          examples:
            - ERR-0001
          type: string
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type:
            - array
            - 'null'
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: >-
            A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
        upstream:
          $ref: '#/components/schemas/Upstream'
          description: >-
            RFC 9457 extension member: the error a proxied third-party provider
            reported. Absent unless the emitting service explicitly surfaced
            one.
      type: object
    FeeScheduleItemResponse:
      additionalProperties: false
      properties:
        createdAt:
          description: Creation timestamp in RFC 3339 format.
          examples:
            - '2025-01-15T10:30:00Z'
          type: string
        id:
          description: Unique identifier of the fee item.
          examples:
            - 550e8400-e29b-41d4-a716-446655440000
          type: string
        name:
          description: Human-readable name of the fee item.
          examples:
            - interchange
          type: string
        priority:
          description: >-
            Application order within the schedule; relevant for CASCADING
            application.
          examples:
            - 1
          format: int64
          type: integer
        structure:
          additionalProperties: {}
          description: >-
            Type-specific structure. FLAT: {"amount":"1.50"}. PERCENTAGE:
            {"rate":"0.029"} where rate is a 0..1 fraction of the base amount
            (0.029 means 2.9%), not a percent value. TIERED:
            {"tiers":[{"rate":"0.01","upTo":"1000"},...]} with the same 0..1
            fraction semantics per tier rate. EXPRESSION: {"expression":"gross -
            desconto + multa + juros_dia * days_late(due_date, pay_date)"} a
            formula over metadata fields (+ - * /, parentheses, and the
            functions days_late, days_between, max, min, abs, clamp). A formula
            that is only the base amount times numeric literals is a percentage
            rate and is bounded 0..1: gross * 0.029 is 2.9%, gross * 2.9 is
            refused; any other formula is unbounded.
          type: object
        structureType:
          description: >-
            Shape of the fee structure. FLAT is a fixed amount; PERCENTAGE is a
            rate of the base; TIERED applies different rates per amount tier;
            EXPRESSION computes the fee from a bounded arithmetic formula over
            transaction metadata.
          enum:
            - FLAT
            - PERCENTAGE
            - TIERED
            - EXPRESSION
          examples:
            - PERCENTAGE
          type: string
        updatedAt:
          description: Last update timestamp in RFC 3339 format.
          examples:
            - '2025-01-15T10:30:00Z'
          type: string
      required:
        - id
        - name
        - priority
        - structureType
        - structure
        - createdAt
        - updatedAt
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
    Upstream:
      additionalProperties: false
      properties:
        code:
          description: The upstream provider's own error code, verbatim.
          examples:
            - E4001
          type: string
        message:
          description: >-
            The upstream provider's own error message, verbatim (bounded, never
            its raw response body).
          examples:
            - account not found at provider
          type: string
      type: object
    ErrorResponse:
      description: >-
        Flat error body that Matcher returns when it refuses a request before
        the operation runs.
      type: object
      required:
        - code
        - title
        - message
      properties:
        code:
          type: string
          description: Stable error code.
          example: MTCH-0003
        title:
          type: string
          description: HTTP status text.
          example: Unauthorized
        message:
          type: string
          description: Human-readable error message.
          example: missing authorization token
    RateLimitErrorResponse:
      description: >-
        Flat body that the rate limiter returns. `code` is the HTTP status as a
        number.
      type: object
      required:
        - code
        - title
        - message
      properties:
        code:
          type: integer
          description: HTTP status code.
          example: 429
        title:
          type: string
          description: Error type.
          example: rate_limit_exceeded
        message:
          type: string
          description: Human-readable error message.
          example: rate limit exceeded
  headers:
    XIdempotencyReplayed:
      description: >-
        Indicates whether this response was served from the idempotency cache.
        When `true`, the response is a replay of the original request with the
        same idempotency key.
      schema:
        type: boolean
    RetryAfter:
      description: Seconds to wait before you retry.
      schema:
        type: integer
        example: 30
    XRateLimitLimit:
      description: Requests allowed in the current window.
      schema:
        type: integer
        example: 100
    XRateLimitRemaining:
      description: Requests left in the current window. Always `0` on a `429`.
      schema:
        type: integer
        example: 0
    XRateLimitReset:
      description: Unix time, in seconds, when the current window resets.
      schema:
        type: integer
        example: 1767225600
  examples:
    mtch-0001-fee-schedule-name-is-required:
      summary: Fee schedule name is required
      value:
        type: https://errors.lerian.studio/v1/MTCH-0001
        title: Bad Request
        status: 400
        detail: >-
          The fee schedule update is invalid; check the name, application order,
          and rounding settings and try again
        code: MTCH-0001
    mtch-0115-fee-schedule-not-found--patch-v1-fee-schedules-scheduleid:
      summary: Fee schedule not found
      value:
        type: https://errors.lerian.studio/v1/MTCH-0115
        title: Not Found
        status: 404
        detail: >-
          The fee schedule could not be found; no changes were saved. Check the
          fee schedule id and try again.
        code: MTCH-0115
  responses:
    Unauthorized:
      description: The request lacks valid authentication credentials.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Detail'
          examples:
            MissingToken:
              summary: Missing token
              value:
                type: https://errors.lerian.studio/v1/MTCH-0003
                title: Unauthorized
                status: 401
                detail: missing authorization token
                code: MTCH-0003
            InvalidToken:
              summary: Invalid token
              value:
                type: https://errors.lerian.studio/v1/MTCH-0003
                title: Unauthorized
                status: 401
                detail: invalid authorization token
                code: MTCH-0003
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
        text/plain:
          schema:
            type: string
          example: Unauthorized
    Forbidden:
      description: You do not have permission to access this resource.
      content:
        text/plain:
          schema:
            type: string
          example: Forbidden
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Detail'
          examples:
            TenantClaimRequired:
              summary: Tenant claim missing
              value:
                type: https://errors.lerian.studio/v1/MTCH-0004
                title: Forbidden
                status: 403
                detail: tenant claim required
                code: MTCH-0004
    ValidationFailed:
      description: >-
        The request failed validation. The `errors` list names each value that
        failed.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Detail'
          example:
            title: Unprocessable Entity
            status: 422
            detail: validation failed
            errors:
              - message: expected required property name to be present
                location: body
    TooManyRequests:
      description: >-
        The request exceeded the rate limit. Wait the number of seconds in
        `Retry-After`, then retry.
      headers:
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
        X-RateLimit-Limit:
          $ref: '#/components/headers/XRateLimitLimit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/XRateLimitRemaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/XRateLimitReset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitErrorResponse'
          example:
            code: 429
            title: rate_limit_exceeded
            message: rate limit exceeded
    InternalServerError:
      description: An unexpected error occurred on the server.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Detail'
          example:
            type: https://errors.lerian.studio/v1/MTCH-0002
            title: Internal Server Error
            status: 500
            detail: internal error
            code: MTCH-0002
        text/plain:
          schema:
            type: string
          example: Internal Server Error
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: 'Bearer token authentication (format: "Bearer {token}")'
      scheme: bearer
      type: http

````

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