Delete a loan
curl --request DELETE \
--url https://api-staging.bsa.ai/v1/loans/{loan_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-staging.bsa.ai/v1/loans/{loan_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api-staging.bsa.ai/v1/loans/{loan_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-staging.bsa.ai/v1/loans/{loan_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-staging.bsa.ai/v1/loans/{loan_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api-staging.bsa.ai/v1/loans/{loan_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-staging.bsa.ai/v1/loans/{loan_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyLoans
Delete a loan
Permanently remove a pending loan.
DELETE
/
v1
/
loans
/
{loan_id}
Delete a loan
curl --request DELETE \
--url https://api-staging.bsa.ai/v1/loans/{loan_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-staging.bsa.ai/v1/loans/{loan_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api-staging.bsa.ai/v1/loans/{loan_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-staging.bsa.ai/v1/loans/{loan_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-staging.bsa.ai/v1/loans/{loan_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api-staging.bsa.ai/v1/loans/{loan_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-staging.bsa.ai/v1/loans/{loan_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyOnly loans in submitted and pending approval state can be deleted.
Because
POST /v1/loans always lands at Active, reaching a deletable
state requires first calling undo disbursal
and then undo approval. To stop an active
loan without removing it from the record, use
Write off instead.
Two equivalent forms — prefer the externalId form for partner integrations.
# By loan externalId (recommended)
curl -X DELETE "$BASE/v1/loans/external/loan-ext-12345" \
-H "Authorization: Bearer $TOKEN"
# Same effect, by LMS id
curl -X DELETE "$BASE/v1/loans/501" \
-H "Authorization: Bearer $TOKEN"
Path parameters
string
required
Example
curl -sf -X DELETE "$BASE/v1/loans/501" \
-H "Authorization: Bearer $TOKEN"
Response
204 No Content with an empty body.
Errors
| Code | When |
|---|---|
not_found | No loan with that ID |
permission_denied | Loan is not in Submitted and pending approval state (e.g. Active, Closed, Overpaid). The loan is left untouched. |
⌘I

