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

# Create a loan

> Creates a new loan for the specified business, or updates an existing one. If a loan with the same `external_id` already exists it is upserted: the loan fields are updated and, when `proceeds` is provided, its proceeds are reconciled by proceed `external_id`. A dedicated ledger account is created for new loans. The request shape depends on `loan_type`.



## OpenAPI

````yaml post /v1/businesses/{businessId}/loans
openapi: 3.0.1
info:
  title: API
  version: latest
servers: []
security:
  - BearerAuth: []
tags: []
externalDocs:
  url: /
paths:
  /v1/businesses/{businessId}/loans:
    post:
      tags: []
      summary: Create a loan
      description: >-
        Creates a new loan for the specified business, or updates an existing
        one. If a loan with the same `external_id` already exists it is
        upserted: the loan fields are updated and, when `proceeds` is provided,
        its proceeds are reconciled by proceed `external_id`. A dedicated ledger
        account is created for new loans. The request shape depends on
        `loan_type`.
      operationId: business.loans.post
      parameters:
        - name: businessId
          in: path
          description: The UUID of the business.
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        description: The loan to create.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateLoanParams'
            examples:
              term_loan_with_disbursement:
                summary: Term loan with a cash disbursement
                value:
                  loan_type: TERM_LOAN
                  external_id: loan-001
                  display_name: Equipment term loan
                  origination_date: '2024-01-15'
                  original_principal: 5000000
                  loan_term_months: 36
                  proceeds:
                    - loan_proceed_type: DISBURSEMENT
                      amount: 5000000
                      date: '2024-01-15'
                      method: ACH
              merchant_cash_advance:
                summary: Merchant cash advance
                value:
                  loan_type: MCA
                  display_name: Working capital advance
                  origination_date: '2024-03-01'
                  original_principal: 2000000
                  fee_percentage: '15'
              line_of_credit:
                summary: Line of credit
                value:
                  loan_type: LINE_OF_CREDIT
                  display_name: Revolving credit line
                  origination_date: '2024-02-01'
                  credit_limit: 10000000
              flex_loan:
                summary: Flex loan
                value:
                  loan_type: FLEX_LOAN
                  display_name: Flex advance
                  origination_date: '2024-03-01'
                  original_principal: 2000000
                  fee_percentage: '15'
      responses:
        '201':
          description: Loan created successfully.
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/ApiLoan'
components:
  schemas:
    CreateLoanParams:
      description: Parameters for creating a loan. The shape depends on `loan_type`.
      oneOf:
        - $ref: '#/components/schemas/CreateTermLoanParams'
        - $ref: '#/components/schemas/CreateMcaLoanParams'
        - $ref: '#/components/schemas/CreateFlexLoanParams'
        - $ref: '#/components/schemas/CreateLineOfCreditLoanParams'
        - $ref: '#/components/schemas/CreateLeaseLoanParams'
        - $ref: '#/components/schemas/CreateEquipmentFinancingLoanParams'
      discriminator:
        propertyName: loan_type
        mapping:
          TERM_LOAN:
            $ref: '#/components/schemas/CreateTermLoanParams'
          MCA:
            $ref: '#/components/schemas/CreateMcaLoanParams'
          FLEX_LOAN:
            $ref: '#/components/schemas/CreateFlexLoanParams'
          LINE_OF_CREDIT:
            $ref: '#/components/schemas/CreateLineOfCreditLoanParams'
          LEASE:
            $ref: '#/components/schemas/CreateLeaseLoanParams'
          EQUIPMENT_FINANCING:
            $ref: '#/components/schemas/CreateEquipmentFinancingLoanParams'
    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.
        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.
    CreateTermLoanParams:
      type: object
      required:
        - loan_type
        - display_name
        - origination_date
        - original_principal
      properties:
        loan_type:
          type: string
          enum:
            - TERM_LOAN
          description: Discriminator. Must be `TERM_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.
        origination_date:
          type: string
          format: date
          description: Date the loan was originated.
        parent_ledger_account_identifier:
          allOf:
            - $ref: '#/components/schemas/AccountIdentifier'
          nullable: true
          description: >-
            Parent ledger account under which the loan's dedicated liability
            account is created. Defaults to `NOTES_PAYABLE`.
        original_principal:
          type: integer
          format: int64
          description: Original principal of the loan, in cents.
        loan_term_months:
          type: integer
          format: int32
          nullable: true
          description: Term of the loan, in months.
        proceeds:
          type: array
          items:
            $ref: '#/components/schemas/CreateLoanProceedParams'
          description: >-
            Loan proceeds. Optional. On create, sets the loan's initial
            proceeds. Because creating with an existing `external_id` upserts
            the loan, on a subsequent call this list is reconciled against the
            loan's existing proceeds by proceed `external_id` (matched proceeds
            are updated, existing proceeds that are absent or have no
            `external_id` are archived, and new entries are created). Omit the
            field or set it to `null` to leave the existing proceeds untouched.
            Individual proceeds can also be managed with the loan proceed
            endpoints.
          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.
      title: Term loan
    CreateMcaLoanParams:
      type: object
      required:
        - loan_type
        - display_name
        - origination_date
        - original_principal
        - fee_percentage
      properties:
        loan_type:
          type: string
          enum:
            - MCA
          description: Discriminator. Must be `MCA`.
        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.
        origination_date:
          type: string
          format: date
          description: Date the loan was originated.
        parent_ledger_account_identifier:
          allOf:
            - $ref: '#/components/schemas/AccountIdentifier'
          nullable: true
          description: >-
            Parent ledger account under which the loan's dedicated liability
            account is created. Defaults to `NOTES_PAYABLE`.
        original_principal:
          type: integer
          format: int64
          description: Original principal (advance amount), in cents.
        fee_percentage:
          type: string
          description: >-
            Merchant cash advance fee, expressed as a percentage in a decimal
            string (for example, `"15"` for a 15% fee, or `"15.5"` for 15.5%).
        proceeds:
          type: array
          items:
            $ref: '#/components/schemas/CreateLoanProceedParams'
          description: >-
            Loan proceeds. Optional. On create, sets the loan's initial
            proceeds. Because creating with an existing `external_id` upserts
            the loan, on a subsequent call this list is reconciled against the
            loan's existing proceeds by proceed `external_id` (matched proceeds
            are updated, existing proceeds that are absent or have no
            `external_id` are archived, and new entries are created). Omit the
            field or set it to `null` to leave the existing proceeds untouched.
            Individual proceeds can also be managed with the loan proceed
            endpoints.
          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.
      title: Merchant cash advance
    CreateFlexLoanParams:
      type: object
      required:
        - loan_type
        - display_name
        - origination_date
        - original_principal
        - fee_percentage
      properties:
        loan_type:
          type: string
          enum:
            - FLEX_LOAN
          description: Discriminator. Must be `FLEX_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.
        origination_date:
          type: string
          format: date
          description: Date the loan was originated.
        parent_ledger_account_identifier:
          allOf:
            - $ref: '#/components/schemas/AccountIdentifier'
          nullable: true
          description: >-
            Parent ledger account under which the loan's dedicated liability
            account is created. Defaults to `NOTES_PAYABLE`.
        original_principal:
          type: integer
          format: int64
          description: Original principal (advance amount), in cents.
        fee_percentage:
          type: string
          description: >-
            Fixed fee, expressed as a percentage in a decimal string (for
            example, `"15"` for a 15% fee).
        proceeds:
          type: array
          items:
            $ref: '#/components/schemas/CreateLoanProceedParams'
          description: >-
            Loan proceeds. Optional. On create, sets the loan's initial
            proceeds. Because creating with an existing `external_id` upserts
            the loan, on a subsequent call this list is reconciled against the
            loan's existing proceeds by proceed `external_id` (matched proceeds
            are updated, existing proceeds that are absent or have no
            `external_id` are archived, and new entries are created). Omit the
            field or set it to `null` to leave the existing proceeds untouched.
            Individual proceeds can also be managed with the loan proceed
            endpoints.
          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.
      title: Flex loan
    CreateLineOfCreditLoanParams:
      type: object
      required:
        - loan_type
        - display_name
        - origination_date
        - credit_limit
      properties:
        loan_type:
          type: string
          enum:
            - LINE_OF_CREDIT
          description: Discriminator. Must be `LINE_OF_CREDIT`.
        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.
        origination_date:
          type: string
          format: date
          description: Date the loan was originated.
        parent_ledger_account_identifier:
          allOf:
            - $ref: '#/components/schemas/AccountIdentifier'
          nullable: true
          description: >-
            Parent ledger account under which the loan's dedicated liability
            account is created. Defaults to `NOTES_PAYABLE`.
        credit_limit:
          type: integer
          format: int64
          description: Credit limit of the line of credit, in cents.
        proceeds:
          type: array
          items:
            $ref: '#/components/schemas/CreateLoanProceedParams'
          description: >-
            Loan proceeds. Optional. On create, sets the loan's initial
            proceeds. Because creating with an existing `external_id` upserts
            the loan, on a subsequent call this list is reconciled against the
            loan's existing proceeds by proceed `external_id` (matched proceeds
            are updated, existing proceeds that are absent or have no
            `external_id` are archived, and new entries are created). Omit the
            field or set it to `null` to leave the existing proceeds untouched.
            Individual proceeds can also be managed with the loan proceed
            endpoints.
          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.
      title: Line of credit
    CreateLeaseLoanParams:
      type: object
      required:
        - loan_type
        - display_name
        - origination_date
        - original_principal
        - loan_term_months
      properties:
        loan_type:
          type: string
          enum:
            - LEASE
          description: Discriminator. Must be `LEASE`.
        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.
        origination_date:
          type: string
          format: date
          description: Date the loan was originated.
        parent_ledger_account_identifier:
          allOf:
            - $ref: '#/components/schemas/AccountIdentifier'
          nullable: true
          description: >-
            Parent ledger account under which the loan's dedicated liability
            account is created. Defaults to `NOTES_PAYABLE`.
        original_principal:
          type: integer
          format: int64
          description: Original principal of the lease, in cents.
        loan_term_months:
          type: integer
          format: int32
          description: Term of the lease, in months.
        proceeds:
          type: array
          items:
            $ref: '#/components/schemas/CreateLoanProceedParams'
          description: >-
            Loan proceeds. Optional. On create, sets the loan's initial
            proceeds. Because creating with an existing `external_id` upserts
            the loan, on a subsequent call this list is reconciled against the
            loan's existing proceeds by proceed `external_id` (matched proceeds
            are updated, existing proceeds that are absent or have no
            `external_id` are archived, and new entries are created). Omit the
            field or set it to `null` to leave the existing proceeds untouched.
            Individual proceeds can also be managed with the loan proceed
            endpoints.
          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.
      title: Lease
    CreateEquipmentFinancingLoanParams:
      type: object
      required:
        - loan_type
        - display_name
        - origination_date
        - original_principal
        - loan_term_months
      properties:
        loan_type:
          type: string
          enum:
            - EQUIPMENT_FINANCING
          description: Discriminator. Must be `EQUIPMENT_FINANCING`.
        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.
        origination_date:
          type: string
          format: date
          description: Date the loan was originated.
        parent_ledger_account_identifier:
          allOf:
            - $ref: '#/components/schemas/AccountIdentifier'
          nullable: true
          description: >-
            Parent ledger account under which the loan's dedicated liability
            account is created. Defaults to `NOTES_PAYABLE`.
        original_principal:
          type: integer
          format: int64
          description: Original principal of the financing, in cents.
        loan_term_months:
          type: integer
          format: int32
          description: Term of the financing, in months.
        proceeds:
          type: array
          items:
            $ref: '#/components/schemas/CreateLoanProceedParams'
          description: >-
            Loan proceeds. Optional. On create, sets the loan's initial
            proceeds. Because creating with an existing `external_id` upserts
            the loan, on a subsequent call this list is reconciled against the
            loan's existing proceeds by proceed `external_id` (matched proceeds
            are updated, existing proceeds that are absent or have no
            `external_id` are archived, and new entries are created). Omit the
            field or set it to `null` to leave the existing proceeds untouched.
            Individual proceeds can also be managed with the loan proceed
            endpoints.
          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.
      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.
    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
    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
    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'
    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
    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.
    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.
        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.
        method:
          allOf:
            - $ref: '#/components/schemas/PaymentMethod'
          default: OTHER
          description: Payment method used for the cash disbursement. Defaults to `OTHER`.
    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

````