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

# Delete Loan

> Soft-delete a loan. Sets servicing status to NOT_SERVICING, cancels scheduled payments and communications.

## Overview

Soft-delete a loan by its external reference ID. This endpoint:

* Sets the loan's servicing status to `NOT_SERVICING`
* Cancels all scheduled payments for the loan
* Cancels all scheduled communications (calls, emails, SMS)
* Marks the loan as deleted (soft-delete)

The loan record is preserved in the database for audit purposes but will no longer appear in normal queries or be actively serviced.

## Response

The response includes counts of all cancelled items:

```json theme={null}
{
  "id": "LOAN-12345",
  "deleted": true,
  "servicingStatus": "NOT_SERVICING",
  "cancelledScheduledPayments": 2,
  "cancelledCalls": 3,
  "cancelledEmails": 1,
  "cancelledSms": 1
}
```

## Error Responses

| Status Code | Description           |
| ----------- | --------------------- |
| 404         | Loan not found        |
| 500         | Internal server error |


## OpenAPI

````yaml DELETE /loans/{id}
openapi: 3.1.0
info:
  title: Finosu API
  description: Finosu API
  license:
    name: MIT
  version: 1.0.0
servers: []
security:
  - apiKeyAuth: []
paths:
  /loans/{id}:
    delete:
      description: >-
        Soft-delete a loan. Sets servicing status to NOT_SERVICING, cancels
        scheduled payments and communications.
      parameters:
        - name: id
          in: path
          description: External reference ID of the loan
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Loan deleted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteLoanResponse'
        '404':
          description: Loan not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    DeleteLoanResponse:
      type: object
      required:
        - id
        - deleted
        - servicingStatus
        - cancelledScheduledPayments
        - cancelledCalls
        - cancelledEmails
        - cancelledSms
      properties:
        id:
          type: string
        deleted:
          type: boolean
          example: true
        servicingStatus:
          type: string
          example: NOT_SERVICING
        cancelledScheduledPayments:
          type: integer
          example: 2
        cancelledCalls:
          type: integer
          example: 3
        cancelledEmails:
          type: integer
          example: 1
        cancelledSms:
          type: integer
          example: 1
    Error:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: integer
          format: int32
        message:
          type: string
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````