components:
  schemas:
    Account:
      additionalProperties: false
      properties:
        alias:
          examples:
            - "@treasury_checking"
          maxLength: 100
          type:
            - string
            - "null"
        assetCode:
          examples:
            - USD
          maxLength: 100
          type: string
        blocked:
          type:
            - boolean
            - "null"
        closedAt:
          description: "Instant the account was closed, null while it is still open. Output only: it is written exclusively by the close command and is refused as an input field on create and update"
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type:
            - string
            - "null"
        createdAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
        deletedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type:
            - string
            - "null"
        entityId:
          examples:
            - EXT-ACC-12345
          maxLength: 256
          type:
            - string
            - "null"
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        metadata:
          additionalProperties: {}
          type: object
        name:
          examples:
            - Corporate Checking Account
          maxLength: 256
          type: string
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        parentAccountId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type:
            - string
            - "null"
        portfolioId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type:
            - string
            - "null"
        segmentId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type:
            - string
            - "null"
        status:
          $ref: "#/components/schemas/Status"
        type:
          examples:
            - deposit
          type: string
        updatedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - id
        - name
        - parentAccountId
        - entityId
        - assetCode
        - organizationId
        - ledgerId
        - portfolioId
        - segmentId
        - status
        - alias
        - type
        - blocked
        - createdAt
        - updatedAt
        - deletedAt
        - closedAt
      type: object
    AccountBlockException:
      additionalProperties: false
      properties:
        accountAlias:
          description: Alias of the source account the exception authorizes
          examples:
            - "@fraud_account"
          type: string
        accountBlockExceptionId:
          description: Single-use exception identifier
          examples:
            - 018f2c1e-6a3b-7c4d-8e5f-0a1b2c3d4e5f
          type: string
        amount:
          description: Authorized amount, echoed from the request
          examples:
            - "150.00"
          type: string
        expiresAt:
          description: Instant the exception expires, derived from the applied TTL
          format: date-time
          type: string
      required:
        - accountBlockExceptionId
        - accountAlias
        - amount
        - expiresAt
      type: object
    AccountBlockExceptions:
      additionalProperties: false
      properties:
        exceptions:
          description: Created exceptions, in request order
          items:
            $ref: "#/components/schemas/AccountBlockException"
          type:
            - array
            - "null"
      required:
        - exceptions
      type: object
    AccountPlanList:
      additionalProperties: false
      properties:
        items:
          items:
            $ref: "#/components/schemas/FeeAccountPlan"
          type:
            - array
            - "null"
        limit:
          examples:
            - 10
          format: int64
          type: integer
        page:
          examples:
            - 1
          format: int64
          type: integer
        total:
          description: Number of items on this page.
          examples:
            - 1
          format: int64
          type: integer
      required:
        - items
        - page
        - limit
        - total
      type: object
    AccountPlanVersionList:
      additionalProperties: false
      properties:
        items:
          items:
            $ref: "#/components/schemas/FeeAccountPlanVersion"
          type:
            - array
            - "null"
        limit:
          examples:
            - 10
          format: int64
          type: integer
        page:
          examples:
            - 1
          format: int64
          type: integer
        total:
          description: Number of items on this page.
          examples:
            - 2
          format: int64
          type: integer
      required:
        - items
        - page
        - limit
        - total
      type: object
    AccountRule:
      additionalProperties: false
      properties:
        ruleType:
          enum:
            - alias
            - account_type
          examples:
            - alias
          type: string
        validIf: {}
      type: object
    AccountSkip:
      additionalProperties: false
      properties:
        holder:
          examples:
            - false
          type: boolean
      type: object
    AccountType:
      additionalProperties: false
      properties:
        createdAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
        defaultDirection:
          examples:
            - credit
          type: string
        deletedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type:
            - string
            - "null"
        description:
          examples:
            - Assets that are expected to be converted to cash within one year
          type: string
        id:
          examples:
            - 01965ed9-7fa4-75b2-8872-fc9e8509ab0a
          type: string
        keyValue:
          examples:
            - current_assets
          type: string
        ledgerId:
          examples:
            - 01965ed9-7fa4-75b2-8872-fc9e8509ab0a
          type: string
        metadata:
          additionalProperties: {}
          type: object
        name:
          examples:
            - Current Assets
          type: string
        organizationId:
          examples:
            - 01965ed9-7fa4-75b2-8872-fc9e8509ab0a
          type: string
        updatedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - createdAt
        - updatedAt
        - deletedAt
      type: object
    AccountV2:
      additionalProperties: false
      properties:
        alias:
          examples:
            - "@treasury_checking"
          maxLength: 100
          type:
            - string
            - "null"
        assetCode:
          examples:
            - USD
          maxLength: 100
          type: string
        blocked:
          type:
            - boolean
            - "null"
        closedAt:
          description: "Instant the account was closed, null while it is still open. Output only: it is written exclusively by the close command and is refused as an input field on create and update"
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type:
            - string
            - "null"
        createdAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
        deletedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type:
            - string
            - "null"
        entityId:
          examples:
            - EXT-ACC-12345
          maxLength: 256
          type:
            - string
            - "null"
        holderCheckSkipped:
          examples:
            - false
          type: boolean
        holderId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type:
            - string
            - "null"
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        metadata:
          additionalProperties: {}
          type: object
        name:
          examples:
            - Corporate Checking Account
          maxLength: 256
          type: string
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        parentAccountId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type:
            - string
            - "null"
        portfolioId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type:
            - string
            - "null"
        segmentId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type:
            - string
            - "null"
        status:
          $ref: "#/components/schemas/Status"
        type:
          examples:
            - deposit
          type: string
        updatedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - id
        - name
        - parentAccountId
        - entityId
        - holderId
        - assetCode
        - organizationId
        - ledgerId
        - portfolioId
        - segmentId
        - status
        - alias
        - type
        - blocked
        - holderCheckSkipped
        - createdAt
        - updatedAt
        - deletedAt
        - closedAt
      type: object
    AccountingEntries:
      additionalProperties: false
      properties:
        block:
          $ref: "#/components/schemas/AccountingEntry"
        cancel:
          $ref: "#/components/schemas/AccountingEntry"
        commit:
          $ref: "#/components/schemas/AccountingEntry"
        crossLedger:
          $ref: "#/components/schemas/AccountingEntry"
        direct:
          $ref: "#/components/schemas/AccountingEntry"
        hold:
          $ref: "#/components/schemas/AccountingEntry"
        overdraft:
          $ref: "#/components/schemas/AccountingEntry"
        revert:
          $ref: "#/components/schemas/AccountingEntry"
        unblock:
          $ref: "#/components/schemas/AccountingEntry"
      type: object
    AccountingEntry:
      additionalProperties: false
      properties:
        credit:
          $ref: "#/components/schemas/AccountingRubric"
        debit:
          $ref: "#/components/schemas/AccountingRubric"
      required:
        - debit
        - credit
      type: object
    AccountingRubric:
      additionalProperties: false
      properties:
        code:
          examples:
            - "1001"
          type: string
        description:
          examples:
            - Cash
          type: string
      required:
        - code
        - description
      type: object
    AccountingValidation:
      additionalProperties: false
      properties:
        requireHolder:
          examples:
            - false
          type: boolean
        validateAccountType:
          examples:
            - false
          type: boolean
        validateRoutes:
          examples:
            - false
          type: boolean
      required:
        - validateAccountType
        - validateRoutes
        - requireHolder
      type: object
    AccountingValidationInput:
      additionalProperties: false
      properties:
        requireHolder:
          examples:
            - false
          type: boolean
        validateAccountType:
          examples:
            - false
          type: boolean
        validateRoutes:
          examples:
            - false
          type: boolean
      type: object
    Address:
      additionalProperties: false
      properties:
        city:
          examples:
            - New York
          maxLength: 100
          type: string
        country:
          examples:
            - US
          maxLength: 2
          minLength: 2
          type: string
        description:
          examples:
            - Home
          maxLength: 100
          type: string
        line1:
          examples:
            - 123 Financial Avenue
          maxLength: 256
          type: string
        line2:
          examples:
            - Suite 1500
          maxLength: 256
          type:
            - string
            - "null"
        state:
          examples:
            - NY
          maxLength: 100
          type: string
        zipCode:
          examples:
            - "10001"
          maxLength: 20
          type: string
      required:
        - line1
        - line2
        - zipCode
        - city
        - state
        - country
      type: object
    Addresses:
      additionalProperties: false
      properties:
        additional1:
          $ref: "#/components/schemas/Address"
        additional2:
          $ref: "#/components/schemas/Address"
        primary:
          $ref: "#/components/schemas/Address"
      type: object
    Amount:
      additionalProperties: false
      properties:
        asset:
          examples:
            - BRL
          type: string
        value:
          examples:
            - "1000"
          type: string
      type: object
    Asset:
      additionalProperties: false
      properties:
        code:
          examples:
            - USD
          maxLength: 100
          type: string
        createdAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
        deletedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type:
            - string
            - "null"
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        metadata:
          additionalProperties: {}
          type: object
        name:
          examples:
            - US Dollar
          maxLength: 256
          type: string
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        status:
          $ref: "#/components/schemas/Status"
        type:
          examples:
            - currency
          type: string
        updatedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - id
        - name
        - type
        - code
        - status
        - ledgerId
        - organizationId
        - createdAt
        - updatedAt
        - deletedAt
      type: object
    AssetRate:
      additionalProperties: false
      properties:
        createdAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
        externalId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        from:
          examples:
            - USD
          maxLength: 10
          minLength: 2
          type: string
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        metadata:
          additionalProperties: {}
          type: object
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        rate:
          examples:
            - 100
          format: double
          type: number
        scale:
          examples:
            - 2
          format: double
          minimum: 0
          type:
            - number
            - "null"
        source:
          examples:
            - External System
          maxLength: 200
          type:
            - string
            - "null"
        to:
          examples:
            - BRL
          maxLength: 10
          minLength: 2
          type: string
        ttl:
          examples:
            - 3600
          format: int64
          minimum: 0
          type: integer
        updatedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - id
        - organizationId
        - ledgerId
        - externalId
        - from
        - to
        - rate
        - scale
        - source
        - ttl
        - createdAt
        - updatedAt
      type: object
    AtomicTransactionBatchV2Transaction:
      additionalProperties: false
      properties:
        accountPlanFees:
          description: "Account plan outcome of each source account of the transaction with an active account plan assignment: the matched fee, whether the unit was free (quota), charged or matched no fee (no_match), its ordinal in the period and the fee charged. Absent when no source account has an assignment, and on every response other than a create."
          items:
            $ref: "#/components/schemas/FeeAccountPlanFeeOutcome"
          type:
            - array
            - "null"
        amount:
          examples:
            - "1500"
          minimum: 0
          type:
            - string
            - "null"
        assetCode:
          examples:
            - BRL
          maxLength: 10
          minLength: 2
          type: string
        createdAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
        credit:
          examples:
            -   - "@person2"
          items:
            type: string
          type:
            - array
            - "null"
        debit:
          examples:
            -   - "@person1"
          items:
            type: string
          type:
            - array
            - "null"
        deletedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type:
            - string
            - "null"
        description:
          examples:
            - Transaction description
          maxLength: 256
          type: string
        feesSkipped:
          examples:
            - false
          type: boolean
        groupId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        metadata:
          additionalProperties: {}
          description: "Additional custom attributes. The ledger writes six fee keys on this field itself and reserves them: feeApplied is the string true when the fee engine actually charged this transaction; packageAppliedID is the identifier of the fee package the engine applied, written when that package charged a fee or recorded an exemption (including a package that priced the transaction at zero), and absent when no package applied, which includes a route whose packages all exclude the amount by their bounds, or when the applied package's fees only rounded down to zero; feeExemption is a string holding a JSON object with exempt, reason and message, present when every account on one side of the transaction is exempt from fees, which is how a caller tells an exemption apart from no package having matched; feeExemption is also present, with reason cross_ledger_bridge, when the only account on one side that would have paid a fee is the @external/<asset> bridge closing a part of a cross-ledger group, because that bridge never pays a fee; feeExemption is also present, with reason zero_fee_amount, when the package priced the transaction at zero, for instance a band configured with no fee, so no fee leg was posted and feeApplied is absent; a transaction recorded before v4.1.1 stored feeExemption as that object itself, and a read returns it as the string too; feeDebtOpenings and feeDebtSettlements are strings holding a JSON array, in the order the ledger applied them, of the fee debts this transaction opened because its payer could not fund a deferrable fee (debtId, debtorRef, creditRef, opened, seq) and of the fee debts it settled (debtId, debtorRef, creditRef, amount, opened, seq), each absent when there is none; feeDebtCollection is the string true on a standalone fee-debt collection, whose amount is what it settled and which cannot be reverted. A request body carrying feeApplied, packageAppliedID, feeExemption, feeDebtOpenings, feeDebtSettlements, feeDebtCollection or feeDeferPair is refused with 400 naming the offending key, on every body that carries transaction metadata: a create, a metadata update and a fee estimate. A metadata update, including one that clears the metadata, never changes them. So a value present here is always the ledger's own word about the charge and never one a caller supplied. feeLeg and feeDeferPair, on operation metadata, are reserved the same way. Transaction-level metadata is additive, so caller-supplied keys on this field are preserved alongside the ledger keys."
          type: object
        operations:
          items:
            $ref: "#/components/schemas/OperationV2"
          type:
            - array
            - "null"
        order:
          description: Logical order used to execute this transaction.
          format: int64
          minimum: 1
          type: integer
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        parentTransactionId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        routeId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        scheme:
          description: Payment scheme the transaction declared, normalized to upper case; absent when none.
          examples:
            - PIX
          maxLength: 50
          type: string
        status:
          $ref: "#/components/schemas/TransactionStatus"
        tracerSkipped:
          examples:
            - false
          type: boolean
        updatedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - order
        - id
        - description
        - status
        - amount
        - assetCode
        - debit
        - credit
        - ledgerId
        - organizationId
        - feesSkipped
        - tracerSkipped
        - createdAt
        - updatedAt
        - deletedAt
        - operations
      type: object
    AuditEventResponse:
      additionalProperties: false
      properties:
        action:
          type: string
        actor:
          type: string
        from_status:
          type: string
        id:
          type: string
        outcome:
          type: string
        reason:
          type: string
        request_id:
          type: string
        timestamp:
          type: string
        to_status:
          type: string
      required:
        - id
        - action
        - actor
        - outcome
        - reason
        - from_status
        - to_status
        - timestamp
        - request_id
      type: object
    AuditEventsEnvelope:
      additionalProperties: false
      properties:
        items:
          items:
            $ref: "#/components/schemas/AuditEventResponse"
          type:
            - array
            - "null"
        limit:
          format: int64
          type: integer
        next_cursor:
          type: string
        organization_id:
          type: string
        prev_cursor:
          type: string
      required:
        - organization_id
        - items
        - limit
      type: object
    Balance:
      additionalProperties: false
      properties:
        accountId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        accountType:
          examples:
            - creditCard
          maxLength: 50
          type: string
        alias:
          examples:
            - "@person1"
          maxLength: 256
          type: string
        allowReceiving:
          examples:
            - true
          type: boolean
        allowSending:
          examples:
            - true
          type: boolean
        assetCode:
          examples:
            - USD
          maxLength: 10
          minLength: 2
          type: string
        available:
          examples:
            - "1500"
          minimum: 0
          type: string
        createdAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
        deletedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type:
            - string
            - "null"
        direction:
          examples:
            - credit
          type: string
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        key:
          examples:
            - asset-freeze
          maxLength: 100
          type: string
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        metadata:
          additionalProperties: {}
          type: object
        onHold:
          examples:
            - "500"
          minimum: 0
          type: string
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        overdraftUsed:
          examples:
            - "0"
          type: string
        settings:
          $ref: "#/components/schemas/BalanceSettings"
        updatedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
        version:
          examples:
            - 1
          format: int64
          minimum: 1
          type: integer
      required:
        - id
        - organizationId
        - ledgerId
        - accountId
        - alias
        - key
        - assetCode
        - available
        - onHold
        - version
        - accountType
        - allowSending
        - allowReceiving
        - overdraftUsed
        - createdAt
        - updatedAt
        - deletedAt
      type: object
    BalanceHistory:
      additionalProperties: false
      properties:
        accountId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        accountType:
          examples:
            - creditCard
          maxLength: 50
          type: string
        alias:
          examples:
            - "@person1"
          maxLength: 256
          type: string
        assetCode:
          examples:
            - USD
          maxLength: 10
          minLength: 2
          type: string
        available:
          examples:
            - "1500"
          minimum: 0
          type: string
        createdAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
        direction:
          examples:
            - credit
          type: string
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        key:
          examples:
            - asset-freeze
          maxLength: 100
          type: string
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        onHold:
          examples:
            - "500"
          minimum: 0
          type: string
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        overdraftUsed:
          examples:
            - "0"
          type: string
        settings:
          $ref: "#/components/schemas/BalanceSettings"
        updatedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
        version:
          examples:
            - 1
          format: int64
          minimum: 1
          type: integer
      required:
        - id
        - organizationId
        - ledgerId
        - accountId
        - alias
        - key
        - assetCode
        - available
        - onHold
        - version
        - accountType
        - overdraftUsed
        - createdAt
        - updatedAt
      type: object
    BalanceSettings:
      additionalProperties: false
      properties:
        allowOverdraft:
          examples:
            - false
          type: boolean
        balanceScope:
          examples:
            - transactional
          type: string
        overdraftLimit:
          examples:
            - "1000.00"
          type: string
        overdraftLimitEnabled:
          examples:
            - false
          type: boolean
      required:
        - allowOverdraft
        - overdraftLimitEnabled
      type: object
    BalanceTotals:
      additionalProperties: false
      properties:
        assetCode:
          examples:
            - BRL
          type: string
        available:
          examples:
            - "1234567.89"
          type: string
        balanceKey:
          examples:
            - poupanca
          type: string
        count:
          description: Number of balances summed
          examples:
            - 98765
          format: int64
          type: integer
        onHold:
          examples:
            - "0"
          type: string
      required:
        - balanceKey
        - assetCode
        - available
        - onHold
        - count
      type: object
    BankingDetails:
      additionalProperties: false
      properties:
        account:
          examples:
            - "123450"
          maxLength: 50
          type: string
        bankId:
          examples:
            - "12345"
          maxLength: 50
          type: string
        branch:
          examples:
            - "0001"
          maxLength: 50
          type: string
        closingDate:
          examples:
            - "2025-12-31"
          format: date
          type: string
        countryCode:
          examples:
            - US
          maxLength: 2
          type: string
        iban:
          examples:
            - US12345678901234567890
          maxLength: 34
          type: string
        openingDate:
          examples:
            - "2025-01-01"
          format: date
          type: string
        type:
          examples:
            - CACC
          maxLength: 10
          type: string
      type: object
    Contact:
      additionalProperties: false
      properties:
        mobilePhone:
          examples:
            - "+1555555555"
          maxLength: 32
          type: string
        otherPhone:
          examples:
            - "+1555555555"
          maxLength: 32
          type: string
        primaryEmail:
          examples:
            - john.doe@example.com
          maxLength: 256
          type: string
        secondaryEmail:
          examples:
            - john.doe@example.com
          maxLength: 256
          type: string
      type: object
    CreateAccountBlockExceptionInput:
      additionalProperties: false
      properties:
        accountAlias:
          description: Alias of the source account the exception authorizes
          examples:
            - "@fraud_account"
          type: string
        amount:
          description: Exact amount of the authorized debit, as a positive decimal string
          examples:
            - "150.00"
          type: string
        ttl:
          description: Lifetime in seconds (1-86400, default 300)
          examples:
            - 300
          format: int64
          type: integer
      required:
        - accountAlias
        - amount
      type: object
    CreateAccountBlockExceptionsInput:
      additionalProperties: false
      properties:
        exceptions:
          description: Exceptions to create (1-100 per request)
          items:
            $ref: "#/components/schemas/CreateAccountBlockExceptionInput"
          maxItems: 100
          minItems: 1
          type:
            - array
            - "null"
      required:
        - exceptions
      type: object
    CreateAccountInput:
      additionalProperties: false
      properties:
        alias:
          examples:
            - "@treasury_checking"
          maxLength: 100
          type:
            - string
            - "null"
        assetCode:
          examples:
            - USD
          maxLength: 100
          type: string
        blocked:
          type:
            - boolean
            - "null"
        entityId:
          examples:
            - EXT-ACC-12345
          maxLength: 256
          type:
            - string
            - "null"
        holderId:
          format: uuid
          type:
            - string
            - "null"
        metadata:
          additionalProperties: {}
          type: object
        name:
          examples:
            - Corporate Checking Account
          maxLength: 256
          type: string
        parentAccountId:
          format: uuid
          type:
            - string
            - "null"
        portfolioId:
          format: uuid
          type:
            - string
            - "null"
        segmentId:
          format: uuid
          type:
            - string
            - "null"
        skip:
          $ref: "#/components/schemas/AccountSkip"
        status:
          $ref: "#/components/schemas/Status"
        type:
          examples:
            - deposit
          type: string
      required:
        - name
        - parentAccountId
        - entityId
        - holderId
        - assetCode
        - portfolioId
        - segmentId
        - status
        - alias
        - type
        - blocked
        - metadata
      type: object
    CreateAccountTypeInput:
      additionalProperties: false
      properties:
        defaultDirection:
          examples:
            - credit
          type: string
        description:
          examples:
            - Assets that are expected to be converted to cash within one year
          type: string
        keyValue:
          examples:
            - current_assets
          type: string
        metadata:
          additionalProperties: {}
          type: object
        name:
          examples:
            - Current Assets
          type: string
      required:
        - name
        - keyValue
        - metadata
      type: object
    CreateAdditionalBalance:
      additionalProperties: false
      properties:
        allowReceiving:
          examples:
            - true
          type:
            - boolean
            - "null"
        allowSending:
          examples:
            - true
          type:
            - boolean
            - "null"
        direction:
          examples:
            - credit
          type: string
        key:
          examples:
            - asset-freeze
          type: string
        settings:
          $ref: "#/components/schemas/BalanceSettings"
      required:
        - key
        - allowSending
        - allowReceiving
      type: object
    CreateAssetInput:
      additionalProperties: false
      properties:
        code:
          examples:
            - USD
          type: string
        metadata:
          additionalProperties: {}
          type: object
        name:
          examples:
            - US Dollar
          type: string
        status:
          $ref: "#/components/schemas/Status"
        type:
          examples:
            - currency
          type: string
      required:
        - name
        - type
        - code
        - status
        - metadata
      type: object
    CreateAssetRateInput:
      additionalProperties: false
      properties:
        externalId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        from:
          examples:
            - USD
          maxLength: 10
          minLength: 2
          type: string
        metadata:
          additionalProperties: {}
          type: object
        rate:
          examples:
            - 100
          format: int64
          type: integer
        scale:
          examples:
            - 2
          format: int64
          minimum: 0
          type: integer
        source:
          examples:
            - External System
          maxLength: 200
          type: string
        to:
          examples:
            - BRL
          maxLength: 10
          minLength: 2
          type: string
        ttl:
          examples:
            - 3600
          format: int64
          minimum: 0
          type: integer
      required:
        - from
        - to
        - rate
        - metadata
      type: object
    CreateAtomicTransactionBatchV2ItemRequest:
      additionalProperties: false
      properties:
        accountBlockExceptionId:
          description: Single-use account-block exception identifier. Authorizes one debit of an exact amount out of a blocked source account, and is consumed on use. Rejected on the hold action.
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        action:
          description: Transaction action.
          enum:
            - direct
            - hold
          type: string
        amount:
          type: string
        asset:
          type: string
        code:
          type: string
        credits:
          items:
            $ref: "#/components/schemas/V2LegInput"
          maxItems: 500
          minItems: 1
          type: array
        debits:
          items:
            $ref: "#/components/schemas/V2LegInput"
          maxItems: 500
          minItems: 1
          type: array
        description:
          type: string
        metadata:
          additionalProperties: {}
          type: object
        operationRouteId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        order:
          description: One-based logical execution order.
          format: int64
          minimum: 1
          type: integer
        routeId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        scheme:
          description: Optional payment scheme of the transaction, for example PIX, WIRE, CARD or CRYPTO. Any value of up to 50 letters, digits, underscores or hyphens is accepted; it is trimmed and upper-cased. CARD covers any card payment and is never the card brand.
          examples:
            - PIX
          maxLength: 50
          type: string
        skip:
          $ref: "#/components/schemas/TransactionSkip"
      required:
        - action
        - order
        - asset
        - amount
        - debits
        - credits
      type: object
    CreateAtomicTransactionBatchV2Request:
      additionalProperties: false
      properties:
        transactions:
          description: Direct or hold transactions with unique consecutive order. All items succeed atomically or none is applied.
          items:
            $ref: "#/components/schemas/CreateAtomicTransactionBatchV2ItemRequest"
          maxItems: 50
          minItems: 1
          type: array
      required:
        - transactions
      type: object
    CreateAtomicTransactionBatchV2Response:
      additionalProperties: false
      properties:
        transactions:
          description: Created transactions in increasing logical order.
          items:
            $ref: "#/components/schemas/AtomicTransactionBatchV2Transaction"
          type: array
      required:
        - transactions
      type: object
    CreateHolderAccountInput:
      additionalProperties: false
      properties:
        alias:
          examples:
            - "@treasury_checking"
          maxLength: 100
          type:
            - string
            - "null"
        assetCode:
          examples:
            - USD
          maxLength: 100
          type: string
        bankingDetails:
          $ref: "#/components/schemas/BankingDetails"
        blocked:
          type:
            - boolean
            - "null"
        entityId:
          examples:
            - EXT-ACC-12345
          maxLength: 256
          type:
            - string
            - "null"
        metadata:
          additionalProperties: {}
          type: object
        name:
          examples:
            - Corporate Checking Account
          maxLength: 256
          type: string
        parentAccountId:
          format: uuid
          type:
            - string
            - "null"
        portfolioId:
          format: uuid
          type:
            - string
            - "null"
        regulatoryFields:
          $ref: "#/components/schemas/RegulatoryFields"
        relatedParties:
          items:
            $ref: "#/components/schemas/RelatedParty"
          type:
            - array
            - "null"
        segmentId:
          format: uuid
          type:
            - string
            - "null"
        skip:
          $ref: "#/components/schemas/AccountSkip"
        status:
          $ref: "#/components/schemas/Status"
        type:
          examples:
            - deposit
          type: string
      required:
        - name
        - parentAccountId
        - entityId
        - assetCode
        - portfolioId
        - segmentId
        - status
        - alias
        - type
        - blocked
        - metadata
      type: object
    CreateHolderInput:
      additionalProperties: false
      properties:
        addresses:
          $ref: "#/components/schemas/Addresses"
        contact:
          $ref: "#/components/schemas/Contact"
        document:
          examples:
            - "12345678900"
          maxLength: 100
          type: string
        externalId:
          examples:
            - G4K7N8M2
          maxLength: 256
          type:
            - string
            - "null"
        legalPerson:
          $ref: "#/components/schemas/LegalPerson"
        metadata:
          additionalProperties: {}
          type: object
        name:
          examples:
            - John Doe
          maxLength: 256
          type: string
        naturalPerson:
          $ref: "#/components/schemas/NaturalPerson"
        type:
          examples:
            - NATURAL_PERSON
          maxLength: 100
          type:
            - string
            - "null"
      required:
        - externalId
        - type
        - name
        - document
        - addresses
        - contact
        - naturalPerson
        - legalPerson
        - metadata
      type: object
    CreateInstrumentInput:
      additionalProperties: false
      properties:
        accountId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        bankingDetails:
          $ref: "#/components/schemas/BankingDetails"
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        metadata:
          additionalProperties: {}
          type: object
        regulatoryFields:
          $ref: "#/components/schemas/RegulatoryFields"
        relatedParties:
          items:
            $ref: "#/components/schemas/RelatedParty"
          type:
            - array
            - "null"
      required:
        - ledgerId
        - accountId
        - metadata
        - bankingDetails
      type: object
    CreateLedgerInput:
      additionalProperties: false
      properties:
        metadata:
          additionalProperties: {}
          type: object
        name:
          maxLength: 256
          type: string
        settings:
          $ref: "#/components/schemas/LedgerSettingsInput"
        status:
          $ref: "#/components/schemas/Status"
      required:
        - name
        - status
        - metadata
      type: object
    CreateMetadataIndexInput:
      additionalProperties: false
      properties:
        metadataKey:
          examples:
            - tier
          type: string
        sparse:
          examples:
            - true
          type:
            - boolean
            - "null"
        unique:
          examples:
            - false
          type: boolean
      required:
        - metadataKey
        - unique
        - sparse
      type: object
    CreateOperationRouteInput:
      additionalProperties: false
      properties:
        account:
          $ref: "#/components/schemas/AccountRule"
        accountingEntries:
          $ref: "#/components/schemas/AccountingEntries"
        code:
          examples:
            - EXT-001
          type: string
        description:
          examples:
            - This operation route handles cash-in transactions from service charge collections
          type: string
        metadata:
          additionalProperties: {}
          type: object
        operationType:
          enum:
            - source
            - destination
            - bidirectional
          examples:
            - source
          type: string
        title:
          examples:
            - Cashin from service charge
          type: string
      required:
        - metadata
      type: object
    CreateOrganizationInput:
      additionalProperties: false
      properties:
        address:
          $ref: "#/components/schemas/Address"
        doingBusinessAs:
          examples:
            - Lerian FS
          maxLength: 256
          type:
            - string
            - "null"
        legalDocument:
          examples:
            - "123456789012345"
          maxLength: 256
          type: string
        legalName:
          examples:
            - Lerian Financial Services Ltd.
          maxLength: 256
          type: string
        metadata:
          additionalProperties: {}
          type: object
        parentOrganizationId:
          format: uuid
          type:
            - string
            - "null"
        status:
          $ref: "#/components/schemas/Status"
      required:
        - legalName
        - parentOrganizationId
        - doingBusinessAs
        - legalDocument
        - address
        - status
        - metadata
      type: object
    CreatePortfolioInput:
      additionalProperties: false
      properties:
        entityId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        metadata:
          additionalProperties: {}
          type: object
        name:
          examples:
            - My Portfolio
          type: string
        status:
          $ref: "#/components/schemas/Status"
      required:
        - entityId
        - name
        - status
        - metadata
      type: object
    CreateSegmentInput:
      additionalProperties: false
      properties:
        metadata:
          additionalProperties: {}
          type: object
        name:
          examples:
            - My Segment
          type: string
        status:
          $ref: "#/components/schemas/Status"
      required:
        - name
        - status
        - metadata
      type: object
    CreateTransactionInflowInput:
      additionalProperties: false
      properties:
        chartOfAccountsGroupName:
          examples:
            - FUNDING
          maxLength: 256
          type: string
        code:
          examples:
            - TR12345
          maxLength: 100
          type: string
        description:
          examples:
            - New Transaction
          maxLength: 256
          type: string
        metadata:
          additionalProperties: {}
          type: object
        route:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        routeId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        send:
          $ref: "#/components/schemas/SendInflow"
        transactionDate:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - metadata
        - send
      type: object
    CreateTransactionInput:
      additionalProperties: false
      properties:
        chartOfAccountsGroupName:
          examples:
            - FUNDING
          maxLength: 256
          type: string
        code:
          examples:
            - TR12345
          maxLength: 100
          type: string
        description:
          examples:
            - New Transaction
          maxLength: 256
          type: string
        metadata:
          additionalProperties: {}
          type: object
        pending:
          default: false
          examples:
            - true
          type: boolean
        route:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        routeId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        send:
          $ref: "#/components/schemas/Send"
        transactionDate:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - pending
        - metadata
        - send
      type: object
    CreateTransactionOutflowInput:
      additionalProperties: false
      properties:
        chartOfAccountsGroupName:
          examples:
            - WITHDRAWAL
          maxLength: 256
          type: string
        code:
          examples:
            - TR12345
          maxLength: 100
          type: string
        description:
          examples:
            - New Outflow Transaction
          maxLength: 256
          type: string
        metadata:
          additionalProperties: {}
          type: object
        pending:
          default: false
          examples:
            - true
          type: boolean
        route:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        routeId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        send:
          $ref: "#/components/schemas/SendOutflow"
        transactionDate:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - pending
        - metadata
        - send
      type: object
    CreateTransactionRouteInput:
      additionalProperties: false
      properties:
        description:
          examples:
            - Settlement route for service charges
          type: string
        metadata:
          additionalProperties: {}
          type: object
        operationRoutes:
          items:
            format: uuid
            type: string
          type:
            - array
            - "null"
        title:
          examples:
            - Charge Settlement
          type: string
      required:
        - metadata
      type: object
    CreateTransactionRouteInputV2:
      additionalProperties: false
      properties:
        description:
          examples:
            - Settlement route for service charges
          type: string
        metadata:
          additionalProperties: {}
          type: object
        operationRoutes:
          items:
            format: uuid
            type: string
          type:
            - array
            - "null"
        optionalOperationRoutes:
          items:
            format: uuid
            type: string
          type:
            - array
            - "null"
        title:
          examples:
            - Charge Settlement
          type: string
      required:
        - metadata
      type: object
    CreateTransactionV2Input:
      additionalProperties: false
      description: Transaction request body. `debits` and `credits` are the two required, non-empty leg arrays of the transaction; one debit paired with many credits, or the reverse, is a valid request. Every leg names the `organizationId` and `ledgerId` its account belongs to. The direct and hold actions accept multiple enabled ledgers and return an atomic group; block and unblock still require every leg to name the same pair. `asset`, `amount`, `description`, `code`, `routeId`, `operationRouteId` and `metadata` sit alongside the two leg arrays, and `amount` is the transaction total that the legs' `share` expressions divide. Each leg array holds at most 500 legs.
      properties:
        accountBlockExceptionId:
          description: Single-use account-block exception identifier. Authorizes one debit of an exact amount out of a blocked source account, and is consumed on use. Rejected on the hold action.
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        amount:
          type: string
        asset:
          type: string
        code:
          type: string
        credits:
          items:
            $ref: "#/components/schemas/V2LegInput"
          maxItems: 500
          minItems: 1
          type: array
        debits:
          items:
            $ref: "#/components/schemas/V2LegInput"
          maxItems: 500
          minItems: 1
          type: array
        description:
          type: string
        metadata:
          additionalProperties: {}
          type: object
        operationRouteId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        routeId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        scheme:
          description: Optional payment scheme of the transaction, for example PIX, WIRE, CARD or CRYPTO. Any value of up to 50 letters, digits, underscores or hyphens is accepted; it is trimmed and upper-cased. CARD covers any card payment and is never the card brand.
          examples:
            - PIX
          maxLength: 50
          type: string
        skip:
          $ref: "#/components/schemas/TransactionSkip"
      required:
        - asset
        - amount
        - debits
        - credits
      type: object
    CreatedTransactionV2:
      additionalProperties: false
      properties:
        accountPlanFees:
          description: "Account plan outcome of each source account of the transaction with an active account plan assignment: the matched fee, whether the unit was free (quota), charged or matched no fee (no_match), its ordinal in the period and the fee charged. Absent when no source account has an assignment."
          items:
            $ref: "#/components/schemas/FeeAccountPlanFeeOutcome"
          type:
            - array
            - "null"
        amount:
          examples:
            - "1500"
          minimum: 0
          type:
            - string
            - "null"
        assetCode:
          examples:
            - BRL
          maxLength: 10
          minLength: 2
          type: string
        createdAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
        credit:
          examples:
            -   - "@person2"
          items:
            type: string
          type:
            - array
            - "null"
        debit:
          examples:
            -   - "@person1"
          items:
            type: string
          type:
            - array
            - "null"
        deletedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type:
            - string
            - "null"
        description:
          examples:
            - Transaction description
          maxLength: 256
          type: string
        feesSkipped:
          examples:
            - false
          type: boolean
        groupId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        metadata:
          additionalProperties: {}
          description: "Additional custom attributes. The ledger writes six fee keys on this field itself and reserves them: feeApplied is the string true when the fee engine actually charged this transaction; packageAppliedID is the identifier of the fee package the engine applied, written when that package charged a fee or recorded an exemption (including a package that priced the transaction at zero), and absent when no package applied, which includes a route whose packages all exclude the amount by their bounds, or when the applied package's fees only rounded down to zero; feeExemption is a string holding a JSON object with exempt, reason and message, present when every account on one side of the transaction is exempt from fees, which is how a caller tells an exemption apart from no package having matched; feeExemption is also present, with reason cross_ledger_bridge, when the only account on one side that would have paid a fee is the @external/<asset> bridge closing a part of a cross-ledger group, because that bridge never pays a fee; feeExemption is also present, with reason zero_fee_amount, when the package priced the transaction at zero, for instance a band configured with no fee, so no fee leg was posted and feeApplied is absent; a transaction recorded before v4.1.1 stored feeExemption as that object itself, and a read returns it as the string too; feeDebtOpenings and feeDebtSettlements are strings holding a JSON array, in the order the ledger applied them, of the fee debts this transaction opened because its payer could not fund a deferrable fee (debtId, debtorRef, creditRef, opened, seq) and of the fee debts it settled (debtId, debtorRef, creditRef, amount, opened, seq), each absent when there is none; feeDebtCollection is the string true on a standalone fee-debt collection, whose amount is what it settled and which cannot be reverted. A request body carrying feeApplied, packageAppliedID, feeExemption, feeDebtOpenings, feeDebtSettlements, feeDebtCollection or feeDeferPair is refused with 400 naming the offending key, on every body that carries transaction metadata: a create, a metadata update and a fee estimate. A metadata update, including one that clears the metadata, never changes them. So a value present here is always the ledger's own word about the charge and never one a caller supplied. feeLeg and feeDeferPair, on operation metadata, are reserved the same way. Transaction-level metadata is additive, so caller-supplied keys on this field are preserved alongside the ledger keys."
          type: object
        operations:
          items:
            $ref: "#/components/schemas/OperationV2"
          type:
            - array
            - "null"
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        parentTransactionId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        routeId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        scheme:
          description: Payment scheme the transaction declared, normalized to upper case; absent when none.
          examples:
            - PIX
          maxLength: 50
          type: string
        status:
          $ref: "#/components/schemas/TransactionStatus"
        tracerSkipped:
          examples:
            - false
          type: boolean
        updatedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - id
        - description
        - status
        - amount
        - assetCode
        - debit
        - credit
        - ledgerId
        - organizationId
        - feesSkipped
        - tracerSkipped
        - createdAt
        - updatedAt
        - deletedAt
        - operations
      type: object
    CrossLedgerSettings:
      additionalProperties: false
      properties:
        enabled:
          examples:
            - false
          type: boolean
      required:
        - enabled
      type: object
    CrossLedgerSettingsInput:
      additionalProperties: false
      properties:
        enabled:
          examples:
            - false
          type: boolean
      type: object
    CrossLedgerTransactionGroupV2:
      additionalProperties: false
      properties:
        groupId:
          format: uuid
          type: string
        revertedGroupId:
          description: Original group reversed by this group. Present only on grouped revert responses.
          format: uuid
          type: string
        transactions:
          description: Created per-ledger transactions in deterministic decomposition order.
          items:
            $ref: "#/components/schemas/AtomicTransactionBatchV2Transaction"
          type: array
      required:
        - groupId
        - transactions
      type: object
    Distribute:
      additionalProperties: false
      properties:
        remaining:
          type: string
        to:
          items:
            $ref: "#/components/schemas/FromTo"
          type:
            - array
            - "null"
      type: object
    Error:
      additionalProperties: true
      properties:
        code:
          description: "Stable, machine-readable domain error code scoped to the emitting service (format: <SERVICE>-NNNN)."
          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
    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
    Fee:
      additionalProperties: false
      properties:
        calculationModel:
          $ref: "#/components/schemas/FeeCalculationModel"
        creditAccount:
          examples:
            - conta_receita_taxas_adm
          type: string
        deferrable:
          description: Whether the share of this fee the payer cannot fund becomes a fee debt, settled by the payer's next credits, instead of refusing the transaction. It applies only to /v2 direct transactions; /v1 and /v2 hold/commit still refuse. Only a fee whose isDeductibleFrom is false can be deferrable. Defaults to false.
          examples:
            - false
          type: boolean
        feeLabel:
          examples:
            - Taxa Administrativa
          type: string
        isDeductibleFrom:
          examples:
            - true
          type:
            - boolean
            - "null"
        priority:
          examples:
            - 1
          format: int64
          type: integer
        referenceAmount:
          examples:
            - originalAmount
          type: string
        routeFrom:
          examples:
            - taxa_débito
          type: string
        routeTo:
          examples:
            - taxa_crédito
          type: string
      required:
        - feeLabel
        - calculationModel
        - referenceAmount
        - isDeductibleFrom
        - creditAccount
      type: object
    FeeAccountPlan:
      additionalProperties: false
      properties:
        createdAt:
          examples:
            - "2026-01-01T00:00:00Z"
          format: date-time
          type: string
        currentVersion:
          description: Highest version created for the plan.
          examples:
            - 1
          format: int64
          type: integer
        deletedAt:
          examples:
            - "2026-01-01T00:00:00Z"
          format: date-time
          type: string
        description:
          examples:
            - Essential plan for individuals
          type: string
        enable:
          description: Whether new accounts can be assigned to the plan. Disabling it keeps charging the accounts already assigned.
          examples:
            - true
          type: boolean
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        label:
          description: Plan name, unique among the ledger's plans that are not deleted.
          examples:
            - Essential PF
          type: string
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        timezone:
          description: IANA timezone the monthly free quota is counted in. Defaults to America/Sao_Paulo.
          examples:
            - America/Sao_Paulo
          type: string
        updatedAt:
          examples:
            - "2026-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - id
        - organizationId
        - ledgerId
        - label
        - enable
        - timezone
        - currentVersion
        - createdAt
        - updatedAt
      type: object
    FeeAccountPlanAccounting:
      additionalProperties: false
      properties:
        operationRouteFrom:
          description: Operation route of the fee debit leg.
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        operationRouteTo:
          description: Operation route of the fee credit leg.
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        transactionRoute:
          description: Transaction route identifier the transaction routeId must equal for the fee to match.
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
      required:
        - transactionRoute
        - operationRouteFrom
        - operationRouteTo
      type: object
    FeeAccountPlanAccountingInput:
      additionalProperties: false
      properties:
        operationRouteFrom:
          description: Operation route of the fee debit leg. It must be linked to the transaction route, as optional on a transaction fee.
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        operationRouteTo:
          description: Operation route of the fee credit leg. It must be linked to the transaction route, as optional on a transaction fee.
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        transactionRoute:
          description: Transaction route a transaction must carry for the fee to match, when the ledger validates routes.
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
      required:
        - transactionRoute
        - operationRouteFrom
        - operationRouteTo
      type: object
    FeeAccountPlanAssignment:
      additionalProperties: false
      properties:
        accountAlias:
          examples:
            - "@cliente_x"
          type: string
        accountId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        accountPlanId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        endedAt:
          description: Instant the assignment ended; null while it is active.
          examples:
            - "2026-02-01T00:00:00Z"
          format: date-time
          type:
            - string
            - "null"
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        startedAt:
          examples:
            - "2026-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - id
        - organizationId
        - ledgerId
        - accountId
        - accountAlias
        - accountPlanId
        - startedAt
        - endedAt
      type: object
    FeeAccountPlanAssignments:
      additionalProperties: false
      properties:
        active:
          $ref: "#/components/schemas/FeeAccountPlanAssignment"
          description: Active assignment of the account; null when it has none.
        history:
          description: Every assignment of the account, most recent startedAt first.
          items:
            $ref: "#/components/schemas/FeeAccountPlanAssignment"
          type:
            - array
            - "null"
      required:
        - active
        - history
      type: object
    FeeAccountPlanFee:
      additionalProperties: false
      properties:
        accounting:
          $ref: "#/components/schemas/FeeAccountPlanAccounting"
          description: Routes of the fee. Required when the ledger validates accounting routes; only stored otherwise.
        calculationModel:
          $ref: "#/components/schemas/FeeCalculationModel"
        creditAccount:
          description: Alias of the ledger account that receives the fee.
          examples:
            - receita_tarifa_ted
          type: string
        feeLabel:
          examples:
            - TED enviada
          type: string
        freeQuota:
          description: Units per period charged nothing. Defaults to 0.
          examples:
            - 10
          format: int64
          minimum: 0
          type: integer
        period:
          description: Window the free quota resets on. Only monthly is accepted.
          enum:
            - monthly
          examples:
            - monthly
          type: string
        referenceAmount:
          description: Amount the fee is calculated on. Only originalAmount, the amount the account sends, is accepted.
          enum:
            - originalAmount
          examples:
            - originalAmount
          type: string
        trigger:
          $ref: "#/components/schemas/FeeAccountPlanTrigger"
      required:
        - feeLabel
        - trigger
        - calculationModel
        - referenceAmount
        - creditAccount
        - freeQuota
        - period
      type: object
    FeeAccountPlanFeeInput:
      additionalProperties: false
      properties:
        accounting:
          $ref: "#/components/schemas/FeeAccountPlanAccountingInput"
          description: Routes of the fee. Required when the ledger validates accounting routes; only stored otherwise.
        calculationModel:
          $ref: "#/components/schemas/FeeCalculationModel"
        creditAccount:
          description: Alias of the ledger account that receives the fee. It must exist in the ledger.
          examples:
            - receita_tarifa_ted
          type: string
        feeLabel:
          examples:
            - TED enviada
          type: string
        freeQuota:
          description: Units per period charged nothing. Defaults to 0.
          examples:
            - 10
          format: int64
          minimum: 0
          type:
            - integer
            - "null"
        period:
          description: Window the free quota resets on. Only monthly is accepted, and it is the default.
          examples:
            - monthly
          type: string
        referenceAmount:
          description: Amount the fee is calculated on. Only originalAmount is accepted, and it is the default.
          examples:
            - originalAmount
          type: string
        trigger:
          $ref: "#/components/schemas/FeeAccountPlanTriggerInput"
      required:
        - feeLabel
        - trigger
        - calculationModel
        - creditAccount
      type: object
    FeeAccountPlanFeeOutcome:
      additionalProperties: false
      properties:
        accountAlias:
          examples:
            - "@cliente_x"
          type: string
        accountId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        accountPlanId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        accountPlanVersion:
          examples:
            - 1
          format: int64
          type: integer
        amount:
          description: Fee charged; 0 unless outcome is charged.
          examples:
            - "7.9"
          type: string
        feeKey:
          description: Key of the matched fee; empty when outcome is no_match.
          examples:
            - tedEnviada
          type: string
        freeQuota:
          examples:
            - 10
          format: int64
          type: integer
        outcome:
          enum:
            - quota
            - charged
            - no_match
            - not_covered
          examples:
            - charged
          type: string
        unit:
          description: Ordinal of the consumed unit in the period; 0 when outcome is no_match.
          examples:
            - 11
          format: int64
          type: integer
      required:
        - accountId
        - accountAlias
        - accountPlanId
        - accountPlanVersion
        - feeKey
        - outcome
        - unit
        - freeQuota
        - amount
      type: object
    FeeAccountPlanFeePatch:
      additionalProperties: false
      properties:
        accounting:
          $ref: "#/components/schemas/FeeAccountPlanAccountingInput"
        calculationModel:
          $ref: "#/components/schemas/FeeCalculationModel"
        creditAccount:
          examples:
            - receita_tarifa_ted
          type:
            - string
            - "null"
        feeLabel:
          examples:
            - TED enviada
          type:
            - string
            - "null"
        freeQuota:
          examples:
            - 5
          format: int64
          minimum: 0
          type:
            - integer
            - "null"
        period:
          examples:
            - monthly
          type:
            - string
            - "null"
        referenceAmount:
          examples:
            - originalAmount
          type:
            - string
            - "null"
        trigger:
          $ref: "#/components/schemas/FeeAccountPlanTriggerInput"
      required:
        - feeLabel
        - trigger
        - calculationModel
        - referenceAmount
        - creditAccount
        - accounting
        - freeQuota
        - period
      type: object
    FeeAccountPlanFeeUsage:
      additionalProperties: false
      properties:
        charged:
          description: Units consumed in the period that were charged.
          examples:
            - 0
          format: int64
          type: integer
        feeKey:
          examples:
            - tedEnviada
          type: string
        freeQuota:
          examples:
            - 10
          format: int64
          type: integer
        period:
          $ref: "#/components/schemas/FeeQuotaUsagePeriod"
        remaining:
          description: Free units left in the period; never negative.
          examples:
            - 3
          format: int64
          type: integer
        trigger:
          description: "Opaque key of the free-quota counter the units are counted under: fee:<feeKey>:<SCHEME> for a transaction fee (fee:<feeKey>:* for a routed fee without schemes, counting every scheme on its route), fee:<feeKey> for a service fee. Editing the fee keeps the key; do not parse it, read feeKey instead."
          examples:
            - fee:tedEnviada:TED
          type: string
        used:
          description: Units consumed in the period, free or charged.
          examples:
            - 7
          format: int64
          type: integer
      required:
        - feeKey
        - trigger
        - period
        - freeQuota
        - used
        - remaining
        - charged
      type: object
    FeeAccountPlanTrigger:
      additionalProperties: false
      properties:
        direction:
          description: Side of the transaction the fee incurs on. Only sent is accepted.
          enum:
            - sent
          examples:
            - sent
          type: string
        metadata:
          additionalProperties:
            type: string
          description: "Metadata pairs a transaction must all carry for the fee to match, each matching only a string metadata value equal to it. Each pair counts one toward fee specificity: among the fees of a plan that match one transaction, the one carrying the most pairs applies. Transaction fees only. Absent or empty matches whatever the metadata."
          examples:
            - channel: app
          type: object
        schemes:
          description: Transaction schemes the fee matches, normalized to trimmed upper case. Required when the ledger does not validate accounting routes; optional otherwise, where empty matches any scheme on the fee transaction route.
          examples:
            -   - TED
          items:
            type: string
          type:
            - array
            - "null"
        serviceCode:
          description: Service code charged through fee-charges, normalized to trimmed upper case. Required for a service trigger.
          examples:
            - SAQUE
          type: string
        type:
          enum:
            - transaction
            - service
          examples:
            - transaction
          type: string
      required:
        - type
      type: object
    FeeAccountPlanTriggerInput:
      additionalProperties: false
      properties:
        direction:
          description: Side of the transaction the fee incurs on. Required for a transaction fee; only sent is accepted.
          enum:
            - sent
          examples:
            - sent
          type: string
        metadata:
          additionalProperties:
            type: string
          description: "Metadata pairs a transaction must all carry for the fee to match, each matching only a string metadata value equal to it. Each pair counts one toward fee specificity: among the fees of a plan that match one transaction, the one carrying the most pairs applies. Transaction fees only, refused on a service fee. Omit it, or send an empty object, to match whatever the metadata."
          examples:
            - channel: app
          type: object
        schemes:
          description: Transaction schemes the fee matches, normalized to trimmed upper case (^[A-Z0-9_-]{1,50}$). Transaction fees only. Required when the ledger does not validate accounting routes.
          examples:
            -   - TED
          items:
            type: string
          type:
            - array
            - "null"
        serviceCode:
          description: Service code charged through fee-charges, normalized like a scheme. Required for a service fee, refused on a transaction fee.
          examples:
            - SAQUE
          type: string
        type:
          enum:
            - transaction
            - service
          examples:
            - transaction
          type: string
      required:
        - type
      type: object
    FeeAccountPlanUsage:
      additionalProperties: false
      properties:
        accountId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        accountPlanId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        accountPlanVersion:
          description: Version of the plan in effect now, whose fees and free quotas are listed.
          examples:
            - 1
          format: int64
          type: integer
        items:
          description: One item per fee and quota trigger. A transaction fee counts its free quota per scheme, so it lists one item per scheme.
          items:
            $ref: "#/components/schemas/FeeAccountPlanFeeUsage"
          type:
            - array
            - "null"
        period:
          $ref: "#/components/schemas/FeeQuotaUsagePeriod"
          description: Period the consumption is counted in.
      required:
        - accountId
        - accountPlanId
        - accountPlanVersion
        - period
        - items
      type: object
    FeeAccountPlanVersion:
      additionalProperties: false
      properties:
        accountPlanId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        createdAt:
          examples:
            - "2026-01-01T00:00:00Z"
          format: date-time
          type: string
        effectiveFrom:
          description: Instant from which this version applies.
          examples:
            - "2026-01-01T00:00:00Z"
          format: date-time
          type: string
        fees:
          additionalProperties:
            $ref: "#/components/schemas/FeeAccountPlanFee"
          description: Fees keyed by fee key. A key must match ^[a-z][a-zA-Z0-9]*$.
          type: object
        version:
          examples:
            - 1
          format: int64
          type: integer
      required:
        - accountPlanId
        - version
        - effectiveFrom
        - fees
        - createdAt
      type: object
    FeeAccountPlanView:
      additionalProperties: false
      properties:
        createdAt:
          examples:
            - "2026-01-01T00:00:00Z"
          format: date-time
          type: string
        currentVersion:
          description: Highest version created for the plan.
          examples:
            - 1
          format: int64
          type: integer
        deletedAt:
          examples:
            - "2026-01-01T00:00:00Z"
          format: date-time
          type: string
        description:
          examples:
            - Essential plan for individuals
          type: string
        effectiveFrom:
          description: Instant the version in effect applies from.
          examples:
            - "2026-01-01T00:00:00Z"
          format: date-time
          type: string
        enable:
          description: Whether new accounts can be assigned to the plan. Disabling it keeps charging the accounts already assigned.
          examples:
            - true
          type: boolean
        fees:
          additionalProperties:
            $ref: "#/components/schemas/FeeAccountPlanFee"
          description: Fees of the version in effect, keyed by fee key.
          type: object
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        label:
          description: Plan name, unique among the ledger's plans that are not deleted.
          examples:
            - Essential PF
          type: string
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        timezone:
          description: IANA timezone the monthly free quota is counted in. Defaults to America/Sao_Paulo.
          examples:
            - America/Sao_Paulo
          type: string
        updatedAt:
          examples:
            - "2026-01-01T00:00:00Z"
          format: date-time
          type: string
        version:
          description: Version in effect at the instant of the read.
          examples:
            - 1
          format: int64
          type: integer
      required:
        - version
        - effectiveFrom
        - fees
        - id
        - organizationId
        - ledgerId
        - label
        - enable
        - timezone
        - currentVersion
        - createdAt
        - updatedAt
      type: object
    FeeAccountTarget:
      additionalProperties: false
      properties:
        aliases:
          examples:
            -   - account_alpha
                - account_beta
          items:
            type: string
          type:
            - array
            - "null"
        portfolioId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        segmentId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
      type: object
    FeeAssignAccountPlanInput:
      additionalProperties: false
      properties:
        accountPlanId:
          description: Account plan to assign. It must belong to the ledger of the path, not be deleted and be enabled.
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
      required:
        - accountPlanId
      type: object
    FeeBillingCalculateRequest:
      additionalProperties: false
      properties:
        period:
          examples:
            - 2026-01
          type: string
        type:
          examples:
            - volume
          type: string
      required:
        - period
      type: object
    FeeBillingCalculateResponse:
      additionalProperties: false
      properties:
        results:
          items:
            $ref: "#/components/schemas/FeeBillingCalculationResult"
          type:
            - array
            - "null"
        summary:
          $ref: "#/components/schemas/FeeBillingCalculateSummary"
      required:
        - results
        - summary
      type: object
    FeeBillingCalculateSummary:
      additionalProperties: false
      properties:
        totalMaintenance:
          examples:
            - 3
          format: int64
          type: integer
        totalNetAmount:
          examples:
            - "456.78"
          type: string
        totalResults:
          examples:
            - 10
          format: int64
          type: integer
        totalVolume:
          examples:
            - 7
          format: int64
          type: integer
      required:
        - totalResults
        - totalVolume
        - totalMaintenance
        - totalNetAmount
      type: object
    FeeBillingCalculationResult:
      additionalProperties: false
      properties:
        billingPackageId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        billingPackageLabel:
          examples:
            - Monthly Volume Billing
          type: string
        billingType:
          examples:
            - volume
          type: string
        period:
          examples:
            - 2026-01
          type: string
        totalAccounts:
          examples:
            - 500
          format: int64
          type: integer
        totalCharged:
          examples:
            - 480
          format: int64
          type: integer
        totalNetAmount:
          examples:
            - "123.45"
          type: string
        totalSkipped:
          examples:
            - 20
          format: int64
          type: integer
        transactionPayload: {}
      required:
        - billingPackageId
        - billingPackageLabel
        - billingType
        - period
        - totalAccounts
        - totalCharged
        - totalSkipped
        - totalNetAmount
        - transactionPayload
      type: object
    FeeBillingPackage:
      additionalProperties: false
      properties:
        accountTarget:
          $ref: "#/components/schemas/FeeAccountTarget"
        assetCode:
          examples:
            - BRL
          type: string
        countMode:
          examples:
            - perRoute
          type: string
        createdAt:
          examples:
            - "2026-01-01T00:00:00Z"
          type: string
        creditAccountAlias:
          examples:
            - account_fees_credit
          type: string
        debitAccountAlias:
          examples:
            - account_fees_debit
          type: string
        deletedAt:
          examples:
            - "2026-06-01T00:00:00Z"
          type: string
        description:
          examples:
            - Charges per completed transaction route
          type: string
        discountTiers:
          items:
            $ref: "#/components/schemas/FeeDiscountTier"
          type:
            - array
            - "null"
        enable:
          examples:
            - true
          type:
            - boolean
            - "null"
        eventFilter:
          $ref: "#/components/schemas/FeeEventFilter"
        feeAmount:
          examples:
            - "50.00"
          type: string
        freeQuota:
          examples:
            - 100
          format: int64
          type: integer
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        label:
          examples:
            - Monthly Volume Billing
          type: string
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        maintenanceCreditAccount:
          examples:
            - account_maintenance_credit
          type: string
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        pricingModel:
          examples:
            - tiered
          type: string
        tiers:
          items:
            $ref: "#/components/schemas/FeePricingTier"
          type:
            - array
            - "null"
        type:
          examples:
            - volume
          type: string
        updatedAt:
          examples:
            - "2026-01-01T00:00:00Z"
          type: string
      required:
        - id
        - organizationId
        - ledgerId
        - label
        - type
        - enable
        - createdAt
        - updatedAt
      type: object
    FeeBillingPackageUpdate:
      additionalProperties: false
      properties:
        description:
          examples:
            - Updated description for the billing package
          type: string
        enable:
          examples:
            - false
          type: boolean
        label:
          examples:
            - Updated Billing Label
          type: string
      type: object
    FeeCalculation:
      additionalProperties: false
      properties:
        type:
          examples:
            - percentage
          type: string
        value:
          examples:
            - "100.00"
          type: string
      required:
        - type
        - value
      type: object
    FeeCalculationModel:
      additionalProperties: false
      properties:
        applicationRule:
          examples:
            - maxBetweenTypes
          type: string
        calculations:
          items:
            $ref: "#/components/schemas/FeeCalculation"
          type:
            - array
            - "null"
      required:
        - applicationRule
        - calculations
      type: object
    FeeCharge:
      additionalProperties: false
      properties:
        accountId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        accountPlanId:
          description: Account plan active for the account when the charge was taken; null when the account had none.
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        accountPlanVersion:
          description: Version of the account plan in effect when the charge was taken; 0 when the account had no plan.
          examples:
            - 1
          format: int64
          type: integer
        assetCode:
          description: Asset of the account the charge was taken in.
          examples:
            - BRL
          type: string
        createdAt:
          examples:
            - "2026-10-22T12:00:00Z"
          format: date-time
          type: string
        description:
          examples:
            - Tarifas de serviço de outubro
          type: string
        feeTransactionIds:
          description: Fee transactions that charged the charged items; empty when nothing was charged.
          items:
            type: string
          type:
            - array
            - "null"
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        items:
          description: One item per service code of the request, in request order.
          items:
            $ref: "#/components/schemas/FeeChargeItem"
          type:
            - array
            - "null"
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        metadata:
          additionalProperties: {}
          type: object
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        period:
          description: Monthly quota period (YYYY-MM) the units were counted in, in the plan timezone.
          examples:
            - 2026-10
          type: string
        totalAmount:
          description: Sum of the amounts of the charged items.
          examples:
            - "15"
          type: string
      required:
        - id
        - organizationId
        - ledgerId
        - accountId
        - accountPlanId
        - accountPlanVersion
        - items
        - totalAmount
        - assetCode
        - feeTransactionIds
        - period
        - createdAt
      type: object
    FeeChargeItem:
      additionalProperties: false
      properties:
        amount:
          description: Fee charged for the unit; 0 unless outcome is charged.
          examples:
            - "3"
          type: string
        feeKey:
          description: Key of the account plan fee the code matched; empty when outcome is not_covered.
          examples:
            - extratoImpresso
          type: string
        freeQuota:
          description: Free units per period of the matched fee; 0 when outcome is not_covered.
          examples:
            - 2
          format: int64
          type: integer
        outcome:
          enum:
            - quota
            - charged
            - not_covered
          examples:
            - charged
          type: string
        serviceCode:
          description: Service code of the unit, normalized to trimmed upper case.
          examples:
            - PAPER_STATEMENT
          type: string
        unit:
          description: Ordinal of the consumed unit in the period; 0 when outcome is not_covered.
          examples:
            - 3
          format: int64
          type: integer
      required:
        - serviceCode
        - feeKey
        - outcome
        - unit
        - freeQuota
        - amount
      type: object
    FeeChargeServiceFeesInput:
      additionalProperties: false
      properties:
        description:
          description: Description of the charge, also used as the description of the fee transaction.
          examples:
            - Tarifas de serviço de outubro
          maxLength: 256
          type: string
        metadata:
          additionalProperties: {}
          description: Flat metadata of the charge, also written to the fee transaction.
          type: object
        serviceCodes:
          description: Service codes to charge, 1 to 100. Each occurrence is one unit; codes are normalized to trimmed upper case.
          examples:
            -   - PAPER_STATEMENT
                - CARD_REISSUE
          items:
            type: string
          maxItems: 100
          minItems: 1
          type:
            - array
            - "null"
      required:
        - serviceCodes
      type: object
    FeeCreateAccountPlanInput:
      additionalProperties: false
      properties:
        description:
          examples:
            - Essential plan for individuals
          type:
            - string
            - "null"
        enable:
          description: Whether new accounts can be assigned to the plan.
          examples:
            - true
          type:
            - boolean
            - "null"
        fees:
          additionalProperties:
            $ref: "#/components/schemas/FeeAccountPlanFeeInput"
          description: Fees keyed by fee key, at least one. A key must match ^[a-z][a-zA-Z0-9]*$.
          type: object
        label:
          description: Plan name, unique among the ledger's plans that are not deleted.
          examples:
            - Essential PF
          type: string
        timezone:
          description: IANA timezone the monthly free quota is counted in. Defaults to America/Sao_Paulo.
          examples:
            - America/Sao_Paulo
          type:
            - string
            - "null"
      required:
        - label
        - description
        - enable
        - timezone
        - fees
      type: object
    FeeCreateBillingPackageInput:
      additionalProperties: false
      properties:
        accountTarget:
          $ref: "#/components/schemas/FeeAccountTarget"
        assetCode:
          examples:
            - BRL
          type: string
        countMode:
          examples:
            - perRoute
          type: string
        createdAt:
          examples:
            - "2026-01-01T00:00:00Z"
          type: string
        creditAccountAlias:
          examples:
            - account_fees_credit
          type: string
        debitAccountAlias:
          examples:
            - account_fees_debit
          type: string
        deletedAt:
          examples:
            - "2026-06-01T00:00:00Z"
          type: string
        description:
          examples:
            - Charges per completed transaction route
          type: string
        discountTiers:
          items:
            $ref: "#/components/schemas/FeeDiscountTier"
          type:
            - array
            - "null"
        enable:
          examples:
            - true
          type:
            - boolean
            - "null"
        eventFilter:
          $ref: "#/components/schemas/FeeEventFilter"
        feeAmount:
          examples:
            - "50.00"
          type: string
        freeQuota:
          examples:
            - 100
          format: int64
          type: integer
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        label:
          examples:
            - Monthly Volume Billing
          type: string
        maintenanceCreditAccount:
          examples:
            - account_maintenance_credit
          type: string
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        pricingModel:
          examples:
            - tiered
          type: string
        tiers:
          items:
            $ref: "#/components/schemas/FeePricingTier"
          type:
            - array
            - "null"
        type:
          examples:
            - volume
          type: string
        updatedAt:
          examples:
            - "2026-01-01T00:00:00Z"
          type: string
      required:
        - label
        - type
        - enable
      type: object
    FeeCreatePackageInput:
      additionalProperties: false
      properties:
        description:
          examples:
            - Pacote de taxas administrativas padrão
          type: string
        enable:
          type:
            - boolean
            - "null"
        feeGroupLabel:
          examples:
            - Pacote Padrão
          type: string
        fees:
          additionalProperties:
            $ref: "#/components/schemas/Fee"
          description: Fees keyed by fee key. A key must match ^[a-z][a-zA-Z0-9]*$ (a lowercase ASCII letter, then ASCII letters and digits) and is stored and returned verbatim; any other key is refused with 400.
          type: object
        maximumAmount:
          examples:
            - "1000.20"
          minimum: 0
          type: string
        metadataSelector:
          additionalProperties:
            type: string
          description: Metadata pairs a transaction must all carry for this package to apply, each matching only a string metadata value equal to it. Each pair counts one toward package specificity. Omit it to apply the package whatever the metadata.
          examples:
            - fee_context: ted_salario
          type: object
        minimumAmount:
          examples:
            - "100.00"
          minimum: 0
          type: string
        rounding:
          $ref: "#/components/schemas/FeeRounding"
          description: Rounds every fee this package charges to one scale, whatever the asset. Omit it to charge unrounded amounts.
        segmentId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type:
            - string
            - "null"
        transactionRoute:
          description: Transaction route identifier this package is scoped to. It must equal the routeId the payment carries, so it is a route UUID and not a free-form name. Omit it, or send it empty, to apply the package to every payment.
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        waivedAccounts:
          examples:
            -   - acc001
                - acc002
          items:
            type: string
          type: array
      required:
        - feeGroupLabel
        - segmentId
        - minimumAmount
        - maximumAmount
        - fees
        - enable
      type: object
    FeeDebtCollectInput:
      additionalProperties: false
      properties:
        accountAlias:
          description: Alias of the debtor account.
          examples:
            - "@customer"
          maxLength: 100
          type: string
        balanceKey:
          description: Key of the debtor balance; absent means the default balance.
          examples:
            - default
          maxLength: 100
          type: string
        maxAmount:
          description: Most the collection may settle, greater than zero; absent means everything the balance owes.
          examples:
            - "150.00"
          type: string
      required:
        - accountAlias
      type: object
    FeeDebtCollectOutput:
      additionalProperties: false
      properties:
        collected:
          description: Amount settled, oldest debt first; 0 when the balance had no open debt, no available funds, or cannot pay a debt's fee account.
          examples:
            - "150.00"
          type: string
        transactionId:
          description: Transaction recording the settlement, absent when nothing was collected.
          format: uuid
          type: string
      required:
        - collected
      type: object
    FeeDebtEntryView:
      additionalProperties: false
      properties:
        amount:
          examples:
            - "30"
          type: string
        appliedAt:
          format: date-time
          type: string
        kind:
          enum:
            - opened
            - settled
            - canceled
            - reopened
            - refunded
          examples:
            - settled
          type: string
        postingRef:
          examples:
            - to:0:credit:collect
          type: string
        transactionId:
          examples:
            - 01920000-0000-7000-8000-000000000002
          type: string
      required:
        - kind
        - transactionId
        - amount
        - appliedAt
      type: object
    FeeDebtListBody:
      additionalProperties: false
      properties:
        items:
          items:
            $ref: "#/components/schemas/FeeDebtView"
          type:
            - array
            - "null"
        limit:
          examples:
            - 10
          format: int64
          type: integer
        next_cursor:
          examples:
            - eyJpZCI6IjAxOTI...
          type: string
        openTotal:
          description: What this debtor balance (account_alias and balance_key) owes over all its open debts, not only this page, each counting at most its opened amount; present only with account_alias
          examples:
            - "25"
          type: string
        prev_cursor:
          examples:
            - eyJpZCI6IjAxOTE...
          type: string
      required:
        - items
        - limit
      type: object
    FeeDebtView:
      additionalProperties: false
      properties:
        assetCode:
          examples:
            - BRL
          type: string
        createdAt:
          description: When the earliest recorded change was applied
          format: date-time
          type: string
        creditBalance:
          description: Fee account balance the debt pays, as alias#key
          examples:
            - "@fees#default"
          type: string
        debtorBalance:
          description: Debtor balance as alias#key
          examples:
            - "@payer#default"
          type: string
        entries:
          description: Recorded changes, oldest first
          items:
            $ref: "#/components/schemas/FeeDebtEntryView"
          type:
            - array
            - "null"
        feePackageId:
          examples:
            - 01920000-0000-7000-8000-0000000000cc
          type: string
        id:
          description: Origin transaction id and the fee debit posting the debt opened in
          examples:
            - 01920000-0000-7000-8000-000000000001:from:1:debit
          type: string
        ledgerId:
          examples:
            - 01920000-0000-7000-8000-00000000000b
          type: string
        openedAmount:
          examples:
            - "70"
          type: string
        openedAt:
          format: date-time
          type: string
        organizationId:
          examples:
            - 01920000-0000-7000-8000-00000000000a
          type: string
        originTransactionId:
          examples:
            - 01920000-0000-7000-8000-000000000001
          type: string
        remaining:
          examples:
            - "40"
          type: string
        seq:
          description: Settlement order among the debtor's debts, oldest first
          examples:
            - 3
          format: int64
          type: integer
        updatedAt:
          description: When the latest recorded change was applied
          format: date-time
          type: string
      required:
        - id
        - organizationId
        - ledgerId
        - debtorBalance
        - creditBalance
        - originTransactionId
        - assetCode
        - seq
        - openedAmount
        - remaining
        - entries
        - createdAt
        - updatedAt
      type: object
    FeeDiscountTier:
      additionalProperties: false
      properties:
        discountPercentage:
          examples:
            - "10.00"
          type: string
        minQuantity:
          examples:
            - 1000
          format: int64
          type: integer
      required:
        - minQuantity
        - discountPercentage
      type: object
    FeeEstimate:
      additionalProperties: false
      properties:
        packageId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        transaction:
          $ref: "#/components/schemas/TransactionInput"
      required:
        - packageId
        - transaction
      type: object
    FeeEventFilter:
      additionalProperties: false
      properties:
        status:
          examples:
            - APPROVED
          type: string
        transactionRoute:
          examples:
            - payment_route
          type: string
      required:
        - transactionRoute
        - status
      type: object
    FeePackage:
      additionalProperties: false
      properties:
        createdAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
        deletedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type:
            - string
            - "null"
        description:
          examples:
            - Pacote de taxas administrativas padrão
          type:
            - string
            - "null"
        enable:
          type:
            - boolean
            - "null"
        feeGroupLabel:
          examples:
            - Pacote Padrão
          type: string
        fees:
          additionalProperties:
            $ref: "#/components/schemas/Fee"
          type: object
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        maximumAmount:
          examples:
            - "2"
          minimum: 0
          type: string
        metadataSelector:
          additionalProperties:
            type: string
          description: Metadata pairs a transaction must all carry for this package to apply, each matching only a string metadata value equal to it. Each pair counts one toward package specificity. Absent or empty applies the package whatever the metadata.
          examples:
            - fee_context: ted_salario
          type: object
        minimumAmount:
          examples:
            - "100"
          minimum: 0
          type: string
        rounding:
          $ref: "#/components/schemas/FeeRounding"
        segmentId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        transactionRoute:
          description: Transaction route identifier this package is scoped to. It must equal the routeId the payment carries, so it is a route UUID and not a free-form name. An absent or empty value applies the package to every payment.
          examples:
            - 00000000-0000-0000-0000-000000000000
          type:
            - string
            - "null"
        updatedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
        waivedAccounts:
          examples:
            -   - acc001
                - acc002
          items:
            type: string
          type:
            - array
            - "null"
      required:
        - id
        - feeGroupLabel
        - description
        - segmentId
        - ledgerId
        - transactionRoute
        - minimumAmount
        - maximumAmount
        - waivedAccounts
        - fees
        - enable
        - createdAt
        - updatedAt
        - deletedAt
      type: object
    FeePagination:
      additionalProperties: false
      properties:
        items: {}
        limit:
          examples:
            - 10
          format: int64
          type: integer
        page:
          examples:
            - 1
          format: int64
          type: integer
        total:
          examples:
            - 10
          format: int64
          type: integer
      required:
        - items
        - limit
        - total
      type: object
    FeePatchAccountPlanInput:
      additionalProperties: false
      properties:
        description:
          examples:
            - Essential plan for individuals
          type:
            - string
            - "null"
        effectiveFrom:
          description: RFC 3339 instant the new version applies from, only with fees. Defaults to the request instant; must not precede the effectiveFrom of the latest version.
          examples:
            - "2026-11-01T03:00:00Z"
          type:
            - string
            - "null"
        enable:
          examples:
            - true
          type:
            - boolean
            - "null"
        fees:
          additionalProperties:
            $ref: "#/components/schemas/FeeAccountPlanFeePatch"
          description: Fee patches keyed by fee key. An entry naming a stored key replaces the fields it sets on that fee, or removes the fee when it sets no field. Any other key adds a fee and must carry every required field. Sending fees creates a new plan version with the full resulting fee map.
          type: object
        label:
          examples:
            - Essential PF
          type:
            - string
            - "null"
        timezone:
          examples:
            - America/Sao_Paulo
          type:
            - string
            - "null"
      type: object
    FeePricingTier:
      additionalProperties: false
      properties:
        maxQuantity:
          examples:
            - 999
          format: int64
          type: integer
        minQuantity:
          examples:
            - 0
          format: int64
          type: integer
        unitPrice:
          examples:
            - "1.50"
          type: string
      required:
        - minQuantity
        - unitPrice
      type: object
    FeeQuotaUsagePeriod:
      additionalProperties: false
      properties:
        end:
          description: End of the period, excluded.
          examples:
            - "2026-11-01T03:00:00Z"
          format: date-time
          type: string
        label:
          description: Period in the YYYY-MM format.
          examples:
            - 2026-10
          type: string
        start:
          description: Start of the period, included.
          examples:
            - "2026-10-01T03:00:00Z"
          format: date-time
          type: string
      required:
        - label
        - start
        - end
      type: object
    FeeRounding:
      additionalProperties: false
      properties:
        mode:
          description: "How each fee total is rounded: floor rounds down, halfUp rounds half away from zero. Each payer's share rounds toward zero and the largest payer takes the remainder, so the shares sum to the total."
          enum:
            - floor
            - halfUp
          examples:
            - floor
          type: string
        scale:
          description: Decimal places each fee total and each payer's share is rounded to.
          examples:
            - 2
          format: int32
          maximum: 18
          minimum: 0
          type: integer
      required:
        - scale
        - mode
      type: object
    FeeUpdatePackageInput:
      additionalProperties: false
      properties:
        description:
          examples:
            - Pacote de taxas administrativas padrão
          type: string
        enable:
          examples:
            - true
          type: boolean
        feeGroupLabel:
          examples:
            - Pacote Padrão
          type: string
        fees:
          additionalProperties:
            $ref: "#/components/schemas/Fee"
          description: Fee patches keyed by fee key. An entry naming a stored key verbatim edits that fee, or removes it when the entry sets no field. Any other key adds a fee and must match ^[a-z][a-zA-Z0-9]*$ (a lowercase ASCII letter, then ASCII letters and digits), or the update is refused with 400; a key equal to a stored key except for letter case is also refused with 400, and the stored key must be used, unless the same patch removes that stored key, which renames the fee (the new key must still match the grammar).
          type: object
        maximumAmount:
          examples:
            - "1000"
          minimum: 0
          type:
            - string
            - "null"
        minimumAmount:
          examples:
            - "100"
          minimum: 0
          type:
            - string
            - "null"
        rounding:
          $ref: "#/components/schemas/FeeRounding"
          description: Replaces the stored rounding whole. An update cannot remove a stored rounding.
        waivedAccounts:
          examples:
            -   - acc001
                - acc002
          items:
            type: string
          type:
            - array
            - "null"
      type: object
    FromTo:
      additionalProperties: false
      properties:
        accountAlias:
          examples:
            - "@person1"
          type: string
        amount:
          $ref: "#/components/schemas/Amount"
        balanceKey:
          examples:
            - asset-freeze
          type: string
        chartOfAccounts:
          examples:
            - "1000"
          type: string
        description:
          examples:
            - description
          type: string
        isFrom:
          examples:
            - true
          type: boolean
        metadata:
          additionalProperties: {}
          type: object
        rate:
          $ref: "#/components/schemas/Rate"
        remaining:
          examples:
            - remaining
          type: string
        route:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        routeId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        share:
          $ref: "#/components/schemas/Share"
      required:
        - chartOfAccounts
        - metadata
      type: object
    Holder:
      additionalProperties: false
      properties:
        addresses:
          $ref: "#/components/schemas/Addresses"
        contact:
          $ref: "#/components/schemas/Contact"
        createdAt:
          examples:
            - "2025-01-01T00:00:00Z"
          format: date-time
          type: string
        deletedAt:
          examples:
            - "2025-01-01T00:00:00Z"
          format: date-time
          type:
            - string
            - "null"
        document:
          examples:
            - "12345678900"
          maxLength: 100
          type: string
        externalId:
          examples:
            - G4K7N8M2
          maxLength: 256
          type: string
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        legalPerson:
          $ref: "#/components/schemas/LegalPerson"
        metadata:
          additionalProperties: {}
          type: object
        name:
          examples:
            - John Doe
          maxLength: 256
          type: string
        naturalPerson:
          $ref: "#/components/schemas/NaturalPerson"
        type:
          examples:
            - NATURAL_PERSON
          maxLength: 100
          type: string
        updatedAt:
          examples:
            - "2025-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - createdAt
        - updatedAt
        - deletedAt
      type: object
    HolderAccountResponse:
      additionalProperties: false
      properties:
        account:
          $ref: "#/components/schemas/AccountV2"
        instrument:
          $ref: "#/components/schemas/Instrument"
        instrumentError:
          $ref: "#/components/schemas/InstrumentFailure"
      required:
        - account
        - instrument
      type: object
    IndexStats:
      additionalProperties: false
      properties:
        accesses:
          examples:
            - 1523
          format: int64
          type: integer
        statsSince:
          examples:
            - "2024-12-01T10:30:00Z"
          format: date-time
          type: string
      required:
        - accesses
      type: object
    Instrument:
      additionalProperties: false
      properties:
        accountId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type:
            - string
            - "null"
        bankingDetails:
          $ref: "#/components/schemas/BankingDetails"
        createdAt:
          examples:
            - "2025-01-01T00:00:00Z"
          format: date-time
          type: string
        deletedAt:
          examples:
            - "2025-01-01T00:00:00Z"
          format: date-time
          type:
            - string
            - "null"
        document:
          examples:
            - "12345678900"
          maxLength: 100
          type: string
        holderId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type:
            - string
            - "null"
        metadata:
          additionalProperties: {}
          type: object
        regulatoryFields:
          $ref: "#/components/schemas/RegulatoryFields"
        relatedParties:
          items:
            $ref: "#/components/schemas/RelatedParty"
          type:
            - array
            - "null"
        type:
          examples:
            - NATURAL_PERSON
          maxLength: 100
          type: string
        updatedAt:
          examples:
            - "2025-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - ledgerId
        - accountId
        - holderId
        - createdAt
        - updatedAt
        - deletedAt
      type: object
    InstrumentFailure:
      additionalProperties: false
      properties:
        reason:
          examples:
            - "0001"
          type: string
        status:
          examples:
            - FAILED
          type: string
      required:
        - status
        - reason
      type: object
    Ledger:
      additionalProperties: false
      properties:
        createdAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
        deletedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type:
            - string
            - "null"
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        metadata:
          additionalProperties: {}
          type: object
        name:
          examples:
            - Treasury Operations
          maxLength: 256
          type: string
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        settings:
          $ref: "#/components/schemas/LedgerSettings"
        status:
          $ref: "#/components/schemas/Status"
        updatedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - id
        - name
        - organizationId
        - status
        - createdAt
        - updatedAt
        - deletedAt
      type: object
    LedgerDashboardAssetPosition:
      additionalProperties: false
      properties:
        accounts:
          examples:
            - 42
          format: int64
          type: integer
        asset:
          examples:
            - BRL
          type: string
        available:
          examples:
            - "128400.55"
          type: string
        onHold:
          examples:
            - "1200.00"
          type: string
      required:
        - asset
        - accounts
        - available
        - onHold
      type: object
    LedgerDashboardAssetVolume:
      additionalProperties: false
      properties:
        amount:
          examples:
            - "41000.00"
          type: string
        asset:
          examples:
            - BRL
          type: string
        transactions:
          examples:
            - 128
          format: int64
          type: integer
      required:
        - asset
        - amount
        - transactions
      type: object
    LedgerDashboardAssets:
      additionalProperties: false
      properties:
        assets:
          items:
            $ref: "#/components/schemas/LedgerDashboardAssetPosition"
          type:
            - array
            - "null"
        updatedAt:
          format: date-time
          type: string
      required:
        - assets
        - updatedAt
      type: object
    LedgerDashboardMetrics:
      additionalProperties: false
      properties:
        byStatus:
          additionalProperties:
            format: int64
            type: integer
          type: object
        reversalsByAsset:
          description: "The part of the gross volume made of reversal legs: settled transactions inside the window whose parent_transaction_id is set, per asset. A true net is not derivable from volume and reversals alone, because it depends on whether each reversed original also falls inside the window."
          items:
            $ref: "#/components/schemas/LedgerDashboardAssetVolume"
          type:
            - array
            - "null"
        total:
          examples:
            - 1420
          format: int64
          type: integer
        updatedAt:
          format: date-time
          type: string
        volumeByAsset:
          items:
            $ref: "#/components/schemas/LedgerDashboardAssetVolume"
          type:
            - array
            - "null"
        windowEnd:
          format: date-time
          type: string
        windowStart:
          format: date-time
          type: string
      required:
        - total
        - byStatus
        - volumeByAsset
        - reversalsByAsset
        - windowStart
        - windowEnd
        - updatedAt
      type: object
    LedgerDashboardVolume:
      additionalProperties: false
      properties:
        points:
          items:
            $ref: "#/components/schemas/LedgerDashboardVolumePoint"
          type:
            - array
            - "null"
        updatedAt:
          format: date-time
          type: string
        windowEnd:
          format: date-time
          type: string
        windowStart:
          format: date-time
          type: string
      required:
        - points
        - windowStart
        - windowEnd
        - updatedAt
      type: object
    LedgerDashboardVolumePoint:
      additionalProperties: false
      properties:
        byAsset:
          items:
            $ref: "#/components/schemas/LedgerDashboardAssetVolume"
          type:
            - array
            - "null"
        date:
          examples:
            - "2026-09-19"
          type: string
        transactions:
          examples:
            - 212
          format: int64
          type: integer
      required:
        - date
        - transactions
        - byAsset
      type: object
    LedgerSettings:
      additionalProperties: false
      properties:
        accounting:
          $ref: "#/components/schemas/AccountingValidation"
        crossLedger:
          $ref: "#/components/schemas/CrossLedgerSettings"
        overrides:
          $ref: "#/components/schemas/OverridePolicy"
        tracer:
          $ref: "#/components/schemas/TracerSettings"
      required:
        - accounting
        - tracer
        - overrides
        - crossLedger
      type: object
    LedgerSettingsInput:
      additionalProperties: false
      properties:
        accounting:
          $ref: "#/components/schemas/AccountingValidationInput"
        crossLedger:
          $ref: "#/components/schemas/CrossLedgerSettingsInput"
        overrides:
          $ref: "#/components/schemas/OverridePolicyInput"
        tracer:
          $ref: "#/components/schemas/TracerSettingsInput"
      type: object
    LegacyError:
      additionalProperties: false
      properties:
        code:
          description: Stable, machine-readable midaz error code. Identical to the code /v2 returns for the same condition.
          examples:
            - "0065"
          type: string
        entityType:
          description: The domain entity the error concerns. Present only on field-validation errors.
          examples:
            - Account
          type: string
        fields:
          additionalProperties: {}
          description: Per-field validation detail, keyed by field name. The value is the violation message for a known field and the offending value for an unexpected one, so it is not always a string. The /v2 contract carries these as the 'errors' array.
          type: object
        message:
          description: Human-readable explanation of this occurrence. The /v2 contract carries this as 'detail'.
          type: string
        title:
          description: Short, human-readable summary of the error.
          examples:
            - Invalid Path Parameter
          type: string
      required:
        - title
        - message
        - code
      type: object
    LegalPerson:
      additionalProperties: false
      properties:
        activity:
          examples:
            - Electronic devices development
          maxLength: 256
          type: string
        annualGrossRevenue:
          $ref: "#/components/schemas/MonetaryAmount"
        foundingDate:
          examples:
            - "2025-01-01"
          format: date
          type: string
        representative:
          $ref: "#/components/schemas/Representative"
        size:
          examples:
            - Medium
          maxLength: 100
          type: string
        status:
          examples:
            - Active
          maxLength: 100
          type: string
        totalAssets:
          $ref: "#/components/schemas/MonetaryAmount"
        tradeName:
          examples:
            - Lerian Studio
          maxLength: 256
          type: string
        type:
          examples:
            - Limited Liability
          maxLength: 100
          type: string
      type: object
    LifecycleV2Input:
      additionalProperties: false
      properties:
        accountBlockExceptionId:
          description: Single-use account-block exception identifier. Authorizes one debit of an exact amount out of a blocked source account, and is consumed on use. Rejected on the hold action.
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
      type: object
    MetadataIndex:
      additionalProperties: false
      properties:
        entityName:
          examples:
            - transaction
          type: string
        indexName:
          examples:
            - metadata.tier_1
          type: string
        metadataKey:
          examples:
            - tier
          type: string
        sparse:
          examples:
            - true
          type: boolean
        stats:
          $ref: "#/components/schemas/IndexStats"
        unique:
          examples:
            - false
          type: boolean
      required:
        - indexName
        - entityName
        - metadataKey
        - unique
        - sparse
      type: object
    MonetaryAmount:
      additionalProperties: false
      properties:
        currency:
          examples:
            - BRL
          pattern: ^[A-Z]{3}$
          type: string
        referenceDate:
          examples:
            - "2026-06-30"
          format: date
          type: string
        value:
          examples:
            - "12500.50"
          pattern: ^[0-9]{1,20}(\.[0-9]{1,10})?$
          type: string
      required:
        - value
        - currency
        - referenceDate
      type: object
    NaturalPerson:
      additionalProperties: false
      properties:
        birthDate:
          examples:
            - "1990-01-01"
          format: date
          type: string
        civilStatus:
          examples:
            - Single
          maxLength: 100
          type: string
        fatherName:
          examples:
            - John Doe
          maxLength: 256
          type: string
        favoriteName:
          examples:
            - John
          maxLength: 256
          type: string
        gender:
          examples:
            - Male
          maxLength: 100
          type: string
        monthlyGrossIncome:
          $ref: "#/components/schemas/MonetaryAmount"
        motherName:
          examples:
            - Jane Doe
          maxLength: 256
          type: string
        nationality:
          examples:
            - Brazilian
          maxLength: 100
          type: string
        socialName:
          examples:
            - John Doe
          maxLength: 256
          type: string
        status:
          examples:
            - Active
          maxLength: 100
          type: string
      type: object
    Operation:
      additionalProperties: false
      properties:
        accountAlias:
          examples:
            - "@person1"
          maxLength: 256
          type: string
        accountId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        amount:
          $ref: "#/components/schemas/OperationAmount"
        assetCode:
          examples:
            - BRL
          maxLength: 10
          minLength: 2
          type: string
        balance:
          $ref: "#/components/schemas/OperationBalance"
        balanceAffected:
          examples:
            - true
          format: boolean
          type: boolean
        balanceAfter:
          $ref: "#/components/schemas/OperationBalance"
        balanceId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        balanceKey:
          examples:
            - asset-freeze
          maxLength: 100
          type: string
        chartOfAccounts:
          examples:
            - "1000"
          maxLength: 20
          type: string
        createdAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
        deletedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type:
            - string
            - "null"
        description:
          examples:
            - Credit card operation
          maxLength: 256
          type: string
        direction:
          examples:
            - debit
          maxLength: 50
          type: string
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        metadata:
          additionalProperties: {}
          type: object
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        route:
          examples:
            - 00000000-0000-0000-0000-000000000000
          maxLength: 250
          type: string
        routeCode:
          examples:
            - ROUTE-001
          maxLength: 100
          type: string
        routeDescription:
          examples:
            - Settlement route for service charges
          maxLength: 250
          type: string
        routeId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        status:
          $ref: "#/components/schemas/OperationStatus"
        transactionId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        type:
          examples:
            - DEBIT
          maxLength: 50
          type: string
        updatedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - id
        - transactionId
        - description
        - type
        - assetCode
        - chartOfAccounts
        - amount
        - balance
        - balanceAfter
        - status
        - accountId
        - accountAlias
        - balanceKey
        - balanceId
        - organizationId
        - ledgerId
        - route
        - balanceAffected
        - createdAt
        - updatedAt
        - deletedAt
        - metadata
      type: object
    OperationAmount:
      additionalProperties: false
      properties:
        value:
          examples:
            - "1500"
          minimum: 0
          type:
            - string
            - "null"
      required:
        - value
      type: object
    OperationBalance:
      additionalProperties: false
      properties:
        available:
          examples:
            - "1500"
          minimum: 0
          type:
            - string
            - "null"
        onHold:
          examples:
            - "500"
          minimum: 0
          type:
            - string
            - "null"
        overdraftUsed:
          examples:
            - "130"
          minimum: 0
          type: string
        version:
          examples:
            - 2
          format: int64
          minimum: 0
          type:
            - integer
            - "null"
      required:
        - available
        - onHold
        - version
        - overdraftUsed
      type: object
    OperationRoute:
      additionalProperties: false
      properties:
        account:
          $ref: "#/components/schemas/AccountRule"
        accountingEntries:
          $ref: "#/components/schemas/AccountingEntries"
        code:
          examples:
            - EXT-001
          type: string
        createdAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
        deletedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type:
            - string
            - "null"
        description:
          examples:
            - This operation route handles cash-in transactions from service charge collections
          type: string
        id:
          examples:
            - 01965ed9-7fa4-75b2-8872-fc9e8509ab0a
          type: string
        ledgerId:
          examples:
            - 01965ed9-7fa4-75b2-8872-fc9e8509ab0a
          type: string
        metadata:
          additionalProperties: {}
          type: object
        operationType:
          examples:
            - source
          type: string
        organizationId:
          examples:
            - 01965ed9-7fa4-75b2-8872-fc9e8509ab0a
          type: string
        title:
          examples:
            - Cashin from service charge
          type: string
        updatedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - createdAt
        - updatedAt
        - deletedAt
      type: object
    OperationStatus:
      additionalProperties: false
      properties:
        code:
          examples:
            - ACTIVE
          maxLength: 100
          type: string
        description:
          examples:
            - Active status
          maxLength: 256
          type:
            - string
            - "null"
      required:
        - code
        - description
      type: object
    OperationUpdateOperationInput:
      additionalProperties: false
      properties:
        description:
          examples:
            - Credit card operation
          maxLength: 256
          type: string
        metadata:
          additionalProperties: {}
          type: object
      type: object
    OperationV2:
      additionalProperties: false
      properties:
        accountAlias:
          examples:
            - "@person1"
          maxLength: 256
          type: string
        accountId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        amount:
          $ref: "#/components/schemas/OperationAmount"
        assetCode:
          examples:
            - BRL
          maxLength: 10
          minLength: 2
          type: string
        balance:
          $ref: "#/components/schemas/OperationBalance"
        balanceAffected:
          examples:
            - true
          format: boolean
          type: boolean
        balanceAfter:
          $ref: "#/components/schemas/OperationBalance"
        balanceId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        balanceKey:
          examples:
            - asset-freeze
          maxLength: 100
          type: string
        createdAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
        deletedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type:
            - string
            - "null"
        description:
          examples:
            - Credit card operation
          maxLength: 256
          type: string
        direction:
          examples:
            - debit
          maxLength: 50
          type: string
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        metadata:
          additionalProperties: {}
          description: "Additional custom attributes. The ledger reserves the feeLeg and feeDeferPair keys on this field and writes them itself: feeLeg is the string true on every operation the fee engine created, and never appears on an operation the caller authored, because a request body that carries either key is refused rather than silently stripped; feeDeferPair carries the same token on the payer and fee operations of one deferrable fee. So a client names a fee movement from the ledger mark instead of inferring one from account names or from the caller metadata. Caller-supplied keys on an operation are returned as sent on a transaction no fee package was applied to; once a package is applied the engine rebuilds every movement of both sides, including when it prices the transaction at zero because every account is exempt, and the rebuilt movements carry only the ledger keys, so do not rely on a per-movement caller reference surviving a payment a fee package was applied to."
          type: object
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        routeCode:
          examples:
            - ROUTE-001
          maxLength: 100
          type: string
        routeDescription:
          examples:
            - Settlement route for service charges
          maxLength: 250
          type: string
        routeId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        status:
          $ref: "#/components/schemas/OperationStatus"
        transactionId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        type:
          examples:
            - DEBIT
          maxLength: 50
          type: string
        updatedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - id
        - transactionId
        - description
        - type
        - assetCode
        - amount
        - balance
        - balanceAfter
        - status
        - accountId
        - accountAlias
        - balanceKey
        - balanceId
        - organizationId
        - ledgerId
        - balanceAffected
        - createdAt
        - updatedAt
        - deletedAt
        - metadata
      type: object
    Organization:
      additionalProperties: false
      properties:
        address:
          $ref: "#/components/schemas/Address"
        createdAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
        deletedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type:
            - string
            - "null"
        doingBusinessAs:
          examples:
            - Lerian FS
          maxLength: 256
          type:
            - string
            - "null"
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        legalDocument:
          examples:
            - "123456789012345"
          maxLength: 256
          type: string
        legalName:
          examples:
            - Lerian Financial Services Ltd.
          maxLength: 256
          type: string
        metadata:
          additionalProperties: {}
          type: object
        parentOrganizationId:
          format: uuid
          type:
            - string
            - "null"
        status:
          $ref: "#/components/schemas/Status"
        updatedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - id
        - parentOrganizationId
        - legalName
        - doingBusinessAs
        - legalDocument
        - address
        - status
        - createdAt
        - updatedAt
        - deletedAt
      type: object
    OverridePolicy:
      additionalProperties: false
      properties:
        allowFeeSkip:
          examples:
            - false
          type: boolean
        allowHolderSkip:
          examples:
            - false
          type: boolean
        allowTracerSkip:
          examples:
            - false
          type: boolean
      required:
        - allowFeeSkip
        - allowTracerSkip
        - allowHolderSkip
      type: object
    OverridePolicyInput:
      additionalProperties: false
      properties:
        allowFeeSkip:
          examples:
            - false
          type: boolean
        allowHolderSkip:
          examples:
            - false
          type: boolean
        allowTracerSkip:
          examples:
            - false
          type: boolean
      type: object
    Pagination:
      additionalProperties: false
      properties:
        items: {}
        limit:
          examples:
            - 10
          format: int64
          type: integer
        next_cursor:
          examples:
            - eyJpZCI6IjAxOTI...
          type: string
        page:
          examples:
            - 1
          format: int64
          type: integer
        prev_cursor:
          examples:
            - eyJpZCI6IjAxOTE...
          type: string
      required:
        - items
        - limit
      type: object
    Portfolio:
      additionalProperties: false
      properties:
        createdAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
        deletedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type:
            - string
            - "null"
        entityId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          maxLength: 256
          type: string
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        metadata:
          additionalProperties: {}
          type: object
        name:
          examples:
            - My Portfolio
          maxLength: 256
          type: string
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        status:
          $ref: "#/components/schemas/Status"
        updatedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - id
        - name
        - ledgerId
        - organizationId
        - status
        - createdAt
        - updatedAt
        - deletedAt
      type: object
    ProvisionEncryptionInput:
      additionalProperties: false
      properties:
        actor:
          examples:
            - admin@example.com
          type: string
        reason:
          examples:
            - Initial encryption setup
          type: string
      required:
        - actor
        - reason
      type: object
    ProvisionEncryptionResponse:
      additionalProperties: false
      properties:
        aead_primary_key_id:
          examples:
            - 1
          format: int32
          minimum: 0
          type: integer
        kek_path:
          examples:
            - org-00000000-0000-0000-0000-000000000000
          type: string
        organization_id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        prf_primary_key_id:
          examples:
            - 1
          format: int32
          minimum: 0
          type: integer
        status:
          examples:
            - active
          type: string
      required:
        - organization_id
        - kek_path
        - aead_primary_key_id
        - prf_primary_key_id
        - status
      type: object
    ProvisioningStatusResponse:
      additionalProperties: false
      properties:
        organization_id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        provisioned:
          examples:
            - true
          type: boolean
        status:
          examples:
            - active
          type: string
      required:
        - organization_id
        - provisioned
      type: object
    Rate:
      additionalProperties: false
      properties:
        externalId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        from:
          examples:
            - BRL
          type: string
        to:
          examples:
            - USDe
          type: string
        value:
          examples:
            - "1000"
          type: string
      required:
        - from
        - to
        - value
        - externalId
      type: object
    RegulatoryFields:
      additionalProperties: false
      properties:
        accountType:
          description: "Bacen account type classification. Codes: 1 DEPOSIT, 2 SAVINGS, 3 INVESTMENT, 4 OTHER_FINANCIAL_INVESTMENTS, 5 NON_RESIDENT, 6 PAYMENT. Input is trimmed and case-insensitive; blank input is treated as absent."
          enum:
            - DEPOSIT
            - SAVINGS
            - INVESTMENT
            - OTHER_FINANCIAL_INVESTMENTS
            - NON_RESIDENT
            - PAYMENT
          examples:
            - DEPOSIT
          maxLength: 50
          type: string
        participantDocument:
          examples:
            - "12345678912345"
          maxLength: 100
          type: string
      type: object
    RelatedParty:
      additionalProperties: false
      properties:
        document:
          examples:
            - "12345678900"
          maxLength: 100
          type: string
        endDate:
          examples:
            - "2026-01-01"
          format: date
          type: string
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        name:
          examples:
            - John Smith
          maxLength: 256
          type: string
        role:
          examples:
            - PRIMARY_HOLDER
          maxLength: 100
          type: string
        startDate:
          examples:
            - "2025-01-01"
          format: date
          type: string
      required:
        - document
        - name
        - role
        - startDate
      type: object
    Representative:
      additionalProperties: false
      properties:
        document:
          examples:
            - "12345678900"
          maxLength: 100
          type: string
        email:
          examples:
            - john.doe@example.com
          maxLength: 256
          type: string
        name:
          examples:
            - John Doe
          maxLength: 256
          type: string
        role:
          examples:
            - CFO
          maxLength: 100
          type: string
      type: object
    Segment:
      additionalProperties: false
      properties:
        createdAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
        deletedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type:
            - string
            - "null"
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        metadata:
          additionalProperties: {}
          type: object
        name:
          examples:
            - My Segment
          maxLength: 256
          type: string
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        status:
          $ref: "#/components/schemas/Status"
        updatedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - id
        - name
        - ledgerId
        - organizationId
        - status
        - createdAt
        - updatedAt
        - deletedAt
      type: object
    Send:
      additionalProperties: false
      properties:
        asset:
          examples:
            - BRL
          type: string
        distribute:
          $ref: "#/components/schemas/Distribute"
        source:
          $ref: "#/components/schemas/Source"
        value:
          examples:
            - "1000"
          type: string
      type: object
    SendInflow:
      additionalProperties: false
      properties:
        asset:
          examples:
            - BRL
          type: string
        distribute:
          $ref: "#/components/schemas/Distribute"
        value:
          examples:
            - "1000"
          type: string
      type: object
    SendOutflow:
      additionalProperties: false
      properties:
        asset:
          examples:
            - BRL
          type: string
        source:
          $ref: "#/components/schemas/Source"
        value:
          examples:
            - "1000"
          type: string
      type: object
    Share:
      additionalProperties: false
      properties:
        percentage:
          format: int64
          type: integer
        percentageOfPercentage:
          format: int64
          type: integer
      type: object
    Source:
      additionalProperties: false
      properties:
        from:
          items:
            $ref: "#/components/schemas/FromTo"
          type:
            - array
            - "null"
        remaining:
          examples:
            - remaining
          type: string
      type: object
    Status:
      additionalProperties: false
      properties:
        code:
          enum:
            - ACTIVE
            - INACTIVE
            - PENDING
            - SUSPENDED
            - DELETED
          examples:
            - ACTIVE
          maxLength: 100
          type: string
        description:
          examples:
            - Active status
          maxLength: 256
          type:
            - string
            - "null"
      required:
        - code
        - description
      type: object
    TracerSettings:
      additionalProperties: false
      properties:
        failPosture:
          examples:
            - open
          type: string
        mode:
          examples:
            - "off"
          type: string
        timeoutMs:
          examples:
            - 250
          format: int64
          type: integer
      required:
        - mode
        - failPosture
        - timeoutMs
      type: object
    TracerSettingsInput:
      additionalProperties: false
      properties:
        failPosture:
          examples:
            - open
          type: string
        mode:
          examples:
            - "off"
          type: string
        timeoutMs:
          examples:
            - 250
          format: int64
          type: integer
      type: object
    Transaction:
      additionalProperties: false
      properties:
        amount:
          examples:
            - "1500"
          minimum: 0
          type:
            - string
            - "null"
        assetCode:
          examples:
            - BRL
          maxLength: 10
          minLength: 2
          type: string
        chartOfAccountsGroupName:
          examples:
            - Chart of accounts group name
          maxLength: 256
          type: string
        createdAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
        deletedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type:
            - string
            - "null"
        description:
          examples:
            - Transaction description
          maxLength: 256
          type: string
        destination:
          examples:
            -   - "@person2"
          items:
            type: string
          type:
            - array
            - "null"
        groupId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        metadata:
          additionalProperties: {}
          type: object
        operations:
          items:
            $ref: "#/components/schemas/Operation"
          type:
            - array
            - "null"
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        parentTransactionId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        route:
          examples:
            - 00000000-0000-0000-0000-000000000000
          maxLength: 250
          type: string
        routeId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        source:
          examples:
            -   - "@person1"
          items:
            type: string
          type:
            - array
            - "null"
        status:
          $ref: "#/components/schemas/TransactionStatus"
        updatedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - id
        - description
        - status
        - amount
        - assetCode
        - chartOfAccountsGroupName
        - source
        - destination
        - ledgerId
        - organizationId
        - route
        - createdAt
        - updatedAt
        - deletedAt
        - operations
      type: object
    TransactionInput:
      additionalProperties: false
      properties:
        chartOfAccountsGroupName:
          examples:
            - FUNDING
          type: string
        code:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        description:
          examples:
            - Description
          type: string
        metadata:
          additionalProperties: {}
          type: object
        pending:
          examples:
            - false
          type: boolean
        route:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        routeId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        send:
          $ref: "#/components/schemas/Send"
        transactionDate:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - send
      type: object
    TransactionRoute:
      additionalProperties: false
      properties:
        createdAt:
          examples:
            - "2025-01-01T00:00:00Z"
          format: date-time
          type: string
        deletedAt:
          examples:
            - "2025-01-01T00:00:00Z"
          format: date-time
          type:
            - string
            - "null"
        description:
          examples:
            - Settlement route for service charges
          type: string
        id:
          examples:
            - 01965ed9-7fa4-75b2-8872-fc9e8509ab0a
          type: string
        ledgerId:
          examples:
            - 01965ed9-7fa4-75b2-8872-fc9e8509ab0a
          type: string
        metadata:
          additionalProperties: {}
          type: object
        operationRoutes:
          items:
            $ref: "#/components/schemas/OperationRoute"
          type:
            - array
            - "null"
        organizationId:
          examples:
            - 01965ed9-7fa4-75b2-8872-fc9e8509ab0a
          type: string
        title:
          examples:
            - Charge Settlement
          type: string
        updatedAt:
          examples:
            - "2025-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - createdAt
        - updatedAt
        - deletedAt
      type: object
    TransactionRouteV2:
      additionalProperties: false
      properties:
        createdAt:
          examples:
            - "2025-01-01T00:00:00Z"
          format: date-time
          type: string
        deletedAt:
          examples:
            - "2025-01-01T00:00:00Z"
          format: date-time
          type:
            - string
            - "null"
        description:
          examples:
            - Settlement route for service charges
          type: string
        id:
          examples:
            - 01965ed9-7fa4-75b2-8872-fc9e8509ab0a
          type: string
        ledgerId:
          examples:
            - 01965ed9-7fa4-75b2-8872-fc9e8509ab0a
          type: string
        metadata:
          additionalProperties: {}
          type: object
        operationRoutes:
          items:
            $ref: "#/components/schemas/OperationRoute"
          type:
            - array
            - "null"
        optionalOperationRoutes:
          items:
            $ref: "#/components/schemas/OperationRoute"
          type:
            - array
            - "null"
        organizationId:
          examples:
            - 01965ed9-7fa4-75b2-8872-fc9e8509ab0a
          type: string
        title:
          examples:
            - Charge Settlement
          type: string
        updatedAt:
          examples:
            - "2025-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - optionalOperationRoutes
        - createdAt
        - updatedAt
        - deletedAt
      type: object
    TransactionSkip:
      additionalProperties: false
      properties:
        fees:
          examples:
            - false
          type: boolean
        tracer:
          examples:
            - false
          type: boolean
      type: object
    TransactionStatus:
      additionalProperties: false
      properties:
        code:
          examples:
            - ACTIVE
          maxLength: 100
          type: string
        description:
          examples:
            - Active status
          maxLength: 256
          type:
            - string
            - "null"
      required:
        - code
        - description
      type: object
    TransactionUpdateTransactionInput:
      additionalProperties: false
      properties:
        description:
          examples:
            - Transaction description
          maxLength: 256
          type: string
        metadata:
          additionalProperties: {}
          type: object
      type: object
    TransactionV2:
      additionalProperties: false
      properties:
        amount:
          examples:
            - "1500"
          minimum: 0
          type:
            - string
            - "null"
        assetCode:
          examples:
            - BRL
          maxLength: 10
          minLength: 2
          type: string
        createdAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
        credit:
          examples:
            -   - "@person2"
          items:
            type: string
          type:
            - array
            - "null"
        debit:
          examples:
            -   - "@person1"
          items:
            type: string
          type:
            - array
            - "null"
        deletedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type:
            - string
            - "null"
        description:
          examples:
            - Transaction description
          maxLength: 256
          type: string
        feesSkipped:
          examples:
            - false
          type: boolean
        groupId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        id:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        metadata:
          additionalProperties: {}
          description: "Additional custom attributes. The ledger writes six fee keys on this field itself and reserves them: feeApplied is the string true when the fee engine actually charged this transaction; packageAppliedID is the identifier of the fee package the engine applied, written when that package charged a fee or recorded an exemption (including a package that priced the transaction at zero), and absent when no package applied, which includes a route whose packages all exclude the amount by their bounds, or when the applied package's fees only rounded down to zero; feeExemption is a string holding a JSON object with exempt, reason and message, present when every account on one side of the transaction is exempt from fees, which is how a caller tells an exemption apart from no package having matched; feeExemption is also present, with reason cross_ledger_bridge, when the only account on one side that would have paid a fee is the @external/<asset> bridge closing a part of a cross-ledger group, because that bridge never pays a fee; feeExemption is also present, with reason zero_fee_amount, when the package priced the transaction at zero, for instance a band configured with no fee, so no fee leg was posted and feeApplied is absent; a transaction recorded before v4.1.1 stored feeExemption as that object itself, and a read returns it as the string too; feeDebtOpenings and feeDebtSettlements are strings holding a JSON array, in the order the ledger applied them, of the fee debts this transaction opened because its payer could not fund a deferrable fee (debtId, debtorRef, creditRef, opened, seq) and of the fee debts it settled (debtId, debtorRef, creditRef, amount, opened, seq), each absent when there is none; feeDebtCollection is the string true on a standalone fee-debt collection, whose amount is what it settled and which cannot be reverted. A request body carrying feeApplied, packageAppliedID, feeExemption, feeDebtOpenings, feeDebtSettlements, feeDebtCollection or feeDeferPair is refused with 400 naming the offending key, on every body that carries transaction metadata: a create, a metadata update and a fee estimate. A metadata update, including one that clears the metadata, never changes them. So a value present here is always the ledger's own word about the charge and never one a caller supplied. feeLeg and feeDeferPair, on operation metadata, are reserved the same way. Transaction-level metadata is additive, so caller-supplied keys on this field are preserved alongside the ledger keys."
          type: object
        operations:
          items:
            $ref: "#/components/schemas/OperationV2"
          type:
            - array
            - "null"
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        parentTransactionId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        routeId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        scheme:
          description: Payment scheme the transaction declared, normalized to upper case; absent when none.
          examples:
            - PIX
          maxLength: 50
          type: string
        status:
          $ref: "#/components/schemas/TransactionStatus"
        tracerSkipped:
          examples:
            - false
          type: boolean
        updatedAt:
          examples:
            - "2021-01-01T00:00:00Z"
          format: date-time
          type: string
      required:
        - id
        - description
        - status
        - amount
        - assetCode
        - debit
        - credit
        - ledgerId
        - organizationId
        - feesSkipped
        - tracerSkipped
        - createdAt
        - updatedAt
        - deletedAt
        - operations
      type: object
    TransactionV2ListBody:
      additionalProperties: false
      properties:
        items:
          items:
            $ref: "#/components/schemas/TransactionV2"
          type:
            - array
            - "null"
        limit:
          examples:
            - 10
          format: int64
          type: integer
        next_cursor:
          examples:
            - eyJpZCI6IjAxOTI...
          type: string
        page:
          examples:
            - 1
          format: int64
          type: integer
        prev_cursor:
          examples:
            - eyJpZCI6IjAxOTE...
          type: string
      required:
        - items
        - limit
      type: object
    UpdateAccountInput:
      additionalProperties: false
      properties:
        blocked:
          type:
            - boolean
            - "null"
        entityId:
          examples:
            - EXT-ACC-12345
          maxLength: 256
          type:
            - string
            - "null"
        metadata:
          additionalProperties: {}
          type: object
        name:
          examples:
            - Primary Corporate Checking Account
          maxLength: 256
          type: string
        portfolioId:
          format: uuid
          type:
            - string
            - "null"
        segmentId:
          format: uuid
          type:
            - string
            - "null"
        status:
          $ref: "#/components/schemas/Status"
      type: object
    UpdateAccountTypeInput:
      additionalProperties: false
      properties:
        defaultDirection:
          examples:
            - credit
          type: string
        description:
          examples:
            - Assets that are expected to be converted to cash within one year
          type: string
        metadata:
          additionalProperties: {}
          type: object
        name:
          examples:
            - Current Assets
          type: string
      type: object
    UpdateAssetInput:
      additionalProperties: false
      properties:
        metadata:
          additionalProperties: {}
          type: object
        name:
          examples:
            - Bitcoin
          type: string
        status:
          $ref: "#/components/schemas/Status"
      type: object
    UpdateBalance:
      additionalProperties: false
      properties:
        allowReceiving:
          examples:
            - true
          type:
            - boolean
            - "null"
        allowSending:
          examples:
            - true
          type:
            - boolean
            - "null"
        settings:
          $ref: "#/components/schemas/BalanceSettings"
      type: object
    UpdateHolderInput:
      additionalProperties: false
      properties:
        addresses:
          $ref: "#/components/schemas/Addresses"
        contact:
          $ref: "#/components/schemas/Contact"
        externalId:
          examples:
            - G4K7N8M
          maxLength: 256
          type:
            - string
            - "null"
        legalPerson:
          $ref: "#/components/schemas/LegalPerson"
        metadata:
          additionalProperties: {}
          type: object
        name:
          examples:
            - Jonathan Doe
          maxLength: 256
          type:
            - string
            - "null"
        naturalPerson:
          $ref: "#/components/schemas/NaturalPerson"
      type: object
    UpdateInstrumentInput:
      additionalProperties: false
      properties:
        bankingDetails:
          $ref: "#/components/schemas/BankingDetails"
        metadata:
          additionalProperties: {}
          type: object
        regulatoryFields:
          $ref: "#/components/schemas/RegulatoryFields"
        relatedParties:
          items:
            $ref: "#/components/schemas/RelatedParty"
          type:
            - array
            - "null"
      type: object
    UpdateLedgerInput:
      additionalProperties: false
      properties:
        metadata:
          additionalProperties: {}
          type: object
        name:
          examples:
            - Treasury Operations Global
          maxLength: 256
          type: string
        status:
          $ref: "#/components/schemas/Status"
      type: object
    UpdateOperationRouteInput:
      additionalProperties: false
      properties:
        account:
          $ref: "#/components/schemas/AccountRule"
        accountingEntries:
          $ref: "#/components/schemas/AccountingEntries"
        code:
          examples:
            - EXT-001
          type: string
        description:
          examples:
            - This operation route handles cash-in transactions from service charge collections
          type: string
        metadata:
          additionalProperties: {}
          type: object
        title:
          examples:
            - Cashin from service charge
          type: string
      type: object
    UpdateOrganizationInput:
      additionalProperties: false
      properties:
        address:
          $ref: "#/components/schemas/Address"
        doingBusinessAs:
          examples:
            - Lerian Group
          maxLength: 256
          type:
            - string
            - "null"
        legalName:
          examples:
            - Lerian Financial Group Ltd.
          maxLength: 256
          type: string
        metadata:
          additionalProperties: {}
          type: object
        parentOrganizationId:
          format: uuid
          type:
            - string
            - "null"
        status:
          $ref: "#/components/schemas/Status"
      type: object
    UpdatePortfolioInput:
      additionalProperties: false
      properties:
        entityId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          type: string
        metadata:
          additionalProperties: {}
          type: object
        name:
          examples:
            - My Portfolio Updated
          type: string
        status:
          $ref: "#/components/schemas/Status"
      type: object
    UpdateSegmentInput:
      additionalProperties: false
      properties:
        metadata:
          additionalProperties: {}
          type: object
        name:
          examples:
            - My Segment Updated
          type: string
        status:
          $ref: "#/components/schemas/Status"
      type: object
    UpdateTransactionRouteInput:
      additionalProperties: false
      properties:
        description:
          examples:
            - Settlement route for service charges
          type: string
        metadata:
          additionalProperties: {}
          type: object
        operationRoutes:
          items:
            format: uuid
            type: string
          type: array
        title:
          examples:
            - Charge Settlement
          type: string
      type: object
    UpdateTransactionRouteInputV2:
      additionalProperties: false
      properties:
        description:
          examples:
            - Settlement route for service charges
          type: string
        metadata:
          additionalProperties: {}
          type: object
        operationRoutes:
          items:
            format: uuid
            type: string
          type:
            - array
            - "null"
        optionalOperationRoutes:
          items:
            format: uuid
            type: string
          type:
            - array
            - "null"
        title:
          examples:
            - Charge Settlement
          type: string
      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
    V2LegInput:
      additionalProperties: false
      description: "One leg of a transaction side. Fill EXACTLY ONE value expression per leg: `amount` for an explicit value, or `share` for a percentage of the transaction total. A leg carrying both, or neither, is rejected. `balanceKey` optionally selects one of the account's balances; when omitted, the `default` balance is used."
      properties:
        alias:
          description: "The leg's account alias. Accepts letters, digits and the characters @ : _ and -, or an external account alias spelled @external/ followed by the uppercase asset code. Any other spelling is refused with 400 before the transaction is calculated."
          examples:
            - "@person1"
          type: string
        amount:
          type: string
        balanceKey:
          description: Optional balance key for this leg. When omitted, the transaction uses the account's default balance.
          examples:
            - food
          maxLength: 100
          type: string
        description:
          maxLength: 256
          type: string
        ledgerId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        operationRouteId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        organizationId:
          examples:
            - 00000000-0000-0000-0000-000000000000
          format: uuid
          type: string
        share:
          $ref: "#/components/schemas/V2ShareInput"
      required:
        - alias
        - organizationId
        - ledgerId
      type: object
    V2ShareInput:
      additionalProperties: false
      properties:
        percentage:
          examples:
            - 60
          format: int64
          maximum: 100
          minimum: 1
          type: integer
        percentageOfPercentage:
          examples:
            - 50
          format: int64
          maximum: 100
          minimum: 0
          type: integer
      required:
        - percentage
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      description: JWT bearer token issued by the identity provider.
      scheme: bearer
      type: http
