Update a loan
curl --request PUT \
--url https://api-staging.bsa.ai/v1/loans/{loan_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"principal": 123,
"numberOfRepayments": 123,
"interestRatePerPeriod": 123,
"externalId": "<string>"
}
'import requests
url = "https://api-staging.bsa.ai/v1/loans/{loan_id}"
payload = {
"principal": 123,
"numberOfRepayments": 123,
"interestRatePerPeriod": 123,
"externalId": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
principal: 123,
numberOfRepayments: 123,
interestRatePerPeriod: 123,
externalId: '<string>'
})
};
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 => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'principal' => 123,
'numberOfRepayments' => 123,
'interestRatePerPeriod' => 123,
'externalId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-staging.bsa.ai/v1/loans/{loan_id}"
payload := strings.NewReader("{\n \"principal\": 123,\n \"numberOfRepayments\": 123,\n \"interestRatePerPeriod\": 123,\n \"externalId\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api-staging.bsa.ai/v1/loans/{loan_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"principal\": 123,\n \"numberOfRepayments\": 123,\n \"interestRatePerPeriod\": 123,\n \"externalId\": \"<string>\"\n}")
.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::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"principal\": 123,\n \"numberOfRepayments\": 123,\n \"interestRatePerPeriod\": 123,\n \"externalId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyLoans
Update a loan
Modify a loan that is still in submitted and pending approval state.
PUT
/
v1
/
loans
/
{loan_id}
Update a loan
curl --request PUT \
--url https://api-staging.bsa.ai/v1/loans/{loan_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"principal": 123,
"numberOfRepayments": 123,
"interestRatePerPeriod": 123,
"externalId": "<string>"
}
'import requests
url = "https://api-staging.bsa.ai/v1/loans/{loan_id}"
payload = {
"principal": 123,
"numberOfRepayments": 123,
"interestRatePerPeriod": 123,
"externalId": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
principal: 123,
numberOfRepayments: 123,
interestRatePerPeriod: 123,
externalId: '<string>'
})
};
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 => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'principal' => 123,
'numberOfRepayments' => 123,
'interestRatePerPeriod' => 123,
'externalId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-staging.bsa.ai/v1/loans/{loan_id}"
payload := strings.NewReader("{\n \"principal\": 123,\n \"numberOfRepayments\": 123,\n \"interestRatePerPeriod\": 123,\n \"externalId\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api-staging.bsa.ai/v1/loans/{loan_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"principal\": 123,\n \"numberOfRepayments\": 123,\n \"interestRatePerPeriod\": 123,\n \"externalId\": \"<string>\"\n}")
.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::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"principal\": 123,\n \"numberOfRepayments\": 123,\n \"interestRatePerPeriod\": 123,\n \"externalId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyModify a loan that is still in submitted and pending approval
state. Send only the fields you want to change. Once a loan is
approved or active, this endpoint will reject the update — to reach a
pending state you must first
undo disbursal and then
undo approval.
This endpoint is numeric-id only — there is no
Only the fields you send are modified.
/v1/loans/external/{loan_external_id} form.
Path parameters
string
required
Request body
number
integer
number
string
Example
curl -sf -X PUT "$BASE/v1/loans/501" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"principal": 6000,
"numberOfRepayments": 18
}'
Response
200 OK returns the updated loan object.
Errors
| Code | When |
|---|---|
not_found | No loan with that ID |
aborted | Loan is not in pending state |
invalid_argument | Field violates a product-level constraint |
⌘I

