---
updatedAt: 2026-04-21T16:34:40.000Z
agentTools:
  siteIndex: https://developers.pismo.io/llms.txt
  projectIndex: https://developers.pismo.io/pismo-docs/llms.txt
---

# Cancel loan

Cancels a loan.

This endpoint generates a [Loan updated](https://developers.pismo.io/events/docs/lending-lending-loan-update-1) event.


# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Lending",
    "description": "Lending applications",
    "version": "1.0.0",
    "contact": {
      "name": "API Support",
      "url": "https://developers.pismo.io/support/"
    },
    "license": {
      "name": "Copyright Pismo"
    }
  },
  "servers": [
    {
      "url": "https://sandbox.pismolabs.io/lending",
      "description": "Sandbox API server for testing"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Loans",
      "description": "Creates the core loan management features"
    }
  ],
  "components": {
    "parameters": {
      "RequiredIdempotencyKeyHeader": {
        "name": "Idempotency-Key",
        "description": "Required UUID that makes the request idempotent, enabling you to retry it multiple times while the system processes it only once.",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        },
        "example": "4df987e3-8179-11ed-8209-06c7b022d1ee"
      },
      "LoanIdPath": {
        "name": "loanId",
        "description": "ID of the loan the operation applies to",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        },
        "example": "2717a296-124a-47cc-b2a1-91e80dc723eb"
      }
    },
    "schemas": {
      "AuthorizationDenialCode": {
        "type": "string",
        "description": "Payment Methods - Denial Code",
        "example": "IAD",
        "minLength": 3,
        "maxLength": 5
      },
      "AuthorizationId": {
        "type": "number",
        "description": "Authorization ID",
        "format": "int64",
        "example": 123456789
      },
      "AuthorizationResponseCode": {
        "type": "string",
        "description": "Payment Methods - Response Code",
        "example": "62",
        "minLength": 2,
        "maxLength": 2
      },
      "AuthorizationTrackingId": {
        "type": "string",
        "description": "Authorization tracking ID",
        "format": "uuid",
        "example": "4df987e3-8179-11ed-8209-06c7b022d1ee"
      },
      "CancelLoanV2Metadata": {
        "type": "object",
        "description": "Additional loan cancellation information\n\n**Note**: This field must not be used to send Personally Identifiable Information (PII), Payment Card Industry (PCI) data, or any sensitive/regulated information. Metadata fields are intended for operational, non-sensitive data only. For sensitive data, use the specific parameters designed for that purpose. For more information, refer to [Get started with Pismo APIs](https://developers.pismo.io/pismo-docs/reference/get-started-with-pismo-apis).\n",
        "additionalProperties": {
          "type": "string",
          "description": "Additional property"
        }
      },
      "CancelLoanV2Request": {
        "required": [
          "tracking_id"
        ],
        "type": "object",
        "properties": {
          "tracking_id": {
            "$ref": "#/components/schemas/TrackingID"
          },
          "metadata": {
            "$ref": "#/components/schemas/CancelLoanV2Metadata"
          },
          "processing_code": {
            "$ref": "#/components/schemas/LoanCancellationProcessingCodes"
          },
          "refund_paid_repayments": {
            "$ref": "#/components/schemas/RefundPaidRepayments"
          }
        }
      },
      "CancelLoanV2Response": {
        "required": [
          "canceled_loan_id",
          "reversal_authorization_id",
          "reversal_tracking_id"
        ],
        "type": "object",
        "properties": {
          "canceled_loan_id": {
            "$ref": "#/components/schemas/LoanID"
          },
          "reversal_authorization_id": {
            "$ref": "#/components/schemas/AuthorizationId"
          },
          "reversal_tracking_id": {
            "$ref": "#/components/schemas/AuthorizationTrackingId"
          }
        }
      },
      "ErrorCode": {
        "type": "string",
        "description": "Lending error code",
        "example": "ELND0001"
      },
      "ErrorMessage": {
        "type": "string",
        "example": "Unexpected error",
        "description": "Lending error message"
      },
      "LoanCancellationProcessingCodes": {
        "type": "object",
        "description": "Define processing codes for each operation during the loan cancellation.",
        "properties": {
          "booking": {
            "description": "Booking processing code",
            "$ref": "#/components/schemas/ProcessingCode"
          },
          "penalty_waiver": {
            "description": "Penalty waiver processing code",
            "$ref": "#/components/schemas/ProcessingCode"
          },
          "repayment": {
            "description": "Repayment processing code",
            "$ref": "#/components/schemas/ProcessingCode"
          }
        }
      },
      "LoanID": {
        "maxLength": 36,
        "minLength": 0,
        "type": "string",
        "description": "Custom ID for the loan. Must consist of uppercase alphanumeric characters and underscores.",
        "example": "MY_CUSTOM_LOAN_ID"
      },
      "ProcessingCode": {
        "type": "string",
        "description": "Processing code",
        "example": "000011",
        "minLength": 2,
        "maxLength": 6
      },
      "RefundPaidRepayments": {
        "type": "boolean",
        "description": "Refund paid repayments upon loan cancellation?",
        "default": false,
        "example": true
      },
      "StandardAuthorizationErrorResponse": {
        "type": "object",
        "properties": {
          "code": {
            "$ref": "#/components/schemas/ErrorCode"
          },
          "denial_code": {
            "$ref": "#/components/schemas/AuthorizationDenialCode"
          },
          "message": {
            "$ref": "#/components/schemas/ErrorMessage"
          },
          "response_code": {
            "$ref": "#/components/schemas/AuthorizationResponseCode"
          }
        }
      },
      "StandardErrorResponse": {
        "type": "object",
        "properties": {
          "code": {
            "$ref": "#/components/schemas/ErrorCode"
          },
          "message": {
            "$ref": "#/components/schemas/ErrorMessage"
          }
        }
      },
      "TrackingID": {
        "type": "string",
        "format": "uuid",
        "description": "Tracking ID",
        "example": "003b3de8-c321-464c-a3dd-6009b8698325"
      }
    },
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  },
  "paths": {
    "/v2/loans/{loanId}/cancel": {
      "post": {
        "tags": [
          "Loans"
        ],
        "summary": "Cancel loan",
        "description": "Cancels a loan.\n\nThis endpoint generates a [Loan updated](https://developers.pismo.io/events/docs/lending-lending-loan-update-1) event.\n",
        "operationId": "cancelLoanV2",
        "parameters": [
          {
            "$ref": "#/components/parameters/LoanIdPath"
          },
          {
            "$ref": "#/components/parameters/RequiredIdempotencyKeyHeader"
          }
        ],
        "requestBody": {
          "description": "Request body for loan cancellation.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelLoanV2Request"
              },
              "examples": {
                "Cancels the loan": {
                  "description": "Cancels the loan.",
                  "value": {
                    "tracking_id": "5c075cc6-8dc2-4fe6-9ed7-cf5687d4e834",
                    "processing_code": {
                      "booking": "7DJ8L",
                      "repayment": "I1I7J",
                      "penalty_waiver": "80Y39"
                    },
                    "metadata": {
                      "cancellation_reason": "Write-off"
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "description": "Cancellation accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelLoanV2Response"
                },
                "examples": {
                  "Success Cancellation": {
                    "description": "Cancellation accepted.",
                    "value": {
                      "canceled_loan_id": "73e45fd5-759f-4e04-a88a-7172fa948afa",
                      "reversal_authorization_id": 123456789,
                      "reversal_tracking_id": "4df987e3-8179-11ed-8209-06c7b022d1ee"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "A validation error occurred.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/StandardErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/StandardAuthorizationErrorResponse"
                    }
                  ]
                },
                "examples": {
                  "Validation exception": {
                    "description": "Validation exception.",
                    "value": {
                      "code": "ELND0010",
                      "message": "Header Idempotency-Key not passed"
                    }
                  },
                  "Authorization failed": {
                    "description": "Authorization failed.",
                    "value": {
                      "code": "ELND0004",
                      "message": "Authorization failed",
                      "response_code": "62",
                      "denial_code": "IAD"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StandardErrorResponse"
                },
                "examples": {
                  "ELND0001": {
                    "description": "Unexpected error",
                    "value": {
                      "code": "ELND0001",
                      "message": "Unexpected error"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
```