info:
  title: Midaz Ledger API
  version: 4.0.0
openapi: 3.1.0
paths:
  /v1/organizations:
    get:
      deprecated: true
      operationId: listOrganizations
      parameters:
        - description: JSON string to filter organizations by metadata fields
          explode: false
          in: query
          name: metadata
          schema:
            description: JSON string to filter organizations by metadata fields
            type: string
        - description: Max items per page (1-100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (1-100, default 10)
            type: string
        - description: Page number (default 1)
          explode: false
          in: query
          name: page
          schema:
            description: Page number (default 1)
            type: string
        - description: Filter organizations created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter organizations created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter organizations created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter organizations created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
        - description: Filter by legal name (case-insensitive, prefix match)
          explode: false
          in: query
          name: legal_name
          schema:
            description: Filter by legal name (case-insensitive, prefix match)
            type: string
        - description: Filter by doing business as name (case-insensitive, prefix match)
          explode: false
          in: query
          name: doing_business_as
          schema:
            description: Filter by doing business as name (case-insensitive, prefix match)
            type: string
        - description: Filter by status
          explode: false
          in: query
          name: status
          schema:
            description: Filter by status
            type: string
        - description: Filter by legal document (exact match)
          explode: false
          in: query
          name: legal_document
          schema:
            description: Filter by legal document (exact match)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: List all organizations
      tags:
        - Organizations (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/list-organizations
    post:
      deprecated: true
      operationId: createOrganization
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateOrganizationInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Organization"
          description: Created
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a new organization
      tags:
        - Organizations (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/create-organization
  /v1/organizations/{organization_id}:
    delete:
      deprecated: true
      operationId: deleteOrganization
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete an organization
      tags:
        - Organizations (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/delete-organization
    get:
      deprecated: true
      operationId: getOrganizationByID
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Organization"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Retrieve a specific organization
      tags:
        - Organizations (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-organization-by-id
    patch:
      deprecated: true
      description: "Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null deletes every key the client wrote."
      operationId: updateOrganization
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateOrganizationInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Organization"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Update an existing organization
      tags:
        - Organizations (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/update-organization
  /v1/organizations/{organization_id}/ledgers:
    get:
      deprecated: true
      operationId: listLedgers
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: JSON string to filter ledgers by metadata fields
          explode: false
          in: query
          name: metadata
          schema:
            description: JSON string to filter ledgers by metadata fields
            type: string
        - description: Max items per page (1-100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (1-100, default 10)
            type: string
        - description: Page number (default 1)
          explode: false
          in: query
          name: page
          schema:
            description: Page number (default 1)
            type: string
        - description: Filter ledgers created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter ledgers created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter ledgers created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter ledgers created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
        - description: Filter ledgers by name (case-insensitive, prefix match)
          explode: false
          in: query
          name: name
          schema:
            description: Filter ledgers by name (case-insensitive, prefix match)
            type: string
        - description: Filter ledgers by status (ACTIVE, INACTIVE)
          explode: false
          in: query
          name: status
          schema:
            description: Filter ledgers by status (ACTIVE, INACTIVE)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: List all ledgers
      tags:
        - Ledgers (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/list-ledgers
    post:
      deprecated: true
      operationId: createLedger
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateLedgerInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Ledger"
          description: Created
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a new ledger
      tags:
        - Ledgers (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/create-ledger
  /v1/organizations/{organization_id}/ledgers/{ledger_id}:
    delete:
      deprecated: true
      operationId: deleteLedger
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete a ledger
      tags:
        - Ledgers (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/delete-ledger
    get:
      deprecated: true
      operationId: getLedgerByID
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Ledger"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Retrieve a specific ledger
      tags:
        - Ledgers (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-ledger-by-id
    patch:
      deprecated: true
      description: "Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null deletes every key the client wrote."
      operationId: updateLedger
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateLedgerInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Ledger"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Update an existing ledger
      tags:
        - Ledgers (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/update-ledger
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/account-types:
    get:
      deprecated: true
      operationId: listAccountTypes
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: JSON string to filter account types by metadata fields
          explode: false
          in: query
          name: metadata
          schema:
            description: JSON string to filter account types by metadata fields
            type: string
        - description: Filter account types by key value
          explode: false
          in: query
          name: key_value
          schema:
            description: Filter account types by key value
            type: string
        - description: Max items per page (1-100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (1-100, default 10)
            type: string
        - description: Page number (default 1)
          explode: false
          in: query
          name: page
          schema:
            description: Page number (default 1)
            type: string
        - description: Cursor for cursor-based pagination
          explode: false
          in: query
          name: cursor
          schema:
            description: Cursor for cursor-based pagination
            type: string
        - description: Filter account types created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter account types created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter account types created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter account types created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: List all account types
      tags:
        - Account Types (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/list-account-types
    post:
      deprecated: true
      operationId: createAccountType
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateAccountTypeInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AccountType"
          description: Created
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a new account type
      tags:
        - Account Types (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/create-account-type
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/account-types/{account_type_id}:
    delete:
      deprecated: true
      operationId: deleteAccountType
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account Type ID (UUID)
          in: path
          name: account_type_id
          required: true
          schema:
            description: Account Type ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete an account type
      tags:
        - Account Types (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/delete-account-type
    get:
      deprecated: true
      operationId: getAccountTypeByID
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account Type ID (UUID)
          in: path
          name: account_type_id
          required: true
          schema:
            description: Account Type ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AccountType"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Retrieve a specific account type
      tags:
        - Account Types (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-account-type-by-id
    patch:
      deprecated: true
      description: "Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null deletes every key the client wrote."
      operationId: updateAccountType
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account Type ID (UUID)
          in: path
          name: account_type_id
          required: true
          schema:
            description: Account Type ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateAccountTypeInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AccountType"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Update an account type
      tags:
        - Account Types (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/update-account-type
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/accounts:
    get:
      deprecated: true
      operationId: listAccounts
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: JSON string to filter accounts by metadata fields
          explode: false
          in: query
          name: metadata
          schema:
            description: JSON string to filter accounts by metadata fields
            type: string
        - description: Max items per page (1-100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (1-100, default 10)
            type: string
        - description: Page number (default 1)
          explode: false
          in: query
          name: page
          schema:
            description: Page number (default 1)
            type: string
        - description: Filter accounts created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter accounts created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter accounts created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter accounts created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
        - description: Filter accounts by portfolio ID (UUID)
          explode: false
          in: query
          name: portfolio_id
          schema:
            description: Filter accounts by portfolio ID (UUID)
            type: string
        - description: Filter accounts by segment ID (UUID)
          explode: false
          in: query
          name: segment_id
          schema:
            description: Filter accounts by segment ID (UUID)
            type: string
        - description: Filter accounts by status (ACTIVE, INACTIVE, BLOCKED)
          explode: false
          in: query
          name: status
          schema:
            description: Filter accounts by status (ACTIVE, INACTIVE, BLOCKED)
            type: string
        - description: Filter accounts by type (e.g., deposit, savings, external)
          explode: false
          in: query
          name: type
          schema:
            description: Filter accounts by type (e.g., deposit, savings, external)
            type: string
        - description: Filter accounts by asset code (e.g., USD, BRL, EUR)
          explode: false
          in: query
          name: asset_code
          schema:
            description: Filter accounts by asset code (e.g., USD, BRL, EUR)
            type: string
        - description: Filter accounts by entity ID
          explode: false
          in: query
          name: entity_id
          schema:
            description: Filter accounts by entity ID
            type: string
        - description: Filter accounts by blocked status (true, false)
          explode: false
          in: query
          name: blocked
          schema:
            description: Filter accounts by blocked status (true, false)
            type: string
        - description: Filter accounts by parent account ID (UUID)
          explode: false
          in: query
          name: parent_account_id
          schema:
            description: Filter accounts by parent account ID (UUID)
            type: string
        - description: Filter accounts by name (case-insensitive, prefix match)
          explode: false
          in: query
          name: name
          schema:
            description: Filter accounts by name (case-insensitive, prefix match)
            type: string
        - description: Filter accounts by alias (case-insensitive, prefix match)
          explode: false
          in: query
          name: alias
          schema:
            description: Filter accounts by alias (case-insensitive, prefix match)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: List all accounts
      tags:
        - Accounts (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/list-accounts
    post:
      deprecated: true
      description: "The closing instant is output only: a body naming closedAt or closed_at at its root is refused with 400 whatever the value it carries, and the stored instant is only ever written by the close command."
      operationId: createAccount
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Bearer token (forwarded to the service)
          in: header
          name: Authorization
          schema:
            description: Bearer token (forwarded to the service)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateAccountInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Account"
          description: Created
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a new account
      tags:
        - Accounts (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/create-account
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/accounts/alias/{alias}:
    get:
      deprecated: true
      operationId: getAccountByAlias
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account alias (e.g. @person1)
          in: path
          name: alias
          required: true
          schema:
            description: Account alias (e.g. @person1)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Account"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Retrieve an account by alias
      tags:
        - Accounts (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-account-by-alias
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/accounts/alias/{alias}/balances:
    get:
      deprecated: true
      description: Returns the current balance state. When that state cannot be read, the request answers 503 (0542) and may be retried.
      operationId: getBalancesByAlias
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Alias (e.g. @person1)
          in: path
          name: alias
          required: true
          schema:
            description: Alias (e.g. @person1)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Get Balances using Alias
      tags:
        - Balances (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-balances-by-alias
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/accounts/external/{code}:
    get:
      deprecated: true
      operationId: getAccountExternalByCode
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account external code (e.g. BRL)
          in: path
          name: code
          required: true
          schema:
            description: Account external code (e.g. BRL)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Account"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Retrieve an account by external code
      tags:
        - Accounts (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-account-external-by-code
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/accounts/external/{code}/balances:
    get:
      deprecated: true
      description: Returns the current balance state. When that state cannot be read, the request answers 503 (0542) and may be retried.
      operationId: getBalancesExternalByCode
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Code (e.g. BRL)
          in: path
          name: code
          required: true
          schema:
            description: Code (e.g. BRL)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Get External balances using code
      tags:
        - Balances (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-balances-external-by-code
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/accounts/{account_id}:
    delete:
      deprecated: true
      description: Deletes an account together with its balances. A balance that still owes pending fees (0527) or that other balances still owe pending fees to (0528) is refused with 422. A state that cannot be established answers 503 (0520) and may be retried. The CRM instrument linked to the account is soft-deleted. The active account plan assignment of the account ends; its history stays readable. In every fee package of the ledger, a fee whose creditAccount is the account's alias is removed and the alias leaves waivedAccounts; a package left without fees is disabled. In billing packages, a debitAccountAlias, creditAccountAlias or maintenanceCreditAccount equal to the alias is cleared and the package is disabled; the alias leaves accountTarget.aliases, and the package is disabled only when that list empties. These effects happen before the account is deleted. If one of them fails, the account stays in place and the request may be retried.
      operationId: deleteAccount
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account ID (UUID)
          in: path
          name: account_id
          required: true
          schema:
            description: Account ID (UUID)
            type: string
        - description: Bearer token (forwarded to the service)
          in: header
          name: Authorization
          schema:
            description: Bearer token (forwarded to the service)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete an account
      tags:
        - Accounts (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/delete-account
    get:
      deprecated: true
      operationId: getAccountByID
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account ID (UUID)
          in: path
          name: account_id
          required: true
          schema:
            description: Account ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Account"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Retrieve a specific account
      tags:
        - Accounts (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-account-by-id
    patch:
      deprecated: true
      description: "The closing instant is output only: a body naming closedAt or closed_at at its root is refused with 400 whatever the value it carries, and the stored instant is only ever written by the close command. Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null deletes every key the client wrote."
      operationId: updateAccount
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account ID (UUID)
          in: path
          name: account_id
          required: true
          schema:
            description: Account ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateAccountInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Account"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Update an account
      tags:
        - Accounts (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/update-account
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/accounts/{account_id}/balances:
    get:
      deprecated: true
      description: Returns the current balance state. When that state cannot be read, the request answers 503 (0542) and may be retried.
      operationId: getAllBalancesByAccountID
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account ID (UUID)
          in: path
          name: account_id
          required: true
          schema:
            description: Account ID (UUID)
            type: string
        - description: Max items per page (max 100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (max 100, default 10)
            type: string
        - description: Filter balances created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter balances created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter balances created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter balances created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
        - description: Opaque cursor token for pagination
          explode: false
          in: query
          name: cursor
          schema:
            description: Opaque cursor token for pagination
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Get all balances by account id
      tags:
        - Balances (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-all-balances-by-account-id
    post:
      deprecated: true
      operationId: createAdditionalBalance
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account ID (UUID)
          in: path
          name: account_id
          required: true
          schema:
            description: Account ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateAdditionalBalance"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Balance"
          description: Created
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Create Additional Balance
      tags:
        - Balances (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/create-additional-balance
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/accounts/{account_id}/balances/history:
    get:
      deprecated: true
      operationId: getAccountBalancesAtTimestamp
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account ID (UUID)
          in: path
          name: account_id
          required: true
          schema:
            description: Account ID (UUID)
            type: string
        - description: "Ledger-recorded state at this point in time (format: yyyy-mm-dd hh:mm:ss)"
          explode: false
          in: query
          name: date
          schema:
            description: "Ledger-recorded state at this point in time (format: yyyy-mm-dd hh:mm:ss)"
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  $ref: "#/components/schemas/BalanceHistory"
                type:
                  - array
                  - "null"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Get Account Balances history at date
      tags:
        - Balances (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-account-balances-at-timestamp
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/accounts/{account_id}/operations:
    get:
      deprecated: true
      operationId: getAllOperationsByAccount
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account ID (UUID)
          in: path
          name: account_id
          required: true
          schema:
            description: Account ID (UUID)
            type: string
        - description: JSON string to filter operations by metadata fields
          explode: false
          in: query
          name: metadata
          schema:
            description: JSON string to filter operations by metadata fields
            type: string
        - description: Max items per page (max 100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (max 100, default 10)
            type: string
        - description: Filter operations created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter operations created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter operations created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter operations created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc) for the chosen sort key
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc) for the chosen sort key
            type: string
        - description: Sort key (id, created_at). Default id. created_at orders by creation date, then id. A cursor is only valid with the sort key it was issued for
          explode: false
          in: query
          name: sort_by
          schema:
            description: Sort key (id, created_at). Default id. created_at orders by creation date, then id. A cursor is only valid with the sort key it was issued for
            type: string
        - description: Opaque cursor token for pagination
          explode: false
          in: query
          name: cursor
          schema:
            description: Opaque cursor token for pagination
            type: string
        - description: Filter by operation type (DEBIT, CREDIT)
          explode: false
          in: query
          name: type
          schema:
            description: Filter by operation type (DEBIT, CREDIT)
            type: string
        - description: Filter by direction (debit, credit)
          explode: false
          in: query
          name: direction
          schema:
            description: Filter by direction (debit, credit)
            type: string
        - description: Filter by operation route ID (UUID)
          explode: false
          in: query
          name: route_id
          schema:
            description: Filter by operation route ID (UUID)
            type: string
        - description: Filter by operation route code
          explode: false
          in: query
          name: route_code
          schema:
            description: Filter by operation route code
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Get all Operations by account
      tags:
        - Operations (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-all-operations-by-account
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/accounts/{account_id}/operations/{operation_id}:
    get:
      deprecated: true
      operationId: getOperationByAccount
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account ID (UUID)
          in: path
          name: account_id
          required: true
          schema:
            description: Account ID (UUID)
            type: string
        - description: Operation ID (UUID)
          in: path
          name: operation_id
          required: true
          schema:
            description: Operation ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Operation"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Get Operation
      tags:
        - Operations (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-operation-by-account
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/asset-rates:
    put:
      deprecated: true
      operationId: createOrUpdateAssetRate
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateAssetRateInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AssetRate"
          description: Created
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Create or Update an AssetRate
      tags:
        - Asset Rates (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/create-or-update-asset-rate
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/asset-rates/from/{asset_code}:
    get:
      deprecated: true
      operationId: getAllAssetRatesByAssetCode
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Source asset code
          in: path
          name: asset_code
          required: true
          schema:
            description: Source asset code
            type: string
        - description: Filter by destination asset codes as one comma-separated list (e.g. USD,EUR) — the published serialization is explode=false. Repeated to keys are also accepted at runtime.
          explode: false
          in: query
          name: to
          schema:
            description: Filter by destination asset codes as one comma-separated list (e.g. USD,EUR) — the published serialization is explode=false. Repeated to keys are also accepted at runtime.
            items:
              type: string
            type:
              - array
              - "null"
        - description: Max items per page (1-100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (1-100, default 10)
            type: string
        - description: Filter asset rates created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter asset rates created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter asset rates created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter asset rates created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
        - description: Opaque cursor token for pagination
          explode: false
          in: query
          name: cursor
          schema:
            description: Opaque cursor token for pagination
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Get an AssetRate by the Asset Code
      tags:
        - Asset Rates (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-all-asset-rates-by-asset-code
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/asset-rates/{external_id}:
    get:
      deprecated: true
      operationId: getAssetRateByExternalID
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: External ID (UUID)
          in: path
          name: external_id
          required: true
          schema:
            description: External ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AssetRate"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Get an AssetRate by External ID
      tags:
        - Asset Rates (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-asset-rate-by-external-id
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/assets:
    get:
      deprecated: true
      operationId: listAssets
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: JSON string to filter assets by metadata fields
          explode: false
          in: query
          name: metadata
          schema:
            description: JSON string to filter assets by metadata fields
            type: string
        - description: Max items per page (1-100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (1-100, default 10)
            type: string
        - description: Page number (default 1)
          explode: false
          in: query
          name: page
          schema:
            description: Page number (default 1)
            type: string
        - description: Filter assets created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter assets created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter assets created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter assets created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: List all assets
      tags:
        - Assets (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/list-assets
    post:
      deprecated: true
      operationId: createAsset
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Bearer token (forwarded to the service)
          in: header
          name: Authorization
          schema:
            description: Bearer token (forwarded to the service)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateAssetInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Asset"
          description: Created
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a new asset
      tags:
        - Assets (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/create-asset
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/assets/{asset_id}:
    delete:
      deprecated: true
      operationId: deleteAsset
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Asset ID (UUID)
          in: path
          name: asset_id
          required: true
          schema:
            description: Asset ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete an asset
      tags:
        - Assets (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/delete-asset
    get:
      deprecated: true
      operationId: getAssetByID
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Asset ID (UUID)
          in: path
          name: asset_id
          required: true
          schema:
            description: Asset ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Asset"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Retrieve a specific asset
      tags:
        - Assets (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-asset-by-id
    patch:
      deprecated: true
      description: "Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null deletes every key the client wrote."
      operationId: updateAsset
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Asset ID (UUID)
          in: path
          name: asset_id
          required: true
          schema:
            description: Asset ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateAssetInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Asset"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Update an asset
      tags:
        - Assets (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/update-asset
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/balances:
    get:
      deprecated: true
      description: Returns the current balance state. When that state cannot be read, the request answers 503 (0542) and may be retried.
      operationId: getAllBalances
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Max items per page (max 100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (max 100, default 10)
            type: string
        - description: Filter balances created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter balances created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter balances created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter balances created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
        - description: Opaque cursor token for pagination
          explode: false
          in: query
          name: cursor
          schema:
            description: Opaque cursor token for pagination
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Get all balances
      tags:
        - Balances (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-all-balances
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/balances/metrics/totals:
    get:
      deprecated: true
      description: "Returns the available and on-hold totals and the count of the ledger's non-external balances of one key and asset: the sum of each balance's current state, as the balance reads return it, read during the request; not an atomic snapshot across balances, so a posting concurrent with the request may or may not be counted. When that state cannot be read, the request answers 503 (0542) and may be retried."
      operationId: getBalanceTotals
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Required. Balance key to total, case-insensitive (no whitespace, max 100)
          explode: false
          in: query
          name: balance_key
          schema:
            description: Required. Balance key to total, case-insensitive (no whitespace, max 100)
            type: string
        - description: Required. Asset code to total, compared exactly (no whitespace, max 100)
          explode: false
          in: query
          name: asset_code
          schema:
            description: Required. Asset code to total, compared exactly (no whitespace, max 100)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BalanceTotals"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Get balance totals by key and asset
      tags:
        - Balances (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-balance-totals-by-key-and-asset
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/balances/{balance_id}:
    delete:
      deprecated: true
      description: Deletes a balance. A balance that still owes pending fees (0527) or that other balances still owe pending fees to (0528) is refused with 422. A state that cannot be established answers 503 (0520) and may be retried.
      operationId: deleteBalance
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Balance ID (UUID)
          in: path
          name: balance_id
          required: true
          schema:
            description: Balance ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete Balance by account
      tags:
        - Balances (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/delete-balance
    get:
      deprecated: true
      description: Returns the current balance state. When that state cannot be read, the request answers 503 (0542) and may be retried.
      operationId: getBalanceByID
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Balance ID (UUID)
          in: path
          name: balance_id
          required: true
          schema:
            description: Balance ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Balance"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Get Balance by id
      tags:
        - Balances (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-balance-by-id
    patch:
      deprecated: true
      operationId: updateBalance
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Balance ID (UUID)
          in: path
          name: balance_id
          required: true
          schema:
            description: Balance ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateBalance"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Balance"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Update Balance
      tags:
        - Balances (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/update-balance
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/balances/{balance_id}/history:
    get:
      deprecated: true
      operationId: getBalanceAtTimestamp
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Balance ID (UUID)
          in: path
          name: balance_id
          required: true
          schema:
            description: Balance ID (UUID)
            type: string
        - description: "Ledger-recorded state at this point in time (format: yyyy-mm-dd hh:mm:ss)"
          explode: false
          in: query
          name: date
          schema:
            description: "Ledger-recorded state at this point in time (format: yyyy-mm-dd hh:mm:ss)"
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BalanceHistory"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Get Balance history at date
      tags:
        - Balances (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-balance-at-timestamp
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/dashboard/assets:
    get:
      deprecated: true
      description: "Returns the ledger's CURRENT position in each asset — how many distinct accounts hold it, and the summed available and on-hold figures — read from the balance table. It takes NO window and ignores any window parameter a caller sends: a balance is a running total, not an aggregate over history. Amounts are exact decimal strings, per asset, never summed across assets."
      operationId: getLedgerDashboardAssets
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LedgerDashboardAssets"
          description: OK
          headers:
            Cache-Control:
              schema:
                type: string
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Get ledger current position per asset
      tags:
        - Dashboard (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-dashboard-assets
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/dashboard/metrics:
    get:
      deprecated: true
      description: "Returns, for the window, the total number of transactions, the count of each status the ledger knows, and the settled volume per asset. Volume sums transaction.amount over SETTLED transactions only — status APPROVED, the only status whose transactions moved money — and is reported PER ASSET with no cross-asset total, because adding two assets together does not produce money. Amounts are exact decimal strings whose scale is not normative; format them with the asset's own exponent and never parse them as a binary float. volumeByAsset is the GROSS settled amount: every settled leg inside the window, reversal legs included. reversalsByAsset is the part of it made of reversal legs, same window and same settled filter. A true net is NOT derivable from the two alone, because it depends on whether each reversed original also falls inside the window; a consumer that needs net reads the transactions."
      operationId: getLedgerDashboardMetrics
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: "Relative window: 7d, 30d or 90d (default: 30d). Mutually exclusive with start_date/end_date."
          explode: false
          in: query
          name: period
          schema:
            description: "Relative window: 7d, 30d or 90d (default: 30d). Mutually exclusive with start_date/end_date."
            type: string
        - description: Window start (RFC3339, inclusive). Requires end_date. Mutually exclusive with period.
          explode: false
          in: query
          name: start_date
          schema:
            description: Window start (RFC3339, inclusive). Requires end_date. Mutually exclusive with period.
            type: string
        - description: Window end (RFC3339, exclusive). Requires start_date. The window may not exceed 90 days.
          explode: false
          in: query
          name: end_date
          schema:
            description: Window end (RFC3339, exclusive). Requires start_date. The window may not exceed 90 days.
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LedgerDashboardMetrics"
          description: OK
          headers:
            Cache-Control:
              schema:
                type: string
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Get ledger dashboard metrics
      tags:
        - Dashboard (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-dashboard-metrics
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/dashboard/volume:
    get:
      deprecated: true
      description: Returns one point per UTC calendar day the window TOUCHES, including days with no transactions, which are present with transactions 0 and an empty byAsset. A window is half-open and snaps to the minute rather than to midnight, so a 7d window opened mid-afternoon returns EIGHT points. Each point's transactions counts every status; its byAsset applies the same settled rule as /metrics. Summing the points reproduces /metrics exactly, and is likewise GROSS of reversals.
      operationId: getLedgerDashboardVolume
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: "Relative window: 7d, 30d or 90d (default: 30d). Mutually exclusive with start_date/end_date."
          explode: false
          in: query
          name: period
          schema:
            description: "Relative window: 7d, 30d or 90d (default: 30d). Mutually exclusive with start_date/end_date."
            type: string
        - description: Window start (RFC3339, inclusive). Requires end_date. Mutually exclusive with period.
          explode: false
          in: query
          name: start_date
          schema:
            description: Window start (RFC3339, inclusive). Requires end_date. Mutually exclusive with period.
            type: string
        - description: Window end (RFC3339, exclusive). Requires start_date. The window may not exceed 90 days.
          explode: false
          in: query
          name: end_date
          schema:
            description: Window end (RFC3339, exclusive). Requires start_date. The window may not exceed 90 days.
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LedgerDashboardVolume"
          description: OK
          headers:
            Cache-Control:
              schema:
                type: string
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Get ledger dashboard volume series
      tags:
        - Dashboard (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-dashboard-volume
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/operation-routes:
    get:
      deprecated: true
      operationId: listOperationRoutes
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Max items per page (default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (default 10)
            type: string
        - description: Filter created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
        - description: Opaque cursor token for pagination
          explode: false
          in: query
          name: cursor
          schema:
            description: Opaque cursor token for pagination
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Retrieve all operation routes
      tags:
        - Operation Routes (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/list-operation-routes
    post:
      deprecated: true
      operationId: createOperationRoute
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateOperationRouteInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OperationRoute"
          description: Created
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Create Operation Route
      tags:
        - Operation Routes (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/create-operation-route
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/operation-routes/{operation_route_id}:
    delete:
      deprecated: true
      operationId: deleteOperationRoute
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Operation Route ID (UUID)
          in: path
          name: operation_route_id
          required: true
          schema:
            description: Operation Route ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete an operation route
      tags:
        - Operation Routes (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/delete-operation-route
    get:
      deprecated: true
      operationId: getOperationRouteByID
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Operation Route ID (UUID)
          in: path
          name: operation_route_id
          required: true
          schema:
            description: Operation Route ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OperationRoute"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Retrieve a specific operation route
      tags:
        - Operation Routes (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-operation-route-by-id
    patch:
      deprecated: true
      description: "Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null deletes every key the client wrote."
      operationId: updateOperationRoute
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Operation Route ID (UUID)
          in: path
          name: operation_route_id
          required: true
          schema:
            description: Operation Route ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateOperationRouteInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OperationRoute"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Update an operation route
      tags:
        - Operation Routes (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/update-operation-route
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/portfolios:
    get:
      deprecated: true
      operationId: listPortfolios
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: JSON string to filter portfolios by metadata fields
          explode: false
          in: query
          name: metadata
          schema:
            description: JSON string to filter portfolios by metadata fields
            type: string
        - description: Filter portfolios by entity ID
          explode: false
          in: query
          name: entity_id
          schema:
            description: Filter portfolios by entity ID
            type: string
        - description: Filter portfolios by status
          explode: false
          in: query
          name: status
          schema:
            description: Filter portfolios by status
            type: string
        - description: Max items per page (1-100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (1-100, default 10)
            type: string
        - description: Page number (default 1)
          explode: false
          in: query
          name: page
          schema:
            description: Page number (default 1)
            type: string
        - description: Filter portfolios created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter portfolios created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter portfolios created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter portfolios created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: List all portfolios
      tags:
        - Portfolios (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/list-portfolios
    post:
      deprecated: true
      operationId: createPortfolio
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreatePortfolioInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Portfolio"
          description: Created
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a new portfolio
      tags:
        - Portfolios (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/create-portfolio
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/portfolios/{portfolio_id}:
    delete:
      deprecated: true
      operationId: deletePortfolio
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Portfolio ID (UUID)
          in: path
          name: portfolio_id
          required: true
          schema:
            description: Portfolio ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete a portfolio
      tags:
        - Portfolios (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/delete-portfolio
    get:
      deprecated: true
      operationId: getPortfolioByID
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Portfolio ID (UUID)
          in: path
          name: portfolio_id
          required: true
          schema:
            description: Portfolio ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Portfolio"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Retrieve a specific portfolio
      tags:
        - Portfolios (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-portfolio-by-id
    patch:
      deprecated: true
      description: "Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null deletes every key the client wrote."
      operationId: updatePortfolio
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Portfolio ID (UUID)
          in: path
          name: portfolio_id
          required: true
          schema:
            description: Portfolio ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdatePortfolioInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Portfolio"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Update a portfolio
      tags:
        - Portfolios (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/update-portfolio
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/segments:
    get:
      deprecated: true
      operationId: listSegments
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: JSON string to filter segments by metadata fields
          explode: false
          in: query
          name: metadata
          schema:
            description: JSON string to filter segments by metadata fields
            type: string
        - description: Max items per page (1-100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (1-100, default 10)
            type: string
        - description: Page number (default 1)
          explode: false
          in: query
          name: page
          schema:
            description: Page number (default 1)
            type: string
        - description: Filter segments created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter segments created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter segments created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter segments created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: List all segments
      tags:
        - Segments (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/list-segments
    post:
      deprecated: true
      operationId: createSegment
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateSegmentInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Segment"
          description: Created
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a new segment
      tags:
        - Segments (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/create-segment
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/segments/{segment_id}:
    delete:
      deprecated: true
      operationId: deleteSegment
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Segment ID (UUID)
          in: path
          name: segment_id
          required: true
          schema:
            description: Segment ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete a segment
      tags:
        - Segments (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/delete-segment
    get:
      deprecated: true
      operationId: getSegmentByID
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Segment ID (UUID)
          in: path
          name: segment_id
          required: true
          schema:
            description: Segment ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Segment"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Retrieve a specific segment
      tags:
        - Segments (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-segment-by-id
    patch:
      deprecated: true
      description: "Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null deletes every key the client wrote."
      operationId: updateSegment
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Segment ID (UUID)
          in: path
          name: segment_id
          required: true
          schema:
            description: Segment ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateSegmentInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Segment"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Update a segment
      tags:
        - Segments (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/update-segment
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/settings:
    get:
      deprecated: true
      operationId: getLedgerSettings
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LedgerSettings"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Get ledger settings
      tags:
        - Ledgers (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-ledger-settings
    patch:
      deprecated: true
      operationId: updateLedgerSettings
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: {}
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LedgerSettings"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Update ledger settings
      tags:
        - Ledgers (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/update-ledger-settings
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/transaction-routes:
    get:
      deprecated: true
      operationId: listTransactionRoutes
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Max items per page (default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (default 10)
            type: string
        - description: Filter created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
        - description: Opaque cursor token for pagination
          explode: false
          in: query
          name: cursor
          schema:
            description: Opaque cursor token for pagination
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Get all Transaction Routes
      tags:
        - Transaction Routes (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/list-transaction-routes
    post:
      deprecated: true
      operationId: createTransactionRoute
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTransactionRouteInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TransactionRoute"
          description: Created
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Create Transaction Route
      tags:
        - Transaction Routes (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/create-transaction-route
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/transaction-routes/{transaction_route_id}:
    delete:
      deprecated: true
      operationId: deleteTransactionRoute
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Transaction Route ID (UUID)
          in: path
          name: transaction_route_id
          required: true
          schema:
            description: Transaction Route ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete Transaction Route by ID
      tags:
        - Transaction Routes (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/delete-transaction-route
    get:
      deprecated: true
      operationId: getTransactionRouteByID
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Transaction Route ID (UUID)
          in: path
          name: transaction_route_id
          required: true
          schema:
            description: Transaction Route ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TransactionRoute"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Get Transaction Route by ID
      tags:
        - Transaction Routes (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-transaction-route-by-id
    patch:
      deprecated: true
      description: "Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null deletes every key the client wrote."
      operationId: updateTransactionRoute
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Transaction Route ID (UUID)
          in: path
          name: transaction_route_id
          required: true
          schema:
            description: Transaction Route ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateTransactionRouteInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TransactionRoute"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Update Transaction Route
      tags:
        - Transaction Routes (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/update-transaction-route
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/transactions:
    get:
      deprecated: true
      operationId: getAllTransactions
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: JSON string to filter transactions by metadata fields
          explode: false
          in: query
          name: metadata
          schema:
            description: JSON string to filter transactions by metadata fields
            type: string
        - description: Max items per page (1-100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (1-100, default 10)
            type: string
        - description: Filter transactions created on/after this date
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter transactions created on/after this date
            type: string
        - description: Filter transactions created on/before this date
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter transactions created on/before this date
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
        - description: Pagination cursor
          explode: false
          in: query
          name: cursor
          schema:
            description: Pagination cursor
            type: string
        - description: Filter transactions by atomic cross-ledger group UUID
          explode: false
          in: query
          name: groupId
          schema:
            description: Filter transactions by atomic cross-ledger group UUID
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Get all Transactions
      tags:
        - Transactions (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-all-transactions
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/transactions/annotation:
    post:
      deprecated: true
      operationId: createTransactionAnnotation
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Idempotency key to safely retry the create; an identical retry returns the original transaction, a different request under the same key answers 409 (0084)
          in: header
          name: X-Idempotency
          schema:
            description: Idempotency key to safely retry the create; an identical retry returns the original transaction, a different request under the same key answers 409 (0084)
            type: string
        - description: Idempotency slot TTL in seconds (default 300)
          in: header
          name: X-TTL
          schema:
            description: Idempotency slot TTL in seconds (default 300)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTransactionInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Transaction"
          description: Created
          headers:
            X-Idempotency-Replayed:
              schema:
                type: string
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a Transaction Annotation using JSON
      tags:
        - Transactions (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/create-transaction-annotation
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/transactions/block:
    post:
      deprecated: true
      operationId: createTransactionBlock
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Idempotency key to safely retry the create; an identical retry returns the original transaction, a different request under the same key answers 409 (0084)
          in: header
          name: X-Idempotency
          schema:
            description: Idempotency key to safely retry the create; an identical retry returns the original transaction, a different request under the same key answers 409 (0084)
            type: string
        - description: Idempotency slot TTL in seconds (default 300)
          in: header
          name: X-TTL
          schema:
            description: Idempotency slot TTL in seconds (default 300)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTransactionInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Transaction"
          description: Created
          headers:
            X-Idempotency-Replayed:
              schema:
                type: string
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a Block Transaction
      tags:
        - Transactions (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/create-transaction-block
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/transactions/inflow:
    post:
      deprecated: true
      operationId: createTransactionInflow
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Idempotency key to safely retry the create; an identical retry returns the original transaction, a different request under the same key answers 409 (0084)
          in: header
          name: X-Idempotency
          schema:
            description: Idempotency key to safely retry the create; an identical retry returns the original transaction, a different request under the same key answers 409 (0084)
            type: string
        - description: Idempotency slot TTL in seconds (default 300)
          in: header
          name: X-TTL
          schema:
            description: Idempotency slot TTL in seconds (default 300)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTransactionInflowInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Transaction"
          description: Created
          headers:
            X-Idempotency-Replayed:
              schema:
                type: string
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a Transaction without passing from source
      tags:
        - Transactions (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/create-transaction-inflow
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/transactions/json:
    post:
      deprecated: true
      operationId: createTransactionJSON
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Idempotency key to safely retry the create; an identical retry returns the original transaction, a different request under the same key answers 409 (0084)
          in: header
          name: X-Idempotency
          schema:
            description: Idempotency key to safely retry the create; an identical retry returns the original transaction, a different request under the same key answers 409 (0084)
            type: string
        - description: Idempotency slot TTL in seconds (default 300)
          in: header
          name: X-TTL
          schema:
            description: Idempotency slot TTL in seconds (default 300)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTransactionInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Transaction"
          description: Created
          headers:
            X-Idempotency-Replayed:
              schema:
                type: string
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a Transaction using JSON
      tags:
        - Transactions (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/create-transaction-json
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/transactions/outflow:
    post:
      deprecated: true
      operationId: createTransactionOutflow
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Idempotency key to safely retry the create; an identical retry returns the original transaction, a different request under the same key answers 409 (0084)
          in: header
          name: X-Idempotency
          schema:
            description: Idempotency key to safely retry the create; an identical retry returns the original transaction, a different request under the same key answers 409 (0084)
            type: string
        - description: Idempotency slot TTL in seconds (default 300)
          in: header
          name: X-TTL
          schema:
            description: Idempotency slot TTL in seconds (default 300)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTransactionOutflowInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Transaction"
          description: Created
          headers:
            X-Idempotency-Replayed:
              schema:
                type: string
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a Transaction without passing to distribution
      tags:
        - Transactions (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/create-transaction-outflow
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/transactions/unblock:
    post:
      deprecated: true
      operationId: createTransactionUnblock
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Idempotency key to safely retry the create; an identical retry returns the original transaction, a different request under the same key answers 409 (0084)
          in: header
          name: X-Idempotency
          schema:
            description: Idempotency key to safely retry the create; an identical retry returns the original transaction, a different request under the same key answers 409 (0084)
            type: string
        - description: Idempotency slot TTL in seconds (default 300)
          in: header
          name: X-TTL
          schema:
            description: Idempotency slot TTL in seconds (default 300)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTransactionInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Transaction"
          description: Created
          headers:
            X-Idempotency-Replayed:
              schema:
                type: string
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Create an Unblock Transaction
      tags:
        - Transactions (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/create-transaction-unblock
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/transactions/{transaction_id}:
    get:
      deprecated: true
      operationId: getTransaction
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Transaction ID (UUID)
          in: path
          name: transaction_id
          required: true
          schema:
            description: Transaction ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Transaction"
          description: OK
          headers:
            X-Cache-Hit:
              schema:
                type: string
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Get a Transaction by ID
      tags:
        - Transactions (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-transaction
    patch:
      deprecated: true
      description: "Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null deletes every key the client wrote."
      operationId: updateTransaction
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Transaction ID (UUID)
          in: path
          name: transaction_id
          required: true
          schema:
            description: Transaction ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TransactionUpdateTransactionInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Transaction"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Update a Transaction
      tags:
        - Transactions (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/update-transaction
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/transactions/{transaction_id}/cancel:
    post:
      deprecated: true
      operationId: cancelTransaction
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Transaction ID (UUID)
          in: path
          name: transaction_id
          required: true
          schema:
            description: Transaction ID (UUID)
            type: string
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Transaction"
          description: Created
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Cancel a pending Transaction
      tags:
        - Transactions (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/cancel-transaction
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/transactions/{transaction_id}/commit:
    post:
      deprecated: true
      operationId: commitTransaction
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Transaction ID (UUID)
          in: path
          name: transaction_id
          required: true
          schema:
            description: Transaction ID (UUID)
            type: string
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Transaction"
          description: Created
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Commit a Transaction
      tags:
        - Transactions (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/commit-transaction
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/transactions/{transaction_id}/operations/{operation_id}:
    patch:
      deprecated: true
      description: "Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null deletes every key the client wrote."
      operationId: updateOperation
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Transaction ID (UUID)
          in: path
          name: transaction_id
          required: true
          schema:
            description: Transaction ID (UUID)
            type: string
        - description: Operation ID (UUID)
          in: path
          name: operation_id
          required: true
          schema:
            description: Operation ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/OperationUpdateOperationInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Operation"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Update an Operation
      tags:
        - Operations (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/update-operation
  /v1/organizations/{organization_id}/ledgers/{ledger_id}/transactions/{transaction_id}/revert:
    post:
      deprecated: true
      operationId: revertTransaction
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Transaction ID (UUID)
          in: path
          name: transaction_id
          required: true
          schema:
            description: Transaction ID (UUID)
            type: string
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Transaction"
          description: Created
          headers:
            X-Idempotency-Replayed:
              schema:
                type: string
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Revert a Transaction
      tags:
        - Transactions (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/revert-transaction
  /v1/settings/metadata-indexes:
    get:
      deprecated: true
      operationId: getAllMetadataIndexes
      parameters:
        - description: Optional entity name filter
          explode: false
          in: query
          name: entity_name
          schema:
            description: Optional entity name filter
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  $ref: "#/components/schemas/MetadataIndex"
                type:
                  - array
                  - "null"
          description: OK
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Get all Metadata Indexes
      tags:
        - Metadata Indexes (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/get-all-metadata-indexes
  /v1/settings/metadata-indexes/entities/{entity_name}:
    post:
      deprecated: true
      operationId: createMetadataIndex
      parameters:
        - description: Entity name (organization, ledger, segment, account, portfolio, asset, account_type, transaction, operation, operation_route, transaction_route)
          in: path
          name: entity_name
          required: true
          schema:
            description: Entity name (organization, ledger, segment, account, portfolio, asset, account_type, transaction, operation, operation_route, transaction_route)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateMetadataIndexInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MetadataIndex"
          description: Created
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Create Metadata Index
      tags:
        - Metadata Indexes (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/create-metadata-index
  /v1/settings/metadata-indexes/entities/{entity_name}/key/{index_key}:
    delete:
      deprecated: true
      operationId: deleteMetadataIndex
      parameters:
        - description: Entity name (organization, ledger, segment, account, portfolio, asset, account_type, transaction, operation, operation_route, transaction_route)
          in: path
          name: entity_name
          required: true
          schema:
            description: Entity name (organization, ledger, segment, account, portfolio, asset, account_type, transaction, operation, operation_route, transaction_route)
            type: string
        - description: Index key (metadata key, e.g. 'tier')
          in: path
          name: index_key
          required: true
          schema:
            description: Index key (metadata key, e.g. 'tier')
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Unprocessable Entity
        "500":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Internal Server Error
        default:
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LegacyError"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete Metadata Index
      tags:
        - Metadata Indexes (v1)
      x-mint:
        href: /pt/reference/products/midaz/v1/delete-metadata-index
  /v2/organizations:
    get:
      operationId: listOrganizationsV2
      parameters:
        - description: JSON string to filter organizations by metadata fields
          explode: false
          in: query
          name: metadata
          schema:
            description: JSON string to filter organizations by metadata fields
            type: string
        - description: Max items per page (1-100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (1-100, default 10)
            type: string
        - description: Page number (default 1)
          explode: false
          in: query
          name: page
          schema:
            description: Page number (default 1)
            type: string
        - description: Filter organizations created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter organizations created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter organizations created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter organizations created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
        - description: Filter by legal name (case-insensitive, prefix match)
          explode: false
          in: query
          name: legal_name
          schema:
            description: Filter by legal name (case-insensitive, prefix match)
            type: string
        - description: Filter by doing business as name (case-insensitive, prefix match)
          explode: false
          in: query
          name: doing_business_as
          schema:
            description: Filter by doing business as name (case-insensitive, prefix match)
            type: string
        - description: Filter by status
          explode: false
          in: query
          name: status
          schema:
            description: Filter by status
            type: string
        - description: Filter by legal document (exact match)
          explode: false
          in: query
          name: legal_document
          schema:
            description: Filter by legal document (exact match)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: List all organizations
      tags:
        - Organizations (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/list-organizations
    post:
      operationId: createOrganizationV2
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateOrganizationInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Organization"
          description: Created
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a new organization
      tags:
        - Organizations (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-organization
  /v2/organizations/{organization_id}:
    delete:
      operationId: deleteOrganizationV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete an organization
      tags:
        - Organizations (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/delete-organization
    get:
      operationId: getOrganizationByIDV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Organization"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Retrieve a specific organization
      tags:
        - Organizations (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-organization-by-id
    patch:
      description: "Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null also leaves the stored metadata as it is, so keys are deleted one at a time."
      operationId: updateOrganizationV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateOrganizationInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Organization"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Update an existing organization
      tags:
        - Organizations (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/update-organization
  /v2/organizations/{organization_id}/encryption/provision:
    post:
      operationId: provisionEncryptionV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Bearer token; only required when the auth plugin is enabled
          in: header
          name: Authorization
          schema:
            description: Bearer token; only required when the auth plugin is enabled
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ProvisionEncryptionInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProvisionEncryptionResponse"
          description: Created
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Provision an Organization for Envelope Encryption
      tags:
        - Encryption (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/provision-encryption
  /v2/organizations/{organization_id}/encryption/status:
    get:
      operationId: getProvisioningStatusV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Bearer token; only required when the auth plugin is enabled
          in: header
          name: Authorization
          schema:
            description: Bearer token; only required when the auth plugin is enabled
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProvisioningStatusResponse"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get Provisioning Status
      tags:
        - Encryption (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-provisioning-status
  /v2/organizations/{organization_id}/holders:
    get:
      operationId: listHoldersV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: JSON string to filter holders by metadata fields
          explode: false
          in: query
          name: metadata
          schema:
            description: JSON string to filter holders by metadata fields
            type: string
        - description: Max items per page (1-100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (1-100, default 10)
            type: string
        - description: Page number (default 1)
          explode: false
          in: query
          name: page
          schema:
            description: Page number (default 1)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
        - description: Return includes logically deleted holders (true,false)
          explode: false
          in: query
          name: include_deleted
          schema:
            description: Return includes logically deleted holders (true,false)
            type: string
        - description: Filter holders by externalID
          explode: false
          in: query
          name: external_id
          schema:
            description: Filter holders by externalID
            type: string
        - description: Filter holders by document
          explode: false
          in: query
          name: document
          schema:
            description: Filter holders by document
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: List Holders
      tags:
        - Holders (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/list-holders
    post:
      operationId: createHolderV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Idempotency key to safely retry the create; an identical retry returns the original holder
          in: header
          name: X-Idempotency
          schema:
            description: Idempotency key to safely retry the create; an identical retry returns the original holder
            type: string
        - description: Idempotency slot TTL in seconds (default 300)
          in: header
          name: X-TTL
          schema:
            description: Idempotency slot TTL in seconds (default 300)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateHolderInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Holder"
          description: Created
          headers:
            X-Idempotency-Replayed:
              schema:
                type: string
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a Holder
      tags:
        - Holders (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-holder
  /v2/organizations/{organization_id}/holders/{holder_id}:
    delete:
      operationId: deleteHolderV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Holder ID (UUID)
          in: path
          name: holder_id
          required: true
          schema:
            description: Holder ID (UUID)
            type: string
        - description: Use only to perform a physical deletion of the data. This action is irreversible. (true,false)
          explode: false
          in: query
          name: hard_delete
          schema:
            description: Use only to perform a physical deletion of the data. This action is irreversible. (true,false)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete a Holder
      tags:
        - Holders (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/delete-holder
    get:
      operationId: getHolderByIDV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Holder ID (UUID)
          in: path
          name: holder_id
          required: true
          schema:
            description: Holder ID (UUID)
            type: string
        - description: Returns the holder even if it was logically deleted (true,false)
          explode: false
          in: query
          name: include_deleted
          schema:
            description: Returns the holder even if it was logically deleted (true,false)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Holder"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Retrieve Holder details
      tags:
        - Holders (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-holder-by-id
    patch:
      description: "Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null also leaves the stored metadata as it is, so keys are deleted one at a time."
      operationId: updateHolderV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Holder ID (UUID)
          in: path
          name: holder_id
          required: true
          schema:
            description: Holder ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateHolderInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Holder"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Update a Holder
      tags:
        - Holders (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/update-holder
  /v2/organizations/{organization_id}/holders/{holder_id}/accounts:
    get:
      operationId: listAccountsByHolderV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Holder ID (UUID)
          in: path
          name: holder_id
          required: true
          schema:
            description: Holder ID (UUID)
            type: string
        - description: Max items per page (1-100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (1-100, default 10)
            type: string
        - description: Page number (default 1)
          explode: false
          in: query
          name: page
          schema:
            description: Page number (default 1)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
        - description: Optional ledger ID (UUID). Narrows the org-wide listing to one ledger.
          explode: false
          in: query
          name: ledger_id
          schema:
            description: Optional ledger ID (UUID). Narrows the org-wide listing to one ledger.
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: List Accounts by Holder
      tags:
        - Holders (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/list-accounts-by-holder
  /v2/organizations/{organization_id}/holders/{holder_id}/instruments:
    post:
      description: "Creates an instrument linking a ledger account to its holder and banking details. A ledger account already linked to another instrument (CRM-0013) is refused with 409, and so is a bank account already registered to another live instrument of the organization (CRM-0043): the same bankId and account, on the same branch (leading zeros ignored when both branches are numeric) or where one of them has no branch, whatever the type."
      operationId: createInstrumentV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Holder ID (UUID)
          in: path
          name: holder_id
          required: true
          schema:
            description: Holder ID (UUID)
            type: string
        - description: Idempotency key to safely retry the create; an identical retry returns the original instrument
          in: header
          name: X-Idempotency
          schema:
            description: Idempotency key to safely retry the create; an identical retry returns the original instrument
            type: string
        - description: Idempotency slot TTL in seconds (default 300)
          in: header
          name: X-TTL
          schema:
            description: Idempotency slot TTL in seconds (default 300)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateInstrumentInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Instrument"
          description: Created
          headers:
            X-Idempotency-Replayed:
              schema:
                type: string
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create an Instrument Account
      tags:
        - Instruments (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-instrument
  /v2/organizations/{organization_id}/holders/{holder_id}/instruments/{instrument_id}:
    delete:
      operationId: deleteInstrumentV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Holder ID (UUID)
          in: path
          name: holder_id
          required: true
          schema:
            description: Holder ID (UUID)
            type: string
        - description: Instrument ID (UUID)
          in: path
          name: instrument_id
          required: true
          schema:
            description: Instrument ID (UUID)
            type: string
        - description: Use only to perform a physical deletion of the data. This action is irreversible. (true,false)
          explode: false
          in: query
          name: hard_delete
          schema:
            description: Use only to perform a physical deletion of the data. This action is irreversible. (true,false)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete an Instrument
      tags:
        - Instruments (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/delete-instrument
    get:
      operationId: getInstrumentByIDV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Holder ID (UUID)
          in: path
          name: holder_id
          required: true
          schema:
            description: Holder ID (UUID)
            type: string
        - description: Instrument ID (UUID)
          in: path
          name: instrument_id
          required: true
          schema:
            description: Instrument ID (UUID)
            type: string
        - description: Returns the instrument even if it was logically deleted (true,false)
          explode: false
          in: query
          name: include_deleted
          schema:
            description: Returns the instrument even if it was logically deleted (true,false)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Instrument"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Retrieve Instrument details
      tags:
        - Instruments (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-instrument-by-id
    patch:
      description: "Updates an instrument as an RFC 7396 merge patch. A change to bankId, branch or account that leaves the instrument holding a bank account already registered to another live instrument of the organization is refused with 409 (CRM-0043). Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null also leaves the stored metadata as it is, so keys are deleted one at a time."
      operationId: updateInstrumentV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Holder ID (UUID)
          in: path
          name: holder_id
          required: true
          schema:
            description: Holder ID (UUID)
            type: string
        - description: Instrument ID (UUID)
          in: path
          name: instrument_id
          required: true
          schema:
            description: Instrument ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateInstrumentInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Instrument"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Update an Instrument
      tags:
        - Instruments (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/update-instrument
  /v2/organizations/{organization_id}/holders/{holder_id}/instruments/{instrument_id}/related-parties/{related_party_id}:
    delete:
      operationId: deleteRelatedPartyV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Holder ID (UUID)
          in: path
          name: holder_id
          required: true
          schema:
            description: Holder ID (UUID)
            type: string
        - description: Instrument ID (UUID)
          in: path
          name: instrument_id
          required: true
          schema:
            description: Instrument ID (UUID)
            type: string
        - description: Related Party ID (UUID)
          in: path
          name: related_party_id
          required: true
          schema:
            description: Related Party ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete a Related Party
      tags:
        - Instruments (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/delete-related-party
  /v2/organizations/{organization_id}/instruments:
    get:
      operationId: listInstrumentsV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Filter instruments by holder ID (UUID)
          explode: false
          in: query
          name: holder_id
          schema:
            description: Filter instruments by holder ID (UUID)
            type: string
        - description: JSON string to filter instruments by metadata fields
          explode: false
          in: query
          name: metadata
          schema:
            description: JSON string to filter instruments by metadata fields
            type: string
        - description: Max items per page (1-100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (1-100, default 10)
            type: string
        - description: Page number (default 1)
          explode: false
          in: query
          name: page
          schema:
            description: Page number (default 1)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
        - description: Return includes logically deleted instruments (true,false)
          explode: false
          in: query
          name: include_deleted
          schema:
            description: Return includes logically deleted instruments (true,false)
            type: string
        - description: Filter instrument by accountID
          explode: false
          in: query
          name: account_id
          schema:
            description: Filter instrument by accountID
            type: string
        - description: Filter instrument by ledgerID
          explode: false
          in: query
          name: ledger_id
          schema:
            description: Filter instrument by ledgerID
            type: string
        - description: Filter instrument by document
          explode: false
          in: query
          name: document
          schema:
            description: Filter instrument by document
            type: string
        - description: Filter instruments by banking details branch (exact, case-sensitive match on the stored value)
          explode: false
          in: query
          name: banking_details_branch
          schema:
            description: Filter instruments by banking details branch (exact, case-sensitive match on the stored value)
            type: string
        - description: Filter instruments by banking details account number (exact, case-sensitive match on the stored value)
          explode: false
          in: query
          name: banking_details_account
          schema:
            description: Filter instruments by banking details account number (exact, case-sensitive match on the stored value)
            type: string
        - description: Filter instruments by banking details IBAN (exact, case-sensitive match on the stored value)
          explode: false
          in: query
          name: banking_details_iban
          schema:
            description: Filter instruments by banking details IBAN (exact, case-sensitive match on the stored value)
            type: string
        - description: Filter instruments by regulatory participant document (exact match on the stored value; no CPF/CNPJ formatting is stripped)
          explode: false
          in: query
          name: regulatory_fields_participant_document
          schema:
            description: Filter instruments by regulatory participant document (exact match on the stored value; no CPF/CNPJ formatting is stripped)
            type: string
        - description: Filter instruments with any related party holding this document (exact match on the stored value; no CPF/CNPJ formatting is stripped)
          explode: false
          in: query
          name: related_party_document
          schema:
            description: Filter instruments with any related party holding this document (exact match on the stored value; no CPF/CNPJ formatting is stripped)
            type: string
        - description: "Filter instruments with any related party in this role (exact, case-sensitive: PRIMARY_HOLDER, LEGAL_REPRESENTATIVE, RESPONSIBLE_PARTY)"
          explode: false
          in: query
          name: related_party_role
          schema:
            description: "Filter instruments with any related party in this role (exact, case-sensitive: PRIMARY_HOLDER, LEGAL_REPRESENTATIVE, RESPONSIBLE_PARTY)"
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: List Instruments
      tags:
        - Instruments (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/list-instruments
  /v2/organizations/{organization_id}/ledgers:
    get:
      operationId: listLedgersV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: JSON string to filter ledgers by metadata fields
          explode: false
          in: query
          name: metadata
          schema:
            description: JSON string to filter ledgers by metadata fields
            type: string
        - description: Max items per page (1-100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (1-100, default 10)
            type: string
        - description: Page number (default 1)
          explode: false
          in: query
          name: page
          schema:
            description: Page number (default 1)
            type: string
        - description: Filter ledgers created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter ledgers created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter ledgers created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter ledgers created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
        - description: Filter ledgers by name (case-insensitive, prefix match)
          explode: false
          in: query
          name: name
          schema:
            description: Filter ledgers by name (case-insensitive, prefix match)
            type: string
        - description: Filter ledgers by status (ACTIVE, INACTIVE)
          explode: false
          in: query
          name: status
          schema:
            description: Filter ledgers by status (ACTIVE, INACTIVE)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: List all ledgers
      tags:
        - Ledgers (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/list-ledgers
    post:
      operationId: createLedgerV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateLedgerInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Ledger"
          description: Created
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a new ledger
      tags:
        - Ledgers (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-ledger
  /v2/organizations/{organization_id}/ledgers/{ledger_id}:
    delete:
      operationId: deleteLedgerV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete a ledger
      tags:
        - Ledgers (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/delete-ledger
    get:
      operationId: getLedgerByIDV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Ledger"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Retrieve a specific ledger
      tags:
        - Ledgers (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-ledger-by-id
    patch:
      description: "Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null also leaves the stored metadata as it is, so keys are deleted one at a time."
      operationId: updateLedgerV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateLedgerInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Ledger"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Update an existing ledger
      tags:
        - Ledgers (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/update-ledger
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/account-plans:
    get:
      operationId: getAllAccountPlansV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Filter by enabled flag (true, false)
          explode: false
          in: query
          name: enable
          schema:
            description: Filter by enabled flag (true, false)
            type: string
        - description: Number of items per page (default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Number of items per page (default 10)
            type: string
        - description: Page number (default 1)
          explode: false
          in: query
          name: page
          schema:
            description: Page number (default 1)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AccountPlanList"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: List the account plans of a ledger
      tags:
        - Account Plans (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/list-the-account-plans-of-a-ledger
    post:
      description: Creates a fee plan linked directly to ledger accounts, with its version 1 in effect from the instant of the creation.
      operationId: createAccountPlanV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/FeeCreateAccountPlanInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FeeAccountPlanView"
          description: Created
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create an account plan
      tags:
        - Account Plans (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-an-account-plan
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/account-plans/{account_plan_id}:
    delete:
      description: Soft-deletes the plan. A plan still assigned to at least one account is refused with 409.
      operationId: deleteAccountPlanV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account plan ID (UUID)
          in: path
          name: account_plan_id
          required: true
          schema:
            description: Account plan ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete an account plan
      tags:
        - Account Plans (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/delete-an-account-plan
    get:
      description: Returns the plan header and the version in effect at the instant of the request.
      operationId: getAccountPlanByIDV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account plan ID (UUID)
          in: path
          name: account_plan_id
          required: true
          schema:
            description: Account plan ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FeeAccountPlanView"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get an account plan
      tags:
        - Account Plans (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-an-account-plan
    patch:
      description: label, description, enable and timezone change only the plan header. fees creates a new immutable version holding the full resulting fee map, in effect from effectiveFrom (the request instant when absent). Existing versions never change.
      operationId: updateAccountPlanV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account plan ID (UUID)
          in: path
          name: account_plan_id
          required: true
          schema:
            description: Account plan ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/FeePatchAccountPlanInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FeeAccountPlanView"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Update an account plan
      tags:
        - Account Plans (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/update-an-account-plan
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/account-plans/{account_plan_id}/accounts:
    get:
      description: Lists the active assignments of the account plan, ordered by startedAt.
      operationId: listAccountPlanAccountsV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account plan ID (UUID)
          in: path
          name: account_plan_id
          required: true
          schema:
            description: Account plan ID (UUID)
            type: string
        - description: Max items per page (1-100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (1-100, default 10)
            type: string
        - description: Page number (default 1)
          explode: false
          in: query
          name: page
          schema:
            description: Page number (default 1)
            type: string
        - description: Sort direction by assignment start (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction by assignment start (asc, desc)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: List the accounts assigned to an account plan
      tags:
        - Account Plan Assignments (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/list-the-accounts-assigned-to-an-account-plan
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/account-plans/{account_plan_id}/versions:
    get:
      operationId: getAccountPlanVersionsV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account plan ID (UUID)
          in: path
          name: account_plan_id
          required: true
          schema:
            description: Account plan ID (UUID)
            type: string
        - description: Number of items per page (default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Number of items per page (default 10)
            type: string
        - description: Page number (default 1)
          explode: false
          in: query
          name: page
          schema:
            description: Page number (default 1)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AccountPlanVersionList"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: List the versions of an account plan
      tags:
        - Account Plans (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/list-the-versions-of-an-account-plan
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/account-types:
    get:
      operationId: listAccountTypesV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: JSON string to filter account types by metadata fields
          explode: false
          in: query
          name: metadata
          schema:
            description: JSON string to filter account types by metadata fields
            type: string
        - description: Filter account types by key value
          explode: false
          in: query
          name: key_value
          schema:
            description: Filter account types by key value
            type: string
        - description: Max items per page (1-100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (1-100, default 10)
            type: string
        - description: Page number (default 1)
          explode: false
          in: query
          name: page
          schema:
            description: Page number (default 1)
            type: string
        - description: Cursor for cursor-based pagination
          explode: false
          in: query
          name: cursor
          schema:
            description: Cursor for cursor-based pagination
            type: string
        - description: Filter account types created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter account types created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter account types created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter account types created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: List all account types
      tags:
        - Account Types (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/list-account-types
    post:
      operationId: createAccountTypeV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateAccountTypeInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AccountType"
          description: Created
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a new account type
      tags:
        - Account Types (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-account-type
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/account-types/{account_type_id}:
    delete:
      operationId: deleteAccountTypeV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account Type ID (UUID)
          in: path
          name: account_type_id
          required: true
          schema:
            description: Account Type ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete an account type
      tags:
        - Account Types (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/delete-account-type
    get:
      operationId: getAccountTypeByIDV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account Type ID (UUID)
          in: path
          name: account_type_id
          required: true
          schema:
            description: Account Type ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AccountType"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Retrieve a specific account type
      tags:
        - Account Types (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-account-type-by-id
    patch:
      description: "Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null also leaves the stored metadata as it is, so keys are deleted one at a time."
      operationId: updateAccountTypeV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account Type ID (UUID)
          in: path
          name: account_type_id
          required: true
          schema:
            description: Account Type ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateAccountTypeInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AccountType"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Update an account type
      tags:
        - Account Types (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/update-account-type
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/accounts:
    get:
      operationId: listAccountsV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: JSON string to filter accounts by metadata fields
          explode: false
          in: query
          name: metadata
          schema:
            description: JSON string to filter accounts by metadata fields
            type: string
        - description: Max items per page (1-100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (1-100, default 10)
            type: string
        - description: Page number (default 1)
          explode: false
          in: query
          name: page
          schema:
            description: Page number (default 1)
            type: string
        - description: Filter accounts created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter accounts created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter accounts created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter accounts created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
        - description: Filter accounts by portfolio ID (UUID)
          explode: false
          in: query
          name: portfolio_id
          schema:
            description: Filter accounts by portfolio ID (UUID)
            type: string
        - description: Filter accounts by segment ID (UUID)
          explode: false
          in: query
          name: segment_id
          schema:
            description: Filter accounts by segment ID (UUID)
            type: string
        - description: Filter accounts by status (ACTIVE, INACTIVE, BLOCKED)
          explode: false
          in: query
          name: status
          schema:
            description: Filter accounts by status (ACTIVE, INACTIVE, BLOCKED)
            type: string
        - description: Filter accounts by type (e.g., deposit, savings, external)
          explode: false
          in: query
          name: type
          schema:
            description: Filter accounts by type (e.g., deposit, savings, external)
            type: string
        - description: Filter accounts by asset code (e.g., USD, BRL, EUR)
          explode: false
          in: query
          name: asset_code
          schema:
            description: Filter accounts by asset code (e.g., USD, BRL, EUR)
            type: string
        - description: Filter accounts by entity ID
          explode: false
          in: query
          name: entity_id
          schema:
            description: Filter accounts by entity ID
            type: string
        - description: Filter accounts by blocked status (true, false)
          explode: false
          in: query
          name: blocked
          schema:
            description: Filter accounts by blocked status (true, false)
            type: string
        - description: Filter accounts by parent account ID (UUID)
          explode: false
          in: query
          name: parent_account_id
          schema:
            description: Filter accounts by parent account ID (UUID)
            type: string
        - description: Filter accounts by name (case-insensitive, prefix match)
          explode: false
          in: query
          name: name
          schema:
            description: Filter accounts by name (case-insensitive, prefix match)
            type: string
        - description: Filter accounts by alias (case-insensitive, prefix match)
          explode: false
          in: query
          name: alias
          schema:
            description: Filter accounts by alias (case-insensitive, prefix match)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: List all accounts
      tags:
        - Accounts (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/list-accounts
    post:
      description: "The closing instant is output only: a body naming closedAt or closed_at at its root is refused with 400 whatever the value it carries, and the stored instant is only ever written by the close command."
      operationId: createAccountV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Bearer token (forwarded to the service)
          in: header
          name: Authorization
          schema:
            description: Bearer token (forwarded to the service)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateAccountInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AccountV2"
          description: Created
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a new account
      tags:
        - Accounts (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-account
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/accounts/alias/{alias}:
    get:
      operationId: getAccountByAliasV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account alias (e.g. @person1)
          in: path
          name: alias
          required: true
          schema:
            description: Account alias (e.g. @person1)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AccountV2"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Retrieve an account by alias
      tags:
        - Accounts (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-account-by-alias
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/accounts/alias/{alias}/balances:
    get:
      description: Returns the current balance state. When that state cannot be read, the request answers 503 (0542) and may be retried.
      operationId: getBalancesByAliasV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Alias (e.g. @person1)
          in: path
          name: alias
          required: true
          schema:
            description: Alias (e.g. @person1)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get Balances using Alias
      tags:
        - Balances (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-balances-by-alias
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/accounts/block-exceptions:
    post:
      description: Creates a batch of single-use exceptions that authorize a debit of an exact amount out of a blocked account. Each exception is returned with its identifier and its expiry, lives only in the cache, and dies on first use or when its TTL elapses.
      operationId: createAccountBlockExceptionsV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateAccountBlockExceptionsInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AccountBlockExceptions"
          description: Created
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create single-use account block exceptions
      tags:
        - Account Block Exceptions (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-account-block-exceptions
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/accounts/external/{code}:
    get:
      operationId: getAccountExternalByCodeV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account external code (e.g. BRL)
          in: path
          name: code
          required: true
          schema:
            description: Account external code (e.g. BRL)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AccountV2"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Retrieve an account by external code
      tags:
        - Accounts (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-account-external-by-code
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/accounts/external/{code}/balances:
    get:
      description: Returns the current balance state. When that state cannot be read, the request answers 503 (0542) and may be retried.
      operationId: getBalancesExternalByCodeV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Code (e.g. BRL)
          in: path
          name: code
          required: true
          schema:
            description: Code (e.g. BRL)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get External balances using code
      tags:
        - Balances (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-balances-external-by-code
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/accounts/{account_id}:
    delete:
      description: Deletes an account together with its balances. A balance that still owes pending fees (0527) or that other balances still owe pending fees to (0528) is refused with 422. A state that cannot be established answers 503 (0520) and may be retried. The CRM instrument linked to the account is soft-deleted. The active account plan assignment of the account ends; its history stays readable. In every fee package of the ledger, a fee whose creditAccount is the account's alias is removed and the alias leaves waivedAccounts; a package left without fees is disabled. In billing packages, a debitAccountAlias, creditAccountAlias or maintenanceCreditAccount equal to the alias is cleared and the package is disabled; the alias leaves accountTarget.aliases, and the package is disabled only when that list empties. These effects happen before the account is deleted. If one of them fails, the account stays in place and the request may be retried.
      operationId: deleteAccountV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account ID (UUID)
          in: path
          name: account_id
          required: true
          schema:
            description: Account ID (UUID)
            type: string
        - description: Bearer token (forwarded to the service)
          in: header
          name: Authorization
          schema:
            description: Bearer token (forwarded to the service)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete an account
      tags:
        - Accounts (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/delete-account
    get:
      operationId: getAccountByIDV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account ID (UUID)
          in: path
          name: account_id
          required: true
          schema:
            description: Account ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AccountV2"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Retrieve a specific account
      tags:
        - Accounts (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-account-by-id
    patch:
      description: "The closing instant is output only: a body naming closedAt or closed_at at its root is refused with 400 whatever the value it carries, and the stored instant is only ever written by the close command. Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null also leaves the stored metadata as it is, so keys are deleted one at a time."
      operationId: updateAccountV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account ID (UUID)
          in: path
          name: account_id
          required: true
          schema:
            description: Account ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateAccountInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AccountV2"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Update an account
      tags:
        - Accounts (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/update-account
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/accounts/{account_id}/account-plan:
    delete:
      description: Ends the active assignment of the account, which then follows the fee plans of the ledger again. An account without an active assignment answers 404 (0554).
      operationId: unassignAccountPlanV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account ID (UUID)
          in: path
          name: account_id
          required: true
          schema:
            description: Account ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: End the account plan assignment of an account
      tags:
        - Account Plan Assignments (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/end-the-account-plan-assignment-of-an-account
    get:
      description: Returns the active assignment of the account, or null, and every assignment it had, the active one included, most recent startedAt first. The history stays readable after the account is deleted.
      operationId: getAccountPlanAssignmentV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account ID (UUID)
          in: path
          name: account_id
          required: true
          schema:
            description: Account ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FeeAccountPlanAssignments"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get the account plan assignment of an account
      tags:
        - Account Plan Assignments (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-the-account-plan-assignment-of-an-account
    put:
      description: Assigns the account plan to the account. An active assignment of another plan ends at the instant the new one starts, in one atomic step. Assigning the plan already active returns the active assignment unchanged. The account must exist in the ledger (404). The plan must belong to the ledger and not be deleted (404), and must be enabled (422, 0545). A concurrent assignment of the same account may answer 409 (0560) and may be retried. ledgerId in the query or the body is refused with 0235.
      operationId: assignAccountPlanV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account ID (UUID)
          in: path
          name: account_id
          required: true
          schema:
            description: Account ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/FeeAssignAccountPlanInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FeeAccountPlanAssignment"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Assign an account plan to an account
      tags:
        - Account Plan Assignments (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/assign-an-account-plan-to-an-account
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/accounts/{account_id}/account-plan/usage:
    get:
      description: "Returns the free-quota consumption of the account in a period, for each fee of the version in effect now of its active account plan: the quota trigger, the period, the free quota, the units used, the free units remaining (never negative) and the units charged. A transaction fee counts its free quota per scheme, so it lists one item per scheme. The numbers come from the same counters the fee decision reads. period (YYYY-MM, in the plan timezone) reads a past month and defaults to the current one; a malformed or future period is refused with 0082. The account must exist in the ledger (404) and have an active assignment (404, 0554). ledgerId in the query is refused with 0235."
      operationId: getAccountPlanUsageV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account ID (UUID)
          in: path
          name: account_id
          required: true
          schema:
            description: Account ID (UUID)
            type: string
        - description: Period to read, in the YYYY-MM format and the plan timezone. Defaults to the current period; a future period is refused.
          explode: false
          in: query
          name: period
          schema:
            description: Period to read, in the YYYY-MM format and the plan timezone. Defaults to the current period; a future period is refused.
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FeeAccountPlanUsage"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get the account plan usage of an account
      tags:
        - Account Plan Assignments (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-the-account-plan-usage-of-an-account
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/accounts/{account_id}/balances:
    get:
      description: Returns the current balance state. When that state cannot be read, the request answers 503 (0542) and may be retried.
      operationId: getAllBalancesByAccountIDV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account ID (UUID)
          in: path
          name: account_id
          required: true
          schema:
            description: Account ID (UUID)
            type: string
        - description: Max items per page (max 100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (max 100, default 10)
            type: string
        - description: Filter balances created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter balances created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter balances created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter balances created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
        - description: Opaque cursor token for pagination
          explode: false
          in: query
          name: cursor
          schema:
            description: Opaque cursor token for pagination
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get all balances by account id
      tags:
        - Balances (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-all-balances-by-account-id
    post:
      operationId: createAdditionalBalanceV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account ID (UUID)
          in: path
          name: account_id
          required: true
          schema:
            description: Account ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateAdditionalBalance"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Balance"
          description: Created
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create Additional Balance
      tags:
        - Balances (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-additional-balance
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/accounts/{account_id}/balances/history:
    get:
      operationId: getAccountBalancesAtTimestampV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account ID (UUID)
          in: path
          name: account_id
          required: true
          schema:
            description: Account ID (UUID)
            type: string
        - description: "Ledger-recorded state at this point in time (format: yyyy-mm-dd hh:mm:ss)"
          explode: false
          in: query
          name: date
          schema:
            description: "Ledger-recorded state at this point in time (format: yyyy-mm-dd hh:mm:ss)"
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  $ref: "#/components/schemas/BalanceHistory"
                type:
                  - array
                  - "null"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get Account Balances history at date
      tags:
        - Balances (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-account-balances-at-timestamp
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/accounts/{account_id}/close:
    post:
      description: "Closes an account whose balances are all exactly zero and whose funds no pending transaction still holds, preserving its history and refusing every later movement. The command takes no body and the closing instant is read back as the account's closedAt, which every account read then exposes. An external account is never eligible (0074), balances that are not exactly zero (0523), a pending transaction still holding the account's funds (0524), a balance that still owes pending fees (0527) and a balance that other balances still owe pending fees to (0528) are refused with 422. An account already closed (0521), an account whose closing is already in progress (0522), an account held by another operation such as transactions loading its balances or a balance creation or deletion (0526) and an account whose accounting persistence is still settling (0518) are refused with 409, the last two of which may be retried later. An indeterminate protection or an unavailable dependency answers 503 (0520). Once the account is closed, any movement that would touch it is refused with 0519, including the commit of a pending transaction that names it as destination, and the revert of a transaction whose fee legs credited it. Closing is permanent. To retire a fee account, point the fee package at the new fee account and leave the old account open: reverts of earlier transactions and collections of fee debt already owed to it still post there."
      operationId: closeAccountV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account ID (UUID)
          in: path
          name: account_id
          required: true
          schema:
            description: Account ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Close an account
      tags:
        - Accounts (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/close-account
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/accounts/{account_id}/fee-charges:
    get:
      description: Lists the fee charges of the account, newest first, narrowed to a quota period (YYYY-MM) when period is given. An invalid period answers 400.
      operationId: listFeeChargesV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account ID (UUID)
          in: path
          name: account_id
          required: true
          schema:
            description: Account ID (UUID)
            type: string
        - description: Quota period (YYYY-MM) the charges were counted in; omitted lists every period.
          explode: false
          in: query
          name: period
          schema:
            description: Quota period (YYYY-MM) the charges were counted in; omitted lists every period.
            type: string
        - description: Max items per page (1-100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (1-100, default 10)
            type: string
        - description: Page number (default 1)
          explode: false
          in: query
          name: page
          schema:
            description: Page number (default 1)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: List the fee charges of an account
      tags:
        - Fee Charges (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/list-the-fee-charges-of-an-account
    post:
      description: Charges service fees of the account plan of the account. Each occurrence of a code in serviceCodes is one unit. Units inside the free quota of their fee come out as quota and cost nothing; units past it come out as charged at the fee's flat amount. Codes the account's plan does not declare, and every code of an account without a plan, come out as not_covered and consume nothing. All charged units post in a single fee transaction in the account's asset, debiting the account and crediting each fee's creditAccount, on the fees' transaction route when the ledger validates accounting routes; neither account plans nor fee packages apply to it. When no unit is charged the charge is recorded without a transaction. The X-Idempotency header is required (400, 0552); a retry with the same key and body returns the recorded charge with X-Idempotency-Replayed and charges nothing again. A code no fee of the ledger declares is refused (422, 0549), as is a code only transaction fees declare (422, 0550) and codes whose fees have different transaction routes (422, 0551). When the fee transaction is refused, for insufficient funds for instance, the charge is refused with the same error and nothing is consumed. ledgerId in the query or the body is refused with 0235.
      operationId: chargeServiceFeesV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account ID (UUID)
          in: path
          name: account_id
          required: true
          schema:
            description: Account ID (UUID)
            type: string
        - description: "Required. Idempotency key of the charge, unique per account: a retry with the same key and body returns the recorded charge with X-Idempotency-Replayed, a different body under the same key answers 409 (0084)."
          in: header
          name: X-Idempotency
          schema:
            description: "Required. Idempotency key of the charge, unique per account: a retry with the same key and body returns the recorded charge with X-Idempotency-Replayed, a different body under the same key answers 409 (0084)."
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/FeeChargeServiceFeesInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FeeCharge"
          description: Created
          headers:
            X-Idempotency-Replayed:
              schema:
                type: string
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Charge service fees to an account
      tags:
        - Fee Charges (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/charge-service-fees-to-an-account
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/accounts/{account_id}/fee-charges/{fee_charge_id}:
    get:
      description: Returns one fee charge of the account. A charge of another account is not found.
      operationId: getFeeChargeV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account ID (UUID)
          in: path
          name: account_id
          required: true
          schema:
            description: Account ID (UUID)
            type: string
        - description: Fee charge ID (UUID)
          in: path
          name: fee_charge_id
          required: true
          schema:
            description: Fee charge ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FeeCharge"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get a fee charge of an account
      tags:
        - Fee Charges (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-a-fee-charge-of-an-account
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/accounts/{account_id}/operations:
    get:
      operationId: getAllOperationsByAccountV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account ID (UUID)
          in: path
          name: account_id
          required: true
          schema:
            description: Account ID (UUID)
            type: string
        - description: JSON string to filter operations by metadata fields
          explode: false
          in: query
          name: metadata
          schema:
            description: JSON string to filter operations by metadata fields
            type: string
        - description: Max items per page (max 100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (max 100, default 10)
            type: string
        - description: Filter operations created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter operations created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter operations created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter operations created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc) for the chosen sort key
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc) for the chosen sort key
            type: string
        - description: Sort key (id, created_at). Default id. created_at orders by creation date, then id. A cursor is only valid with the sort key it was issued for
          explode: false
          in: query
          name: sort_by
          schema:
            description: Sort key (id, created_at). Default id. created_at orders by creation date, then id. A cursor is only valid with the sort key it was issued for
            type: string
        - description: Opaque cursor token for pagination
          explode: false
          in: query
          name: cursor
          schema:
            description: Opaque cursor token for pagination
            type: string
        - description: Filter by operation type (DEBIT, CREDIT)
          explode: false
          in: query
          name: type
          schema:
            description: Filter by operation type (DEBIT, CREDIT)
            type: string
        - description: Filter by direction (debit, credit)
          explode: false
          in: query
          name: direction
          schema:
            description: Filter by direction (debit, credit)
            type: string
        - description: Filter by operation route ID (UUID)
          explode: false
          in: query
          name: route_id
          schema:
            description: Filter by operation route ID (UUID)
            type: string
        - description: Filter by operation route code
          explode: false
          in: query
          name: route_code
          schema:
            description: Filter by operation route code
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get all Operations by account
      tags:
        - Operations (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-all-operations-by-account
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/accounts/{account_id}/operations/{operation_id}:
    get:
      operationId: getOperationByAccountV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Account ID (UUID)
          in: path
          name: account_id
          required: true
          schema:
            description: Account ID (UUID)
            type: string
        - description: Operation ID (UUID)
          in: path
          name: operation_id
          required: true
          schema:
            description: Operation ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Operation"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get Operation
      tags:
        - Operations (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-operation-by-account
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/assets:
    get:
      operationId: listAssetsV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: JSON string to filter assets by metadata fields
          explode: false
          in: query
          name: metadata
          schema:
            description: JSON string to filter assets by metadata fields
            type: string
        - description: Max items per page (1-100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (1-100, default 10)
            type: string
        - description: Page number (default 1)
          explode: false
          in: query
          name: page
          schema:
            description: Page number (default 1)
            type: string
        - description: Filter assets created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter assets created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter assets created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter assets created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: List all assets
      tags:
        - Assets (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/list-assets
    post:
      operationId: createAssetV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Bearer token (forwarded to the service)
          in: header
          name: Authorization
          schema:
            description: Bearer token (forwarded to the service)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateAssetInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Asset"
          description: Created
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a new asset
      tags:
        - Assets (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-asset
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/assets/{asset_id}:
    delete:
      operationId: deleteAssetV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Asset ID (UUID)
          in: path
          name: asset_id
          required: true
          schema:
            description: Asset ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete an asset
      tags:
        - Assets (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/delete-asset
    get:
      operationId: getAssetByIDV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Asset ID (UUID)
          in: path
          name: asset_id
          required: true
          schema:
            description: Asset ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Asset"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Retrieve a specific asset
      tags:
        - Assets (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-asset-by-id
    patch:
      description: "Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null also leaves the stored metadata as it is, so keys are deleted one at a time."
      operationId: updateAssetV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Asset ID (UUID)
          in: path
          name: asset_id
          required: true
          schema:
            description: Asset ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateAssetInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Asset"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Update an asset
      tags:
        - Assets (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/update-asset
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/balances:
    get:
      description: Returns the current balance state. When that state cannot be read, the request answers 503 (0542) and may be retried.
      operationId: getAllBalancesV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Max items per page (max 100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (max 100, default 10)
            type: string
        - description: Filter balances created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter balances created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter balances created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter balances created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
        - description: Opaque cursor token for pagination
          explode: false
          in: query
          name: cursor
          schema:
            description: Opaque cursor token for pagination
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get all balances
      tags:
        - Balances (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-all-balances
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/balances/metrics/totals:
    get:
      description: "Returns the available and on-hold totals and the count of the ledger's non-external balances of one key and asset: the sum of each balance's current state, as the balance reads return it, read during the request; not an atomic snapshot across balances, so a posting concurrent with the request may or may not be counted. When that state cannot be read, the request answers 503 (0542) and may be retried."
      operationId: getBalanceTotalsV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Required. Balance key to total, case-insensitive (no whitespace, max 100)
          explode: false
          in: query
          name: balance_key
          schema:
            description: Required. Balance key to total, case-insensitive (no whitespace, max 100)
            type: string
        - description: Required. Asset code to total, compared exactly (no whitespace, max 100)
          explode: false
          in: query
          name: asset_code
          schema:
            description: Required. Asset code to total, compared exactly (no whitespace, max 100)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BalanceTotals"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get balance totals by key and asset
      tags:
        - Balances (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-balance-totals-by-key-and-asset
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/balances/{balance_id}:
    delete:
      description: Deletes a balance. A balance that still owes pending fees (0527) or that other balances still owe pending fees to (0528) is refused with 422. A state that cannot be established answers 503 (0520) and may be retried.
      operationId: deleteBalanceV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Balance ID (UUID)
          in: path
          name: balance_id
          required: true
          schema:
            description: Balance ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete Balance by account
      tags:
        - Balances (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/delete-balance
    get:
      description: Returns the current balance state. When that state cannot be read, the request answers 503 (0542) and may be retried.
      operationId: getBalanceByIDV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Balance ID (UUID)
          in: path
          name: balance_id
          required: true
          schema:
            description: Balance ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Balance"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get Balance by id
      tags:
        - Balances (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-balance-by-id
    patch:
      operationId: updateBalanceV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Balance ID (UUID)
          in: path
          name: balance_id
          required: true
          schema:
            description: Balance ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateBalance"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Balance"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Update Balance
      tags:
        - Balances (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/update-balance
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/balances/{balance_id}/history:
    get:
      operationId: getBalanceAtTimestampV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Balance ID (UUID)
          in: path
          name: balance_id
          required: true
          schema:
            description: Balance ID (UUID)
            type: string
        - description: "Ledger-recorded state at this point in time (format: yyyy-mm-dd hh:mm:ss)"
          explode: false
          in: query
          name: date
          schema:
            description: "Ledger-recorded state at this point in time (format: yyyy-mm-dd hh:mm:ss)"
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BalanceHistory"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get Balance history at date
      tags:
        - Balances (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-balance-at-timestamp
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/billing-packages:
    get:
      operationId: getAllBillingPackagesV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Filter by billing package type (volume, maintenance)
          explode: false
          in: query
          name: type
          schema:
            description: Filter by billing package type (volume, maintenance)
            type: string
        - description: Number of items per page (default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Number of items per page (default 10)
            type: string
        - description: Page number (default 1)
          explode: false
          in: query
          name: page
          schema:
            description: Page number (default 1)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FeePagination"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get all billing packages of a ledger
      tags:
        - Billing Packages (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-all-billing-packages
    post:
      operationId: createBillingPackageV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/FeeCreateBillingPackageInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FeeBillingPackage"
          description: Created
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a BillingPackage
      tags:
        - Billing Packages (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-billing-package
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/billing-packages/{billing_package_id}:
    delete:
      operationId: deleteBillingPackageV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: BillingPackage ID (UUID)
          in: path
          name: billing_package_id
          required: true
          schema:
            description: BillingPackage ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: SoftDelete a BillingPackage by ID
      tags:
        - Billing Packages (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/delete-billing-package
    get:
      operationId: getBillingPackageByIDV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: BillingPackage ID (UUID)
          in: path
          name: billing_package_id
          required: true
          schema:
            description: BillingPackage ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FeeBillingPackage"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get billing package
      tags:
        - Billing Packages (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-billing-package-by-id
    patch:
      operationId: updateBillingPackageV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: BillingPackage ID (UUID)
          in: path
          name: billing_package_id
          required: true
          schema:
            description: BillingPackage ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/FeeBillingPackageUpdate"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FeeBillingPackage"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Update a billing package
      tags:
        - Billing Packages (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/update-billing-package
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/billing/calculate:
    post:
      operationId: calculateBillingV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/FeeBillingCalculateRequest"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FeeBillingCalculateResponse"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Calculate billing
      tags:
        - Billing Calculate (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/calculate-billing
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/dashboard/assets:
    get:
      description: "Returns the ledger's CURRENT position in each asset — how many distinct accounts hold it, and the summed available and on-hold figures — read from the balance table. It takes NO window and ignores any window parameter a caller sends: a balance is a running total, not an aggregate over history. Amounts are exact decimal strings, per asset, never summed across assets."
      operationId: getLedgerDashboardAssetsV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LedgerDashboardAssets"
          description: OK
          headers:
            Cache-Control:
              schema:
                type: string
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get ledger current position per asset
      tags:
        - Dashboard (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-dashboard-assets
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/dashboard/metrics:
    get:
      description: "Returns, for the window, the total number of transactions, the count of each status the ledger knows, and the settled volume per asset. Volume sums transaction.amount over SETTLED transactions only — status APPROVED, the only status whose transactions moved money — and is reported PER ASSET with no cross-asset total, because adding two assets together does not produce money. Amounts are exact decimal strings whose scale is not normative; format them with the asset's own exponent and never parse them as a binary float. volumeByAsset is the GROSS settled amount: every settled leg inside the window, reversal legs included. reversalsByAsset is the part of it made of reversal legs, same window and same settled filter. A true net is NOT derivable from the two alone, because it depends on whether each reversed original also falls inside the window; a consumer that needs net reads the transactions."
      operationId: getLedgerDashboardMetricsV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: "Relative window: 7d, 30d or 90d (default: 30d). Mutually exclusive with start_date/end_date."
          explode: false
          in: query
          name: period
          schema:
            description: "Relative window: 7d, 30d or 90d (default: 30d). Mutually exclusive with start_date/end_date."
            type: string
        - description: Window start (RFC3339, inclusive). Requires end_date. Mutually exclusive with period.
          explode: false
          in: query
          name: start_date
          schema:
            description: Window start (RFC3339, inclusive). Requires end_date. Mutually exclusive with period.
            type: string
        - description: Window end (RFC3339, exclusive). Requires start_date. The window may not exceed 90 days.
          explode: false
          in: query
          name: end_date
          schema:
            description: Window end (RFC3339, exclusive). Requires start_date. The window may not exceed 90 days.
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LedgerDashboardMetrics"
          description: OK
          headers:
            Cache-Control:
              schema:
                type: string
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get ledger dashboard metrics
      tags:
        - Dashboard (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-dashboard-metrics
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/dashboard/volume:
    get:
      description: Returns one point per UTC calendar day the window TOUCHES, including days with no transactions, which are present with transactions 0 and an empty byAsset. A window is half-open and snaps to the minute rather than to midnight, so a 7d window opened mid-afternoon returns EIGHT points. Each point's transactions counts every status; its byAsset applies the same settled rule as /metrics. Summing the points reproduces /metrics exactly, and is likewise GROSS of reversals.
      operationId: getLedgerDashboardVolumeV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: "Relative window: 7d, 30d or 90d (default: 30d). Mutually exclusive with start_date/end_date."
          explode: false
          in: query
          name: period
          schema:
            description: "Relative window: 7d, 30d or 90d (default: 30d). Mutually exclusive with start_date/end_date."
            type: string
        - description: Window start (RFC3339, inclusive). Requires end_date. Mutually exclusive with period.
          explode: false
          in: query
          name: start_date
          schema:
            description: Window start (RFC3339, inclusive). Requires end_date. Mutually exclusive with period.
            type: string
        - description: Window end (RFC3339, exclusive). Requires start_date. The window may not exceed 90 days.
          explode: false
          in: query
          name: end_date
          schema:
            description: Window end (RFC3339, exclusive). Requires start_date. The window may not exceed 90 days.
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LedgerDashboardVolume"
          description: OK
          headers:
            Cache-Control:
              schema:
                type: string
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get ledger dashboard volume series
      tags:
        - Dashboard (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-dashboard-volume
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/estimates:
    post:
      operationId: estimateFeeCalculationV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/FeeEstimate"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                contentEncoding: base64
                type: string
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a fee estimate calculation
      tags:
        - Fees (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/estimate-fee-calculation
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/fee-debts:
    get:
      operationId: listFeeDebtsV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Only the debts of this debtor account, in settlement order
          explode: false
          in: query
          name: account_alias
          schema:
            description: Only the debts of this debtor account, in settlement order
            type: string
        - description: Debtor balance key; requires account_alias (default "default")
          explode: false
          in: query
          name: balance_key
          schema:
            description: Debtor balance key; requires account_alias (default "default")
            type: string
        - description: "open: remaining above zero; settled: the rest. Absent lists both"
          explode: false
          in: query
          name: status
          schema:
            description: "open: remaining above zero; settled: the rest. Absent lists both"
            type: string
        - description: Number of items per page (default 10, max 100)
          explode: false
          in: query
          name: limit
          schema:
            description: Number of items per page (default 10, max 100)
            type: string
        - description: Opaque cursor from a previous page
          explode: false
          in: query
          name: cursor
          schema:
            description: Opaque cursor from a previous page
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FeeDebtListBody"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: List the fee debts of a ledger, oldest first
      tags:
        - Fee Debts (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/list-the-fee-debts-of-a-ledger-oldest-first
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/fee-debts/collect:
    post:
      description: Settles the balance's open fee debts oldest first from its available funds, up to maxAmount and never more than it owes, in one transaction. It charges no new fee. Without an error, it collects nothing when the balance has no available funds or is blocked, cannot send, is closing or closed, deleted, debit-direction or external, and it stops at the first debt whose fee account is blocked, cannot receive, is closing or closed, deleted, debit-direction, external, in overdraft or of another asset. When nothing is settled the response is collected 0 and no transaction is created. With X-Idempotency a retry returns the first collection; an answer that settled nothing is not kept. Without it every call is a new collection. A collection transaction cannot be reverted.
      operationId: collectFeeDebtsV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Idempotency key to safely retry the collection; a retry returns the first collection (an answer that settled nothing is not kept), another request under the same key answers 409 (0084). Without it every call is a new collection.
          in: header
          name: X-Idempotency
          schema:
            description: Idempotency key to safely retry the collection; a retry returns the first collection (an answer that settled nothing is not kept), another request under the same key answers 409 (0084). Without it every call is a new collection.
            type: string
        - description: Idempotency slot TTL in seconds (default 300)
          in: header
          name: X-TTL
          schema:
            description: Idempotency slot TTL in seconds (default 300)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/FeeDebtCollectInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FeeDebtCollectOutput"
          description: OK
          headers:
            X-Idempotency-Replayed:
              schema:
                type: string
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Collect a balance's open fee debts
      tags:
        - Fee Debts (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/collect-a-balance-s-open-fee-debts
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/fee-debts/{fee_debt_id}:
    get:
      operationId: getFeeDebtV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Fee debt ID
          in: path
          name: fee_debt_id
          required: true
          schema:
            description: Fee debt ID
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FeeDebtView"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get a fee debt
      tags:
        - Fee Debts (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-a-fee-debt
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/holders/{holder_id}/accounts:
    post:
      operationId: createHolderAccountV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Holder ID (UUID)
          in: path
          name: holder_id
          required: true
          schema:
            description: Holder ID (UUID)
            type: string
        - description: Bearer token (forwarded to the composed account-create use case)
          in: header
          name: Authorization
          schema:
            description: Bearer token (forwarded to the composed account-create use case)
            type: string
        - description: Idempotency key to safely retry the composition; a retry with the same key returns the original response, a partial 201 with its instrumentError included, as first answered. Without it no idempotency slot is reserved
          in: header
          name: X-Idempotency
          schema:
            description: Idempotency key to safely retry the composition; a retry with the same key returns the original response, a partial 201 with its instrumentError included, as first answered. Without it no idempotency slot is reserved
            type: string
        - description: Idempotency slot TTL in seconds (default 300)
          in: header
          name: X-TTL
          schema:
            description: Idempotency slot TTL in seconds (default 300)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateHolderAccountInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HolderAccountResponse"
          description: Created
          headers:
            X-Idempotency-Replayed:
              schema:
                type: string
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Open a holder-owned account (with optional instrument)
      tags:
        - Composition (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-holder-account
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/operation-routes:
    get:
      operationId: listOperationRoutesV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Max items per page (default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (default 10)
            type: string
        - description: Filter created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
        - description: Opaque cursor token for pagination
          explode: false
          in: query
          name: cursor
          schema:
            description: Opaque cursor token for pagination
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Retrieve all operation routes
      tags:
        - Operation Routes (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/list-operation-routes
    post:
      operationId: createOperationRouteV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateOperationRouteInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OperationRoute"
          description: Created
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create Operation Route
      tags:
        - Operation Routes (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-operation-route
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/operation-routes/{operation_route_id}:
    delete:
      operationId: deleteOperationRouteV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Operation Route ID (UUID)
          in: path
          name: operation_route_id
          required: true
          schema:
            description: Operation Route ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete an operation route
      tags:
        - Operation Routes (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/delete-operation-route
    get:
      operationId: getOperationRouteByIDV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Operation Route ID (UUID)
          in: path
          name: operation_route_id
          required: true
          schema:
            description: Operation Route ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OperationRoute"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Retrieve a specific operation route
      tags:
        - Operation Routes (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-operation-route-by-id
    patch:
      description: "Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null also leaves the stored metadata as it is, so keys are deleted one at a time."
      operationId: updateOperationRouteV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Operation Route ID (UUID)
          in: path
          name: operation_route_id
          required: true
          schema:
            description: Operation Route ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateOperationRouteInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OperationRoute"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Update an operation route
      tags:
        - Operation Routes (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/update-operation-route
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/packages:
    get:
      operationId: getAllPackagesV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Filter by segment ID (UUID)
          explode: false
          in: query
          name: segmentId
          schema:
            description: Filter by segment ID (UUID)
            type: string
        - description: Filter by transaction route
          explode: false
          in: query
          name: transactionRoute
          schema:
            description: Filter by transaction route
            type: string
        - description: Filter by enabled flag (true, false)
          explode: false
          in: query
          name: enable
          schema:
            description: Filter by enabled flag (true, false)
            type: string
        - description: Number of items per page (default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Number of items per page (default 10)
            type: string
        - description: Page number (default 1)
          explode: false
          in: query
          name: page
          schema:
            description: Page number (default 1)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FeePagination"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get all packages of a ledger
      tags:
        - Packages (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-all-packages
    post:
      operationId: createPackageV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/FeeCreatePackageInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FeePackage"
          description: Created
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a Package
      tags:
        - Packages (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-package
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/packages/{package_id}:
    delete:
      description: A deleted package may keep applying for up to 60 seconds when a transaction read the packages concurrently with the delete.
      operationId: deletePackageV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Package ID (UUID)
          in: path
          name: package_id
          required: true
          schema:
            description: Package ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: SoftDelete a Package by ID
      tags:
        - Packages (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/delete-package
    get:
      operationId: getPackageByIDV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Package ID (UUID)
          in: path
          name: package_id
          required: true
          schema:
            description: Package ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FeePackage"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get package
      tags:
        - Packages (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-package-by-id
    patch:
      description: "A package switched off (enable: false) may keep applying, a package whose rounding changed may keep charging the previous one, and a fee whose deferrable changed to false may still open fee debt when unfunded, for up to 60 seconds when a transaction read the packages concurrently with the update. Closing an account is permanent. To retire a fee account, point the fee package at the new fee account and leave the old account open: reverts of earlier transactions and collections of fee debt already owed to it still post there."
      operationId: updatePackageV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Package ID (UUID)
          in: path
          name: package_id
          required: true
          schema:
            description: Package ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/FeeUpdatePackageInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FeePackage"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Update a package
      tags:
        - Packages (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/update-package
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/portfolios:
    get:
      operationId: listPortfoliosV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: JSON string to filter portfolios by metadata fields
          explode: false
          in: query
          name: metadata
          schema:
            description: JSON string to filter portfolios by metadata fields
            type: string
        - description: Filter portfolios by entity ID
          explode: false
          in: query
          name: entity_id
          schema:
            description: Filter portfolios by entity ID
            type: string
        - description: Filter portfolios by status
          explode: false
          in: query
          name: status
          schema:
            description: Filter portfolios by status
            type: string
        - description: Max items per page (1-100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (1-100, default 10)
            type: string
        - description: Page number (default 1)
          explode: false
          in: query
          name: page
          schema:
            description: Page number (default 1)
            type: string
        - description: Filter portfolios created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter portfolios created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter portfolios created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter portfolios created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: List all portfolios
      tags:
        - Portfolios (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/list-portfolios
    post:
      operationId: createPortfolioV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreatePortfolioInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Portfolio"
          description: Created
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a new portfolio
      tags:
        - Portfolios (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-portfolio
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/portfolios/{portfolio_id}:
    delete:
      operationId: deletePortfolioV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Portfolio ID (UUID)
          in: path
          name: portfolio_id
          required: true
          schema:
            description: Portfolio ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete a portfolio
      tags:
        - Portfolios (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/delete-portfolio
    get:
      operationId: getPortfolioByIDV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Portfolio ID (UUID)
          in: path
          name: portfolio_id
          required: true
          schema:
            description: Portfolio ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Portfolio"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Retrieve a specific portfolio
      tags:
        - Portfolios (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-portfolio-by-id
    patch:
      description: "Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null also leaves the stored metadata as it is, so keys are deleted one at a time."
      operationId: updatePortfolioV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Portfolio ID (UUID)
          in: path
          name: portfolio_id
          required: true
          schema:
            description: Portfolio ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdatePortfolioInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Portfolio"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Update a portfolio
      tags:
        - Portfolios (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/update-portfolio
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/segments:
    get:
      operationId: listSegmentsV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: JSON string to filter segments by metadata fields
          explode: false
          in: query
          name: metadata
          schema:
            description: JSON string to filter segments by metadata fields
            type: string
        - description: Max items per page (1-100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (1-100, default 10)
            type: string
        - description: Page number (default 1)
          explode: false
          in: query
          name: page
          schema:
            description: Page number (default 1)
            type: string
        - description: Filter segments created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter segments created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter segments created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter segments created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: List all segments
      tags:
        - Segments (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/list-segments
    post:
      operationId: createSegmentV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateSegmentInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Segment"
          description: Created
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a new segment
      tags:
        - Segments (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-segment
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/segments/{segment_id}:
    delete:
      operationId: deleteSegmentV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Segment ID (UUID)
          in: path
          name: segment_id
          required: true
          schema:
            description: Segment ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete a segment
      tags:
        - Segments (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/delete-segment
    get:
      operationId: getSegmentByIDV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Segment ID (UUID)
          in: path
          name: segment_id
          required: true
          schema:
            description: Segment ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Segment"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Retrieve a specific segment
      tags:
        - Segments (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-segment-by-id
    patch:
      description: "Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null also leaves the stored metadata as it is, so keys are deleted one at a time."
      operationId: updateSegmentV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Segment ID (UUID)
          in: path
          name: segment_id
          required: true
          schema:
            description: Segment ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateSegmentInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Segment"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Update a segment
      tags:
        - Segments (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/update-segment
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/settings:
    get:
      operationId: getLedgerSettingsV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LedgerSettings"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get ledger settings
      tags:
        - Ledgers (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-ledger-settings
    patch:
      operationId: updateLedgerSettingsV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: {}
              type: object
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LedgerSettings"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Update ledger settings
      tags:
        - Ledgers (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/update-ledger-settings
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/transaction-routes:
    get:
      operationId: listTransactionRoutesV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Max items per page (default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (default 10)
            type: string
        - description: Filter created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
        - description: Opaque cursor token for pagination
          explode: false
          in: query
          name: cursor
          schema:
            description: Opaque cursor token for pagination
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get all Transaction Routes
      tags:
        - Transaction Routes (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/list-transaction-routes
    post:
      operationId: createTransactionRouteV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTransactionRouteInputV2"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TransactionRouteV2"
          description: Created
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create Transaction Route
      tags:
        - Transaction Routes (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-transaction-route
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/transaction-routes/{transaction_route_id}:
    delete:
      operationId: deleteTransactionRouteV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Transaction Route ID (UUID)
          in: path
          name: transaction_route_id
          required: true
          schema:
            description: Transaction Route ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete Transaction Route by ID
      tags:
        - Transaction Routes (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/delete-transaction-route
    get:
      operationId: getTransactionRouteByIDV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Transaction Route ID (UUID)
          in: path
          name: transaction_route_id
          required: true
          schema:
            description: Transaction Route ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TransactionRouteV2"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get Transaction Route by ID
      tags:
        - Transaction Routes (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-transaction-route-by-id
    patch:
      description: "Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null also leaves the stored metadata as it is, so keys are deleted one at a time. operationRoutes (required links) and optionalOperationRoutes (links a transaction may leave unused) are each applied as a JSON merge patch: an absent or null list keeps the stored links, a present list replaces them and an empty list removes them. The resulting links are validated as a create: a route in both lists, fewer than two links, or no required source or destination is refused."
      operationId: updateTransactionRouteV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Transaction Route ID (UUID)
          in: path
          name: transaction_route_id
          required: true
          schema:
            description: Transaction Route ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateTransactionRouteInputV2"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TransactionRouteV2"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Update Transaction Route
      tags:
        - Transaction Routes (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/update-transaction-route
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/transactions:
    get:
      operationId: getAllTransactionsV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: JSON string to filter transactions by metadata fields
          explode: false
          in: query
          name: metadata
          schema:
            description: JSON string to filter transactions by metadata fields
            type: string
        - description: Max items per page (1-100, default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (1-100, default 10)
            type: string
        - description: Filter transactions created on/after this date
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter transactions created on/after this date
            type: string
        - description: Filter transactions created on/before this date
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter transactions created on/before this date
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
        - description: Pagination cursor
          explode: false
          in: query
          name: cursor
          schema:
            description: Pagination cursor
            type: string
        - description: Filter transactions by atomic cross-ledger group UUID
          explode: false
          in: query
          name: groupId
          schema:
            description: Filter transactions by atomic cross-ledger group UUID
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TransactionV2ListBody"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get all Transactions
      tags:
        - Transactions (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-all-transactions
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/transactions/{transaction_id}:
    get:
      operationId: getTransactionV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Transaction ID (UUID)
          in: path
          name: transaction_id
          required: true
          schema:
            description: Transaction ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TransactionV2"
          description: OK
          headers:
            X-Cache-Hit:
              schema:
                type: string
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get a Transaction by ID
      tags:
        - Transactions (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-transaction
    patch:
      description: "Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null also leaves the stored metadata as it is, so keys are deleted one at a time."
      operationId: updateTransactionV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Transaction ID (UUID)
          in: path
          name: transaction_id
          required: true
          schema:
            description: Transaction ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TransactionUpdateTransactionInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TransactionV2"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Update a Transaction
      tags:
        - Transactions (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/update-transaction
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/transactions/{transaction_id}/cancel:
    post:
      operationId: cancelTransactionV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Transaction ID (UUID)
          in: path
          name: transaction_id
          required: true
          schema:
            description: Transaction ID (UUID)
            type: string
      responses:
        "201":
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: "#/components/schemas/TransactionV2"
                  - $ref: "#/components/schemas/CrossLedgerTransactionGroupV2"
          description: Created
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Cancel a pending Transaction (v2)
      tags:
        - Transactions (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/cancel-transaction
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/transactions/{transaction_id}/commit:
    post:
      operationId: commitTransactionV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Transaction ID (UUID)
          in: path
          name: transaction_id
          required: true
          schema:
            description: Transaction ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/LifecycleV2Input"
      responses:
        "201":
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: "#/components/schemas/TransactionV2"
                  - $ref: "#/components/schemas/CrossLedgerTransactionGroupV2"
          description: Created
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Commit a Transaction (v2)
      tags:
        - Transactions (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/commit-transaction
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/transactions/{transaction_id}/operations/{operation_id}:
    patch:
      description: "Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null also leaves the stored metadata as it is, so keys are deleted one at a time."
      operationId: updateOperationV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Transaction ID (UUID)
          in: path
          name: transaction_id
          required: true
          schema:
            description: Transaction ID (UUID)
            type: string
        - description: Operation ID (UUID)
          in: path
          name: operation_id
          required: true
          schema:
            description: Operation ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/OperationUpdateOperationInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Operation"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Update an Operation
      tags:
        - Operations (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/update-operation
  /v2/organizations/{organization_id}/ledgers/{ledger_id}/transactions/{transaction_id}/revert:
    post:
      description: A revert whose pending fees have not finished being recorded is refused with 409 (0529); nothing moves, and a later retry may succeed.
      operationId: revertTransactionV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Ledger ID (UUID)
          in: path
          name: ledger_id
          required: true
          schema:
            description: Ledger ID (UUID)
            type: string
        - description: Transaction ID (UUID)
          in: path
          name: transaction_id
          required: true
          schema:
            description: Transaction ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/LifecycleV2Input"
      responses:
        "201":
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: "#/components/schemas/TransactionV2"
                  - $ref: "#/components/schemas/CrossLedgerTransactionGroupV2"
          description: Created
          headers:
            X-Idempotency-Replayed:
              schema:
                type: string
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Revert a Transaction (v2)
      tags:
        - Transactions (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/revert-transaction
  /v2/organizations/{organization_id}/operation-routes:
    get:
      description: Lists every operation route of the organization, whichever ledger it was created under, including routes created at organization level.
      operationId: listOrganizationOperationRoutesV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Max items per page (default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (default 10)
            type: string
        - description: Filter created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
        - description: Opaque cursor token for pagination
          explode: false
          in: query
          name: cursor
          schema:
            description: Opaque cursor token for pagination
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: List the organization Operation Routes
      tags:
        - Operation Routes (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/list-organization-operation-routes
    post:
      description: Creates an operation route that belongs to the organization and validates in every ledger of it. The route has no ledgerId.
      operationId: createOrganizationOperationRouteV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateOperationRouteInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OperationRoute"
          description: Created
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create an organization Operation Route
      tags:
        - Operation Routes (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-organization-operation-route
  /v2/organizations/{organization_id}/operation-routes/{operation_route_id}:
    delete:
      operationId: deleteOrganizationOperationRouteV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Operation Route ID (UUID)
          in: path
          name: operation_route_id
          required: true
          schema:
            description: Operation Route ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete an organization Operation Route by ID
      tags:
        - Operation Routes (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/delete-organization-operation-route
    get:
      operationId: getOrganizationOperationRouteByIDV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Operation Route ID (UUID)
          in: path
          name: operation_route_id
          required: true
          schema:
            description: Operation Route ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OperationRoute"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get an organization Operation Route by ID
      tags:
        - Operation Routes (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-organization-operation-route-by-id
    patch:
      description: "Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null also leaves the stored metadata as it is, so keys are deleted one at a time."
      operationId: updateOrganizationOperationRouteV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Operation Route ID (UUID)
          in: path
          name: operation_route_id
          required: true
          schema:
            description: Operation Route ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateOperationRouteInput"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OperationRoute"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Update an organization Operation Route
      tags:
        - Operation Routes (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/update-organization-operation-route
  /v2/organizations/{organization_id}/protection/audit:
    get:
      operationId: getAuditEventsV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Bearer token; only required when the auth plugin is enabled
          in: header
          name: Authorization
          schema:
            description: Bearer token; only required when the auth plugin is enabled
            type: string
        - description: Maximum number of events to return (default 20)
          explode: false
          in: query
          name: limit
          schema:
            description: Maximum number of events to return (default 20)
            type: string
        - description: Opaque pagination cursor
          explode: false
          in: query
          name: cursor
          schema:
            description: Opaque pagination cursor
            type: string
        - description: "Sort order: asc or desc (default desc)"
          explode: false
          in: query
          name: sort_order
          schema:
            description: "Sort order: asc or desc (default desc)"
            type: string
        - description: Filter by action
          explode: false
          in: query
          name: action
          schema:
            description: Filter by action
            type: string
        - description: Filter by actor
          explode: false
          in: query
          name: actor
          schema:
            description: Filter by actor
            type: string
        - description: "Filter by outcome: success, failure, or already_exists"
          explode: false
          in: query
          name: outcome
          schema:
            description: "Filter by outcome: success, failure, or already_exists"
            type: string
        - description: Inclusive lower time bound (yyyy-mm-dd or RFC3339)
          explode: false
          in: query
          name: start_date
          schema:
            description: Inclusive lower time bound (yyyy-mm-dd or RFC3339)
            type: string
        - description: Inclusive upper time bound (yyyy-mm-dd or RFC3339)
          explode: false
          in: query
          name: end_date
          schema:
            description: Inclusive upper time bound (yyyy-mm-dd or RFC3339)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AuditEventsEnvelope"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: List Protection Audit Events
      tags:
        - Protection (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-audit-events
  /v2/organizations/{organization_id}/transaction-routes:
    get:
      description: Lists every transaction route of the organization, whichever ledger it was created under, including routes created at organization level.
      operationId: listOrganizationTransactionRoutesV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Max items per page (default 10)
          explode: false
          in: query
          name: limit
          schema:
            description: Max items per page (default 10)
            type: string
        - description: Filter created on/after this date (YYYY-MM-DD)
          explode: false
          in: query
          name: start_date
          schema:
            description: Filter created on/after this date (YYYY-MM-DD)
            type: string
        - description: Filter created on/before this date (YYYY-MM-DD)
          explode: false
          in: query
          name: end_date
          schema:
            description: Filter created on/before this date (YYYY-MM-DD)
            type: string
        - description: Sort direction (asc, desc)
          explode: false
          in: query
          name: sort_order
          schema:
            description: Sort direction (asc, desc)
            type: string
        - description: Opaque cursor token for pagination
          explode: false
          in: query
          name: cursor
          schema:
            description: Opaque cursor token for pagination
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pagination"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: List the organization Transaction Routes
      tags:
        - Transaction Routes (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/list-organization-transaction-routes
    post:
      description: Creates a transaction route that belongs to the organization and validates in every ledger of it. The route has no ledgerId.
      operationId: createOrganizationTransactionRouteV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTransactionRouteInputV2"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TransactionRouteV2"
          description: Created
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create an organization Transaction Route
      tags:
        - Transaction Routes (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-organization-transaction-route
  /v2/organizations/{organization_id}/transaction-routes/{transaction_route_id}:
    delete:
      operationId: deleteOrganizationTransactionRouteV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Transaction Route ID (UUID)
          in: path
          name: transaction_route_id
          required: true
          schema:
            description: Transaction Route ID (UUID)
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete an organization Transaction Route by ID
      tags:
        - Transaction Routes (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/delete-organization-transaction-route
    get:
      operationId: getOrganizationTransactionRouteByIDV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Transaction Route ID (UUID)
          in: path
          name: transaction_route_id
          required: true
          schema:
            description: Transaction Route ID (UUID)
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TransactionRouteV2"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get an organization Transaction Route by ID
      tags:
        - Transaction Routes (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-organization-transaction-route-by-id
    patch:
      description: "Metadata is applied as an RFC 7396 merge patch: a body without metadata, or with an empty metadata object, leaves the stored metadata as it is; a key sent as null is deleted; any other key is added or replaced; metadata sent as null also leaves the stored metadata as it is, so keys are deleted one at a time. operationRoutes (required links) and optionalOperationRoutes (links a transaction may leave unused) are each applied as a JSON merge patch: an absent or null list keeps the stored links, a present list replaces them and an empty list removes them. The resulting links are validated as a create: a route in both lists, fewer than two links, or no required source or destination is refused."
      operationId: updateOrganizationTransactionRouteV2
      parameters:
        - description: Organization ID (UUID)
          in: path
          name: organization_id
          required: true
          schema:
            description: Organization ID (UUID)
            type: string
        - description: Transaction Route ID (UUID)
          in: path
          name: transaction_route_id
          required: true
          schema:
            description: Transaction Route ID (UUID)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateTransactionRouteInputV2"
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TransactionRouteV2"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Update an organization Transaction Route
      tags:
        - Transaction Routes (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/update-organization-transaction-route
  /v2/settings/metadata-indexes:
    get:
      operationId: getAllMetadataIndexesV2
      parameters:
        - description: Optional entity name filter
          explode: false
          in: query
          name: entity_name
          schema:
            description: Optional entity name filter
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  $ref: "#/components/schemas/MetadataIndex"
                type:
                  - array
                  - "null"
          description: OK
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Get all Metadata Indexes
      tags:
        - Metadata Indexes (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/get-all-metadata-indexes
  /v2/settings/metadata-indexes/entities/{entity_name}:
    post:
      operationId: createMetadataIndexV2
      parameters:
        - description: Entity name (organization, ledger, segment, account, portfolio, asset, account_type, transaction, operation, operation_route, transaction_route)
          in: path
          name: entity_name
          required: true
          schema:
            description: Entity name (organization, ledger, segment, account, portfolio, asset, account_type, transaction, operation, operation_route, transaction_route)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateMetadataIndexInput"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MetadataIndex"
          description: Created
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create Metadata Index
      tags:
        - Metadata Indexes (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-metadata-index
  /v2/settings/metadata-indexes/entities/{entity_name}/key/{index_key}:
    delete:
      operationId: deleteMetadataIndexV2
      parameters:
        - description: Entity name (organization, ledger, segment, account, portfolio, asset, account_type, transaction, operation, operation_route, transaction_route)
          in: path
          name: entity_name
          required: true
          schema:
            description: Entity name (organization, ledger, segment, account, portfolio, asset, account_type, transaction, operation, operation_route, transaction_route)
            type: string
        - description: Index key (metadata key, e.g. 'tier')
          in: path
          name: index_key
          required: true
          schema:
            description: Index key (metadata key, e.g. 'tier')
            type: string
      responses:
        "204":
          description: No Content
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Delete Metadata Index
      tags:
        - Metadata Indexes (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/delete-metadata-index
  /v2/transactions/batch:
    post:
      description: Executes direct and hold transactions once, in explicit increasing order, as one all-or-none accounting decision. The response preserves that order. The decoded body must be smaller than 1 MiB; the configured cardinality is 1-50, aggregate input legs are limited to 1,000, and post-fee work is limited to 100 postings and 150 balance snapshots. The internal idempotency/recovery batch identifier is not exposed; there is no batch query endpoint.
      operationId: createAtomicTransactionBatchV2
      parameters:
        - description: Idempotency key to safely retry the atomic batch; an identical retry returns the original ordered response
          in: header
          name: X-Idempotency
          schema:
            description: Idempotency key to safely retry the atomic batch; an identical retry returns the original ordered response
            type: string
        - description: Idempotency slot TTL in seconds (default 300)
          in: header
          name: X-TTL
          schema:
            description: Idempotency slot TTL in seconds (default 300)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateAtomicTransactionBatchV2Request"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateAtomicTransactionBatchV2Response"
          description: Created
          headers:
            X-Idempotency-Replayed:
              schema:
                type: string
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create an atomic batch of Transactions (v2)
      tags:
        - Transactions (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-transaction-batch
  /v2/transactions/block:
    post:
      operationId: createTransactionBlockV2
      parameters:
        - description: Idempotency key to safely retry the create; an identical retry returns the original transaction, a different request under the same key answers 409 (0084)
          in: header
          name: X-Idempotency
          schema:
            description: Idempotency key to safely retry the create; an identical retry returns the original transaction, a different request under the same key answers 409 (0084)
            type: string
        - description: Idempotency slot TTL in seconds (default 300)
          in: header
          name: X-TTL
          schema:
            description: Idempotency slot TTL in seconds (default 300)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTransactionV2Input"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TransactionV2"
          description: Created
          headers:
            X-Idempotency-Replayed:
              schema:
                type: string
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a Transaction using the v2 block model
      tags:
        - Transactions (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-transaction-block
  /v2/transactions/direct:
    post:
      operationId: createTransactionDirectV2
      parameters:
        - description: Idempotency key to safely retry the create; an identical retry returns the original transaction, a different request under the same key answers 409 (0084)
          in: header
          name: X-Idempotency
          schema:
            description: Idempotency key to safely retry the create; an identical retry returns the original transaction, a different request under the same key answers 409 (0084)
            type: string
        - description: Idempotency slot TTL in seconds (default 300)
          in: header
          name: X-TTL
          schema:
            description: Idempotency slot TTL in seconds (default 300)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTransactionV2Input"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: "#/components/schemas/CreatedTransactionV2"
                  - $ref: "#/components/schemas/CrossLedgerTransactionGroupV2"
          description: Created
          headers:
            X-Idempotency-Replayed:
              schema:
                type: string
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a Transaction using the v2 direct model
      tags:
        - Transactions (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-transaction-direct
  /v2/transactions/hold:
    post:
      operationId: createTransactionHoldV2
      parameters:
        - description: Idempotency key to safely retry the create; an identical retry returns the original transaction, a different request under the same key answers 409 (0084)
          in: header
          name: X-Idempotency
          schema:
            description: Idempotency key to safely retry the create; an identical retry returns the original transaction, a different request under the same key answers 409 (0084)
            type: string
        - description: Idempotency slot TTL in seconds (default 300)
          in: header
          name: X-TTL
          schema:
            description: Idempotency slot TTL in seconds (default 300)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTransactionV2Input"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: "#/components/schemas/CreatedTransactionV2"
                  - $ref: "#/components/schemas/CrossLedgerTransactionGroupV2"
          description: Created
          headers:
            X-Idempotency-Replayed:
              schema:
                type: string
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a Transaction using the v2 hold model
      tags:
        - Transactions (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-transaction-hold
  /v2/transactions/unblock:
    post:
      operationId: createTransactionUnblockV2
      parameters:
        - description: Idempotency key to safely retry the create; an identical retry returns the original transaction, a different request under the same key answers 409 (0084)
          in: header
          name: X-Idempotency
          schema:
            description: Idempotency key to safely retry the create; an identical retry returns the original transaction, a different request under the same key answers 409 (0084)
            type: string
        - description: Idempotency slot TTL in seconds (default 300)
          in: header
          name: X-TTL
          schema:
            description: Idempotency slot TTL in seconds (default 300)
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTransactionV2Input"
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TransactionV2"
          description: Created
          headers:
            X-Idempotency-Replayed:
              schema:
                type: string
        "422":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Unprocessable Entity
        "500":
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Internal Server Error
        default:
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Error"
          description: Error
      security:
        - BearerAuth: []
      summary: Create a Transaction using the v2 unblock model
      tags:
        - Transactions (v2)
      x-mint:
        href: /pt/reference/products/midaz/v2/create-transaction-unblock
servers:
  - url: https://ledger.sandbox.lerian.net
tags:
  - name: Account Block Exceptions (v2)
  - name: Account Plan Assignments (v2)
  - name: Account Plans (v2)
  - name: Account Types (v1)
  - name: Account Types (v2)
  - name: Accounts (v1)
  - name: Accounts (v2)
  - name: Asset Rates (v1)
  - name: Assets (v1)
  - name: Assets (v2)
  - name: Balances (v1)
  - name: Balances (v2)
  - name: Billing Calculate (v2)
  - name: Billing Packages (v2)
  - name: Composition (v2)
  - name: Dashboard (v1)
  - name: Dashboard (v2)
  - name: Encryption (v2)
  - name: Fee Charges (v2)
  - name: Fee Debts (v2)
  - name: Fees (v2)
  - name: Holders (v2)
  - name: Instruments (v2)
  - name: Ledgers (v1)
  - name: Ledgers (v2)
  - name: Metadata Indexes (v1)
  - name: Metadata Indexes (v2)
  - name: Operation Routes (v1)
  - name: Operation Routes (v2)
  - name: Operations (v1)
  - name: Operations (v2)
  - name: Organizations (v1)
  - name: Organizations (v2)
  - name: Packages (v2)
  - name: Portfolios (v1)
  - name: Portfolios (v2)
  - name: Protection (v2)
  - name: Segments (v1)
  - name: Segments (v2)
  - name: Transaction Routes (v1)
  - name: Transaction Routes (v2)
  - name: Transactions (v1)
  - name: Transactions (v2)
x-tagGroups:
  - name: V1 (deprecated)
    tags:
      - Account Types (v1)
      - Accounts (v1)
      - Asset Rates (v1)
      - Assets (v1)
      - Balances (v1)
      - Dashboard (v1)
      - Ledgers (v1)
      - Metadata Indexes (v1)
      - Operation Routes (v1)
      - Operations (v1)
      - Organizations (v1)
      - Portfolios (v1)
      - Segments (v1)
      - Transaction Routes (v1)
      - Transactions (v1)
  - name: V2
    tags:
      - Account Block Exceptions (v2)
      - Account Plan Assignments (v2)
      - Account Plans (v2)
      - Account Types (v2)
      - Accounts (v2)
      - Assets (v2)
      - Balances (v2)
      - Billing Calculate (v2)
      - Billing Packages (v2)
      - Composition (v2)
      - Dashboard (v2)
      - Encryption (v2)
      - Fee Charges (v2)
      - Fee Debts (v2)
      - Fees (v2)
      - Holders (v2)
      - Instruments (v2)
      - Ledgers (v2)
      - Metadata Indexes (v2)
      - Operation Routes (v2)
      - Operations (v2)
      - Organizations (v2)
      - Packages (v2)
      - Portfolios (v2)
      - Protection (v2)
      - Segments (v2)
      - Transaction Routes (v2)
      - Transactions (v2)
