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

# Archive a loan

> Archives a loan. Archived loans are excluded from list responses.



## OpenAPI

````yaml delete /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}:
    delete:
      tags: []
      summary: Archive a loan
      description: Archives a loan. Archived loans are excluded from list responses.
      operationId: business.loans.loanId.delete
      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
      responses:
        '200':
          description: The archived loan.
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/ApiLoan'
components:
  schemas:
    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.
    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
    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.
    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
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````