> ## 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.

# Simulate fee calculation

> Use this endpoint to simulate fee calculation for a given gross amount using a specific fee schedule. Returns the net amount, total fee, and per-item breakdown.



## OpenAPI

````yaml /en/openapi/v3-current/matcher.yaml post /v1/fee-schedules/{scheduleId}/simulate
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: v2.1.1
  license:
    name: Elastic License 2.0
    url: https://www.elastic.co/licensing/elastic-license
servers:
  - url: https://matcher.sandbox.lerian.net
security: []
paths:
  /v1/fee-schedules/{scheduleId}/simulate:
    post:
      tags:
        - Configuration Fee Schedules
      summary: Simulate fee calculation
      description: >-
        Use this endpoint to simulate fee calculation for a given gross amount
        using a specific fee schedule. Returns the net amount, total fee, and
        per-item breakdown.
      operationId: simulateFeeSchedule
      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:
            type: string
        - $ref: '#/components/parameters/XIdempotencyKey'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SimulateFeeRequest'
        description: Fee simulation payload
        required: true
      responses:
        '200':
          description: >-
            Fee simulation result.


            The response includes the `X-Idempotency-Replayed` header.


            If the value is false, the request was just processed. If the value
            is true, the response is a replay of a previously processed request.


            See [Retries and idempotency](/en/reference/retries-idempotency) for
            more details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimulateFeeResponse'
          headers:
            X-Idempotency-Replayed:
              $ref: '#/components/headers/XIdempotencyReplayed'
        '400':
          description: Invalid request payload
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: The request lacks valid authentication credentials.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: You do not have permission to access this resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Fee schedule not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: An unexpected error occurred on the server.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
components:
  parameters:
    XIdempotencyKey:
      name: X-Idempotency-Key
      in: header
      required: false
      description: >-
        Optional idempotency key for safe retries. Also accepts
        `Idempotency-Key` as an alternative header name. If the same key is sent
        again and the original request was already processed, the cached
        response is returned with `X-Idempotency-Replayed: true`.


        See [Retries and idempotency](/en/reference/retries-idempotency) for
        details.
      schema:
        type: string
  schemas:
    SimulateFeeRequest:
      description: Payload for simulating fee calculation against a fee schedule
      properties:
        grossAmount:
          description: Gross transaction amount to simulate fees on
          example: '100.00'
          type: string
        currency:
          description: Currency code (ISO 4217)
          example: USD
          type: string
      required:
        - grossAmount
        - currency
      type: object
    SimulateFeeResponse:
      description: Result of a fee simulation
      properties:
        grossAmount:
          description: Original gross amount
          example: '100.00'
          type: string
        netAmount:
          description: Amount after fees are deducted
          example: '97.70'
          type: string
        totalFee:
          description: Total fee amount
          example: '2.30'
          type: string
        currency:
          description: Currency code (ISO 4217)
          example: USD
          type: string
        items:
          description: Breakdown of individual fee items
          items:
            $ref: '#/components/schemas/SimulateFeeItem'
          maxItems: 100
          type: array
      type: object
    ErrorResponse:
      description: Standard error response returned by all API endpoints
      type: object
      required:
        - code
        - title
        - message
      properties:
        code:
          type: string
          description: HTTP status code as a string.
          example: '404'
        title:
          type: string
          description: Error type identifier.
          example: not_found
        message:
          type: string
          description: Human-readable error message with details.
          example: context not found
        error:
          type: string
          description: Deprecated. Error message for backward compatibility.
          deprecated: true
        details:
          description: Additional error context as key-value pairs
          additionalProperties: {}
          type: object
    SimulateFeeItem:
      description: A single fee item in a simulation result
      properties:
        name:
          description: Name of the fee item
          example: interchange
          type: string
        fee:
          description: Calculated fee amount
          example: '1.50'
          type: string
        baseUsed:
          description: Base amount used for this fee calculation
          example: '100.00'
          type: string
      type: object
  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.


        See [Retries and idempotency](/en/reference/retries-idempotency) for
        details.
      schema:
        type: boolean
      example: false
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Bearer token authentication (format: "Bearer {token}")'

````