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

# Update a loan

> Updates a loan. Only the fields you include are changed. The request shape depends on `loan_type`.



## OpenAPI

````yaml patch /v1/businesses/{businessId}/loans/{loanId}
openapi: 3.0.1
info:
  title: API
  version: latest
servers: []
security:
  - BearerAuth: []
tags: []
externalDocs:
  url: /
paths:
  /v1/businesses/{businessId}/loans/{loanId}:
    patch:
      tags: []
      summary: Update a loan
      description: >-
        Updates a loan. Only the fields you include are changed. The request
        shape depends on `loan_type`.
      operationId: business.loans.loanId.patch
      parameters:
        - name: businessId
          in: path
          description: The UUID of the business.
          required: true
          schema:
            type: string
            format: uuid
        - name: loanId
          in: path
          required: true
          description: The UUID of the loan.
          schema:
            type: string
            format: uuid
      requestBody:
        description: The loan fields to update.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchLoanParams'
      responses:
        '200':
          description: The updated loan.
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/ApiLoan'
components:
  schemas:
    PatchLoanParams:
      description: Parameters for updating a loan. The shape depends on `loan_type`.
      oneOf:
        - $ref: '#/components/schemas/PatchTermLoanParams'
        - $ref: '#/components/schemas/PatchMcaLoanParams'
        - $ref: '#/components/schemas/PatchFlexLoanParams'
        - $ref: '#/components/schemas/PatchLineOfCreditLoanParams'
        - $ref: '#/components/schemas/PatchLeaseLoanParams'
        - $ref: '#/components/schemas/PatchEquipmentFinancingLoanParams'
      discriminator:
        propertyName: loan_type
        mapping:
          TERM_LOAN:
            $ref: '#/components/schemas/PatchTermLoanParams'
          MCA:
            $ref: '#/components/schemas/PatchMcaLoanParams'
          FLEX_LOAN:
            $ref: '#/components/schemas/PatchFlexLoanParams'
          LINE_OF_CREDIT:
            $ref: '#/components/schemas/PatchLineOfCreditLoanParams'
          LEASE:
            $ref: '#/components/schemas/PatchLeaseLoanParams'
          EQUIPMENT_FINANCING:
            $ref: '#/components/schemas/PatchEquipmentFinancingLoanParams'
    ApiLoan:
      type: object
      description: >-
        A loan held by a business. Each loan has a dedicated child ledger
        (liability) account.
      required:
        - id
        - business_id
        - display_name
        - loan_type
        - loan_account
        - current_balance
        - origination_date
        - transaction_tags
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the loan.
        business_id:
          type: string
          format: uuid
          description: ID of the business that holds the loan.
        external_id:
          type: string
          nullable: true
          description: Unique ID of the loan in your system for linking purposes.
        display_name:
          type: string
          description: Human-friendly name for the loan.
        loan_type:
          $ref: '#/components/schemas/LoanType'
        loan_account:
          allOf:
            - $ref: '#/components/schemas/SingleApiChartAccount'
          description: The dedicated ledger (liability) account for this loan.
        current_balance:
          type: integer
          format: int64
          description: Current outstanding balance of the loan, in cents.
        opening_balance:
          allOf:
            - $ref: '#/components/schemas/ApiLoanOpeningBalance'
          nullable: true
          description: The loan's active opening balance, if one has been set.
        origination_date:
          type: string
          format: date
          description: Date the loan was originated.
        original_principal:
          type: integer
          format: int64
          nullable: true
          description: >-
            Original principal, in cents. Present for `TERM_LOAN`, `MCA`,
            `LEASE`, and `EQUIPMENT_FINANCING`.
        credit_limit:
          type: integer
          format: int64
          nullable: true
          description: Credit limit, in cents. Present for `LINE_OF_CREDIT`.
        fee_percentage:
          type: string
          nullable: true
          description: >-
            Fixed fee, expressed as a percentage in a decimal string (for
            example, `"15"` for a 15% fee). Present for `MCA` and `FLEX_LOAN`.
        loan_term_months:
          type: integer
          format: int32
          nullable: true
          description: >-
            Loan term in months. Present for `TERM_LOAN`, `LEASE`, and
            `EQUIPMENT_FINANCING`.
        completed_at:
          type: string
          format: date-time
          description: When the loan was fully repaid, if applicable.
          nullable: true
        cancelled_at:
          type: string
          format: date-time
          description: When the loan was cancelled, if applicable.
          nullable: true
        archived_at:
          type: string
          format: date-time
          description: When the loan was archived, if applicable.
          nullable: true
        memo:
          type: string
          nullable: true
          description: Internal note about the loan.
        metadata:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            Arbitrary JSON object you can attach for your own use. Layer stores
            and returns it unchanged.
        reference_number:
          type: string
          nullable: true
          description: Reference number for the loan.
        transaction_tags:
          type: array
          items:
            $ref: '#/components/schemas/ApiTag'
          description: Tags applied to this record.
    PatchTermLoanParams:
      type: object
      required:
        - loan_type
      properties:
        loan_type:
          type: string
          enum:
            - TERM_LOAN
          description: Discriminator. Must be `TERM_LOAN`.
        display_name:
          type: string
          description: Updated display name for the loan.
        origination_date:
          type: string
          format: date
          description: Updated origination date.
        original_principal:
          type: integer
          format: int64
          description: Updated original principal, in cents.
        loan_term_months:
          type: integer
          format: int32
          nullable: true
          description: Updated term, in months.
        proceeds:
          type: array
          items:
            $ref: '#/components/schemas/CreateLoanProceedParams'
          description: Replaces the loan's proceeds with this list.
        opening_balance:
          allOf:
            - $ref: '#/components/schemas/CreateLoanOpeningBalanceParams'
          nullable: true
          description: >-
            Sets or replaces the loan's opening balance. Pass `null` explicitly
            to remove it (the opening balance ledger entry is reversed). Omit to
            leave it unchanged. Mutually exclusive with `reported_balance`.
        reported_balance:
          allOf:
            - $ref: '#/components/schemas/ReportedLoanBalanceParams'
          nullable: true
          description: >-
            Asserts the loan's outstanding principal at a point in time; Layer
            derives the opening balance from it and recorded history.
            Recommended when creating a loan that is already partially repaid.
            Mutually exclusive with `opening_balance`. Omitting the field and
            passing `null` are equivalent: no assertion is made and any existing
            opening balance is left unchanged.
        memo:
          type: string
          nullable: true
          description: Updated internal note.
        metadata:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            Arbitrary JSON object you can attach for your own use. Layer stores
            and returns it unchanged.
        reference_number:
          type: string
          nullable: true
          description: Updated reference number.
      description: Only include the fields you want to change.
      title: Term loan
    PatchMcaLoanParams:
      type: object
      required:
        - loan_type
      properties:
        loan_type:
          type: string
          enum:
            - MCA
          description: Discriminator. Must be `MCA`.
        display_name:
          type: string
          description: Updated display name for the loan.
        origination_date:
          type: string
          format: date
          description: Updated origination date.
        original_principal:
          type: integer
          format: int64
          description: Updated original principal, in cents.
        fee_percentage:
          type: string
          description: >-
            Updated MCA fee, expressed as a percentage in a decimal string (for
            example, `"15"` for 15%).
        proceeds:
          type: array
          items:
            $ref: '#/components/schemas/CreateLoanProceedParams'
          description: Replaces the loan's proceeds with this list.
        opening_balance:
          allOf:
            - $ref: '#/components/schemas/CreateLoanOpeningBalanceParams'
          nullable: true
          description: >-
            Sets or replaces the loan's opening balance. Pass `null` explicitly
            to remove it (the opening balance ledger entry is reversed). Omit to
            leave it unchanged. Mutually exclusive with `reported_balance`.
        reported_balance:
          allOf:
            - $ref: '#/components/schemas/ReportedLoanBalanceParams'
          nullable: true
          description: >-
            Asserts the loan's outstanding principal at a point in time; Layer
            derives the opening balance from it and recorded history.
            Recommended when creating a loan that is already partially repaid.
            Mutually exclusive with `opening_balance`. Omitting the field and
            passing `null` are equivalent: no assertion is made and any existing
            opening balance is left unchanged.
        memo:
          type: string
          nullable: true
          description: Updated internal note.
        metadata:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            Arbitrary JSON object you can attach for your own use. Layer stores
            and returns it unchanged.
        reference_number:
          type: string
          nullable: true
          description: Updated reference number.
      description: Only include the fields you want to change.
      title: Merchant cash advance
    PatchFlexLoanParams:
      type: object
      required:
        - loan_type
      properties:
        loan_type:
          type: string
          enum:
            - FLEX_LOAN
          description: Discriminator. Must be `FLEX_LOAN`.
        display_name:
          type: string
          description: Updated display name for the loan.
        origination_date:
          type: string
          format: date
          description: Updated origination date.
        original_principal:
          type: integer
          format: int64
          description: Updated original principal, in cents.
        fee_percentage:
          type: string
          description: Updated fee, expressed as a percentage in a decimal string.
        proceeds:
          type: array
          items:
            $ref: '#/components/schemas/CreateLoanProceedParams'
          description: Replaces the loan's proceeds with this list.
        opening_balance:
          allOf:
            - $ref: '#/components/schemas/CreateLoanOpeningBalanceParams'
          nullable: true
          description: >-
            Sets or replaces the loan's opening balance. Pass `null` explicitly
            to remove it (the opening balance ledger entry is reversed). Omit to
            leave it unchanged. Mutually exclusive with `reported_balance`.
        reported_balance:
          allOf:
            - $ref: '#/components/schemas/ReportedLoanBalanceParams'
          nullable: true
          description: >-
            Asserts the loan's outstanding principal at a point in time; Layer
            derives the opening balance from it and recorded history.
            Recommended when creating a loan that is already partially repaid.
            Mutually exclusive with `opening_balance`. Omitting the field and
            passing `null` are equivalent: no assertion is made and any existing
            opening balance is left unchanged.
        memo:
          type: string
          nullable: true
          description: Updated internal note.
        metadata:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            Arbitrary JSON object you can attach for your own use. Layer stores
            and returns it unchanged.
        reference_number:
          type: string
          nullable: true
          description: Updated reference number.
      description: Only include the fields you want to change.
      title: Flex loan
    PatchLineOfCreditLoanParams:
      type: object
      required:
        - loan_type
      properties:
        loan_type:
          type: string
          enum:
            - LINE_OF_CREDIT
          description: Discriminator. Must be `LINE_OF_CREDIT`.
        display_name:
          type: string
          description: Updated display name for the loan.
        origination_date:
          type: string
          format: date
          description: Updated origination date.
        credit_limit:
          type: integer
          format: int64
          description: Updated credit limit, in cents.
        proceeds:
          type: array
          items:
            $ref: '#/components/schemas/CreateLoanProceedParams'
          description: Replaces the loan's proceeds with this list.
        opening_balance:
          allOf:
            - $ref: '#/components/schemas/CreateLoanOpeningBalanceParams'
          nullable: true
          description: >-
            Sets or replaces the loan's opening balance. Pass `null` explicitly
            to remove it (the opening balance ledger entry is reversed). Omit to
            leave it unchanged. Mutually exclusive with `reported_balance`.
        reported_balance:
          allOf:
            - $ref: '#/components/schemas/ReportedLoanBalanceParams'
          nullable: true
          description: >-
            Asserts the loan's outstanding principal at a point in time; Layer
            derives the opening balance from it and recorded history.
            Recommended when creating a loan that is already partially repaid.
            Mutually exclusive with `opening_balance`. Omitting the field and
            passing `null` are equivalent: no assertion is made and any existing
            opening balance is left unchanged.
        memo:
          type: string
          nullable: true
          description: Updated internal note.
        metadata:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            Arbitrary JSON object you can attach for your own use. Layer stores
            and returns it unchanged.
        reference_number:
          type: string
          nullable: true
          description: Updated reference number.
      description: Only include the fields you want to change.
      title: Line of credit
    PatchLeaseLoanParams:
      type: object
      required:
        - loan_type
      properties:
        loan_type:
          type: string
          enum:
            - LEASE
          description: Discriminator. Must be `LEASE`.
        display_name:
          type: string
          description: Updated display name for the loan.
        origination_date:
          type: string
          format: date
          description: Updated origination date.
        original_principal:
          type: integer
          format: int64
          description: Updated original principal, in cents.
        loan_term_months:
          type: integer
          format: int32
          description: Updated term, in months.
        proceeds:
          type: array
          items:
            $ref: '#/components/schemas/CreateLoanProceedParams'
          description: Replaces the loan's proceeds with this list.
        opening_balance:
          allOf:
            - $ref: '#/components/schemas/CreateLoanOpeningBalanceParams'
          nullable: true
          description: >-
            Sets or replaces the loan's opening balance. Pass `null` explicitly
            to remove it (the opening balance ledger entry is reversed). Omit to
            leave it unchanged. Mutually exclusive with `reported_balance`.
        reported_balance:
          allOf:
            - $ref: '#/components/schemas/ReportedLoanBalanceParams'
          nullable: true
          description: >-
            Asserts the loan's outstanding principal at a point in time; Layer
            derives the opening balance from it and recorded history.
            Recommended when creating a loan that is already partially repaid.
            Mutually exclusive with `opening_balance`. Omitting the field and
            passing `null` are equivalent: no assertion is made and any existing
            opening balance is left unchanged.
        memo:
          type: string
          nullable: true
          description: Updated internal note.
        metadata:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            Arbitrary JSON object you can attach for your own use. Layer stores
            and returns it unchanged.
        reference_number:
          type: string
          nullable: true
          description: Updated reference number.
      description: Only include the fields you want to change.
      title: Lease
    PatchEquipmentFinancingLoanParams:
      type: object
      required:
        - loan_type
      properties:
        loan_type:
          type: string
          enum:
            - EQUIPMENT_FINANCING
          description: Discriminator. Must be `EQUIPMENT_FINANCING`.
        display_name:
          type: string
          description: Updated display name for the loan.
        origination_date:
          type: string
          format: date
          description: Updated origination date.
        original_principal:
          type: integer
          format: int64
          description: Updated original principal, in cents.
        loan_term_months:
          type: integer
          format: int32
          description: Updated term, in months.
        proceeds:
          type: array
          items:
            $ref: '#/components/schemas/CreateLoanProceedParams'
          description: Replaces the loan's proceeds with this list.
        opening_balance:
          allOf:
            - $ref: '#/components/schemas/CreateLoanOpeningBalanceParams'
          nullable: true
          description: >-
            Sets or replaces the loan's opening balance. Pass `null` explicitly
            to remove it (the opening balance ledger entry is reversed). Omit to
            leave it unchanged. Mutually exclusive with `reported_balance`.
        reported_balance:
          allOf:
            - $ref: '#/components/schemas/ReportedLoanBalanceParams'
          nullable: true
          description: >-
            Asserts the loan's outstanding principal at a point in time; Layer
            derives the opening balance from it and recorded history.
            Recommended when creating a loan that is already partially repaid.
            Mutually exclusive with `opening_balance`. Omitting the field and
            passing `null` are equivalent: no assertion is made and any existing
            opening balance is left unchanged.
        memo:
          type: string
          nullable: true
          description: Updated internal note.
        metadata:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            Arbitrary JSON object you can attach for your own use. Layer stores
            and returns it unchanged.
        reference_number:
          type: string
          nullable: true
          description: Updated reference number.
      description: Only include the fields you want to change.
      title: Equipment financing
    LoanType:
      type: string
      description: The type of loan.
      enum:
        - TERM_LOAN
        - MCA
        - FLEX_LOAN
        - LINE_OF_CREDIT
        - LEASE
        - EQUIPMENT_FINANCING
    SingleApiChartAccount:
      type: object
      properties:
        type:
          type: string
          description: Resource type. Value will be `Single_Chart_Account`.
          example: Single_Chart_Account
        id:
          $ref: '#/components/schemas/AccountIdentifier'
        name:
          type: string
          description: Name of the account.
          example: Current Assets
        account_number:
          type: string
          nullable: true
          description: Account number if configured.
          example: '4000'
        stable_name:
          $ref: '#/components/schemas/AccountStableName'
        normality:
          $ref: '#/components/schemas/BankTransactionDirection'
        account_type:
          $ref: '#/components/schemas/ApiLedgerAccountType'
        account_subtype:
          $ref: '#/components/schemas/ApiLedgerAccountSubtype'
      description: A single ledger account without nested children.
    ApiLoanOpeningBalance:
      type: object
      title: Loan opening balance
      description: >-
        The active opening balance on the loan's ledger account: pre-existing
        debt recorded against Opening Balance Equity rather than explained by
        recorded proceeds and payments.
      properties:
        ledger_account_id:
          type: string
          format: uuid
          description: ID of the loan's ledger account.
        ledger_account_name:
          type: string
          description: Name of the loan's ledger account.
        balance:
          type: integer
          format: int64
          description: Opening balance, in cents.
        effective_at:
          type: string
          format: date-time
          description: >-
            Point in time at which the loan's outstanding principal equaled
            `balance`.
        created_at:
          type: string
          format: date-time
          description: When the opening balance was created.
        updated_at:
          type: string
          format: date-time
          description: When the opening balance was last updated.
        transaction_tags:
          type: array
          items:
            $ref: '#/components/schemas/ApiTag'
          description: Tags associated with the opening balance.
        memo:
          type: string
          nullable: true
          description: Internal note about the opening balance.
        metadata:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            Arbitrary JSON object you can attach for your own use. Layer stores
            and returns it unchanged.
        reference_number:
          type: string
          nullable: true
          description: Reference number for the opening balance.
    ApiTag:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: ID for the tag.
        key:
          type: string
          description: Key for the tag.
          example: ExampleTagKey
        dimension_display_name:
          type: string
          nullable: true
          description: Display name for the tag dimension.
        value:
          type: string
          description: Value for the tag.
          example: ExampleTagValue
        value_display_name:
          type: string
          nullable: true
          description: Display name for the tag value definition.
        dimension_id:
          type: string
          format: uuid
          description: ID of the tag dimension this tag belongs to.
        definition_id:
          type: string
          format: uuid
          description: ID of the tag value definition.
        archived_at:
          type: string
          format: date-time
          nullable: true
          description: When the tag was archived.
      required:
        - id
        - key
        - value
        - dimension_id
        - definition_id
    CreateLoanProceedParams:
      description: 'A loan proceed: funds (or an asset) received from the loan.'
      oneOf:
        - $ref: '#/components/schemas/CreateLoanAssetProceedParams'
        - $ref: '#/components/schemas/CreateLoanDisbursementProceedParams'
      discriminator:
        propertyName: loan_proceed_type
        mapping:
          ASSET:
            $ref: '#/components/schemas/CreateLoanAssetProceedParams'
          DISBURSEMENT:
            $ref: '#/components/schemas/CreateLoanDisbursementProceedParams'
    CreateLoanOpeningBalanceParams:
      type: object
      title: Loan opening balance
      required:
        - balance
        - effective_at
      properties:
        balance:
          type: integer
          format: int64
          description: >-
            Outstanding principal of the loan as of `effective_at`, in cents.
            Must be positive.
        effective_at:
          type: string
          format: date-time
          description: >-
            Point in time at which the loan's outstanding principal equaled
            `balance`. Must be on or before every recorded proceed and payment
            on the loan; proceed and payment dates are evaluated as midnight US
            Eastern time at the start of their `date`, and a same-instant event
            counts as on or after the opening balance. Set this to when your
            reliable data begins (for example, just before the first payment you
            will record); avoid backdating it into periods whose books are
            already closed.
      description: >-
        Explicitly sets the loan's opening balance. The balance is journaled
        against Opening Balance Equity at `effective_at`. Most integrations
        should prefer `reported_balance`, which derives this value from recorded
        history.
    ReportedLoanBalanceParams:
      type: object
      title: Reported loan balance
      required:
        - balance
        - at
      properties:
        balance:
          type: integer
          format: int64
          description: >-
            Outstanding principal of the loan at `at`, in cents. Must not be
            negative.
        at:
          type: string
          format: date-time
          description: >-
            Point in time at which the loan's outstanding principal equaled
            `balance`.
      description: >-
        Asserts the loan's outstanding principal at a point in time. Layer
        derives the loan's opening balance from this assertion and the proceeds
        and payments recorded on the loan: any portion of the balance not
        explained by recorded history becomes the opening balance, journaled
        against Opening Balance Equity. If recorded history fully explains the
        balance, any opening balance is cleared. If the derivation would be
        negative (proceeds recorded on or before `at` exceed the reported
        balance plus principal payments recorded on or before `at`), the request
        fails with a 400. Re-send the assertion after backfilling more history
        to re-derive the opening balance. Proceed and payment dates are
        evaluated as midnight US Eastern time at the start of their `date` when
        determining whether they fall on or before `at`.
    AccountIdentifier:
      oneOf:
        - $ref: '#/components/schemas/AccountId'
          description: ID of the account.
          title: Account ID
        - $ref: '#/components/schemas/AccountStableName'
          description: Stable name associated with the account.
          title: Account Stable Name
    AccountStableName:
      type: object
      required:
        - type
        - stable_name
      properties:
        type:
          type: string
          enum:
            - StableName
          description: Resource type. Value will be `StableName`.
          example: StableName
        stable_name:
          type: string
          example: CURRENT_ASSETS
          description: Stable name of the account.
    BankTransactionDirection:
      type: string
      enum:
        - CREDIT
        - DEBIT
    ApiLedgerAccountType:
      type: object
      properties:
        value:
          $ref: '#/components/schemas/LedgerAccountType'
          description: Type of the account.
        display_name:
          type: string
          description: Display name of the account type.
          example: Asset
    ApiLedgerAccountSubtype:
      type: object
      properties:
        value:
          $ref: '#/components/schemas/LedgerAccountSubtype'
        display_name:
          type: string
          description: Display name of the account subtype.
          example: Current Assets
    CreateLoanAssetProceedParams:
      type: object
      title: Asset proceed
      required:
        - loan_proceed_type
        - amount
        - date
        - asset
      properties:
        loan_proceed_type:
          type: string
          enum:
            - ASSET
          description: Discriminator. Must be `ASSET`.
        external_id:
          type: string
          nullable: true
          description: Unique ID of the proceed in your system for linking purposes.
        amount:
          type: integer
          format: int64
          description: Proceed amount, in cents.
        date:
          type: string
          format: date
          description: Date the proceed was received.
        included_in_opening_balance:
          type: boolean
          default: false
          description: >-
            Set to true when recording a historical proceed that the loan's
            opening balance already reflects. The proceed must be dated before
            the opening balance's `effective_at` (its `date` is evaluated as
            midnight US Eastern time at the start of the day). Layer decreases
            the opening balance by the proceed's amount and moves the opening
            balance's `effective_at` back to the proceed date, so the explicit
            record replaces what the opening balance implied and the loan's
            balance is unchanged. Without this flag, proceeds dated before the
            opening balance's `effective_at` are rejected with a 400. Sending
            the flag when the loan has no active opening balance, or when the
            event is not dated before it, also fails with a 400.
        asset:
          $ref: '#/components/schemas/CreateLoanProceedAssetRef'
    CreateLoanDisbursementProceedParams:
      type: object
      title: Disbursement proceed
      required:
        - loan_proceed_type
        - amount
        - date
      properties:
        loan_proceed_type:
          type: string
          enum:
            - DISBURSEMENT
          description: Discriminator. Must be `DISBURSEMENT`.
        external_id:
          type: string
          nullable: true
          description: Unique ID of the proceed in your system for linking purposes.
        amount:
          type: integer
          format: int64
          description: Proceed amount, in cents.
        date:
          type: string
          format: date
          description: Date the proceed was received.
        included_in_opening_balance:
          type: boolean
          default: false
          description: >-
            Set to true when recording a historical proceed that the loan's
            opening balance already reflects. The proceed must be dated before
            the opening balance's `effective_at` (its `date` is evaluated as
            midnight US Eastern time at the start of the day). Layer decreases
            the opening balance by the proceed's amount and moves the opening
            balance's `effective_at` back to the proceed date, so the explicit
            record replaces what the opening balance implied and the loan's
            balance is unchanged. Without this flag, proceeds dated before the
            opening balance's `effective_at` are rejected with a 400. Sending
            the flag when the loan has no active opening balance, or when the
            event is not dated before it, also fails with a 400.
        method:
          allOf:
            - $ref: '#/components/schemas/PaymentMethod'
          default: OTHER
          description: Payment method used for the cash disbursement. Defaults to `OTHER`.
    AccountId:
      type: object
      required:
        - type
        - id
      properties:
        type:
          type: string
          enum:
            - AccountId
          description: Resource type. Value will be `AccountId`.
          example: AccountId
        id:
          type: string
          format: uuid
          description: ID of the account.
    LedgerAccountType:
      type: string
      enum:
        - ASSET
        - LIABILITY
        - EQUITY
        - REVENUE
        - EXPENSE
    LedgerAccountSubtype:
      type: string
      enum:
        - BANK_ACCOUNTS
        - ACCOUNTS_RECEIVABLE
        - INVENTORY
        - PAYMENT_PROCESSOR_CLEARING_ACCOUNT
        - FIXED_ASSET
        - ACCUMULATED_DEPRECIATION
        - CASH
        - UNDEPOSITED_FUNDS
        - CURRENT_ASSET
        - NON_CURRENT_ASSET
        - PREPAID_EXPENSES
        - DEVELOPMENT_COSTS
        - LOANS_RECEIVABLE
        - INTANGIBLE_ASSET
        - ACCOUNTS_PAYABLE
        - CREDIT_CARD
        - TAXES_PAYABLE
        - INCOME_TAXES_PAYABLE
        - SALES_TAXES_PAYABLE
        - OTHER_TAXES_PAYABLE
        - PAYROLL_TAXES_PAYABLE
        - UNEARNED_REVENUE
        - PAYROLL_LIABILITY
        - PAYROLL_CLEARING
        - LINE_OF_CREDIT
        - TIPS
        - REFUND_LIABILITIES
        - UNDEPOSITED_OUTFLOWS
        - OUTGOING_PAYMENT_CLEARING_ACCOUNT
        - OTHER_CURRENT_LIABILITY
        - LOANS_PAYABLE
        - NOTES_PAYABLE
        - SHAREHOLDER_LOAN
        - NON_CURRENT_LIABILITY
        - CONTRIBUTIONS
        - DISTRIBUTIONS
        - COMMON_STOCK
        - PREFERRED_STOCK
        - ADDITIONAL_PAID_IN_CAPITAL
        - RETAINED_EARNINGS
        - ACCUMULATED_ADJUSTMENTS
        - OPENING_BALANCE_EQUITY
        - OTHER_EQUITY
        - SALES
        - UNCATEGORIZED_REVENUE
        - RETURNS_ALLOWANCES
        - DIVIDEND_INCOME
        - INTEREST_INCOME
        - OTHER_INCOME
        - COGS
        - OPERATING_EXPENSES
        - PAYROLL
        - TAXES_LICENSES
        - UNCATEGORIZED_EXPENSE
        - CHARITABLE_CONTRIBUTIONS
        - LOAN_EXPENSES
        - FINANCE_COSTS
        - INTEREST_EXPENSES
        - DEPRECIATION
        - AMORTIZATION
        - BAD_DEBT
        - OTHER_EXPENSES
    CreateLoanProceedAssetRef:
      description: >-
        Reference to the asset funded by an `ASSET` proceed. Either link an
        existing asset by `id` or `external_id`, or create a new asset inline
        with `new_asset`.
      oneOf:
        - type: object
          title: Existing asset
          description: Link an existing asset. Provide either `id` or `external_id`.
          properties:
            id:
              type: string
              format: uuid
              nullable: true
              description: ID of an existing asset to link to this proceed.
            external_id:
              type: string
              nullable: true
              description: External ID of an existing asset to link to this proceed.
        - type: object
          title: New asset
          required:
            - new_asset
          properties:
            new_asset:
              $ref: '#/components/schemas/CreateAssetParams'
    PaymentMethod:
      type: string
      enum:
        - CASH
        - CHECK
        - CREDIT_CARD
        - ACH
        - CREDIT_BALANCE
        - OTHER
    CreateAssetParams:
      type: object
      description: >-
        Parameters for creating a fixed asset. Creates a dedicated ledger
        account for the asset under the parent account (defaults to Fixed
        Assets).
      required:
        - name
        - asset_type
      properties:
        name:
          type: string
          description: Name of the asset.
        external_id:
          type: string
          nullable: true
          description: >-
            Unique ID of the asset in your system for linking purposes. Creating
            an asset with an `external_id` that already exists upserts the
            existing asset.
        asset_type:
          $ref: '#/components/schemas/AssetType'
        parent_ledger_account_identifier:
          allOf:
            - $ref: '#/components/schemas/AccountIdentifier'
          nullable: true
          description: >-
            Parent ledger account under which the asset's dedicated account is
            created. Defaults to Fixed Assets.
        accumulated_depreciation_account:
          allOf:
            - $ref: '#/components/schemas/AccountIdentifier'
          nullable: true
          description: >-
            Accumulated depreciation account for the asset. Required before
            recording `DEPRECIATION_AMORTIZATION` value updates.
        original_value:
          type: integer
          format: int64
          nullable: true
          description: Original purchase value, in cents.
        salvage_value:
          type: integer
          format: int64
          nullable: true
          description: Estimated salvage (residual) value, in cents.
        useful_life_months:
          type: integer
          format: int32
          nullable: true
          description: Useful life of the asset, in months.
        memo:
          type: string
          nullable: true
          description: Internal note about the asset.
        metadata:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            Arbitrary JSON object you can attach for your own use. Layer stores
            and returns it unchanged.
        reference_number:
          type: string
          nullable: true
          description: Reference number for the asset.
    AssetType:
      type: string
      description: The type of fixed asset.
      enum:
        - RIGHT_OF_USE_ASSET
        - VEHICLE
        - EQUIPMENT
        - GOODWILL
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````