curl --request PATCH \
--url https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"loan_type": "TERM_LOAN",
"display_name": "<string>",
"origination_date": "2023-12-25",
"original_principal": 123,
"loan_term_months": 123,
"proceeds": [
{
"loan_proceed_type": "ASSET",
"amount": 123,
"date": "2023-12-25",
"asset": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_id": "<string>"
},
"external_id": "<string>",
"included_in_opening_balance": false
}
],
"opening_balance": {
"balance": 123,
"effective_at": "2023-11-07T05:31:56Z"
},
"reported_balance": {
"balance": 123,
"at": "2023-11-07T05:31:56Z"
},
"memo": "<string>",
"metadata": {},
"reference_number": "<string>"
}
'import requests
url = "https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}"
payload = {
"loan_type": "TERM_LOAN",
"display_name": "<string>",
"origination_date": "2023-12-25",
"original_principal": 123,
"loan_term_months": 123,
"proceeds": [
{
"loan_proceed_type": "ASSET",
"amount": 123,
"date": "2023-12-25",
"asset": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_id": "<string>"
},
"external_id": "<string>",
"included_in_opening_balance": False
}
],
"opening_balance": {
"balance": 123,
"effective_at": "2023-11-07T05:31:56Z"
},
"reported_balance": {
"balance": 123,
"at": "2023-11-07T05:31:56Z"
},
"memo": "<string>",
"metadata": {},
"reference_number": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
loan_type: 'TERM_LOAN',
display_name: '<string>',
origination_date: '2023-12-25',
original_principal: 123,
loan_term_months: 123,
proceeds: [
{
loan_proceed_type: 'ASSET',
amount: 123,
date: '2023-12-25',
asset: {id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', external_id: '<string>'},
external_id: '<string>',
included_in_opening_balance: false
}
],
opening_balance: {balance: 123, effective_at: '2023-11-07T05:31:56Z'},
reported_balance: {balance: 123, at: '2023-11-07T05:31:56Z'},
memo: '<string>',
metadata: {},
reference_number: '<string>'
})
};
fetch('https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}', 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://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'loan_type' => 'TERM_LOAN',
'display_name' => '<string>',
'origination_date' => '2023-12-25',
'original_principal' => 123,
'loan_term_months' => 123,
'proceeds' => [
[
'loan_proceed_type' => 'ASSET',
'amount' => 123,
'date' => '2023-12-25',
'asset' => [
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'external_id' => '<string>'
],
'external_id' => '<string>',
'included_in_opening_balance' => false
]
],
'opening_balance' => [
'balance' => 123,
'effective_at' => '2023-11-07T05:31:56Z'
],
'reported_balance' => [
'balance' => 123,
'at' => '2023-11-07T05:31:56Z'
],
'memo' => '<string>',
'metadata' => [
],
'reference_number' => '<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://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}"
payload := strings.NewReader("{\n \"loan_type\": \"TERM_LOAN\",\n \"display_name\": \"<string>\",\n \"origination_date\": \"2023-12-25\",\n \"original_principal\": 123,\n \"loan_term_months\": 123,\n \"proceeds\": [\n {\n \"loan_proceed_type\": \"ASSET\",\n \"amount\": 123,\n \"date\": \"2023-12-25\",\n \"asset\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"external_id\": \"<string>\"\n },\n \"external_id\": \"<string>\",\n \"included_in_opening_balance\": false\n }\n ],\n \"opening_balance\": {\n \"balance\": 123,\n \"effective_at\": \"2023-11-07T05:31:56Z\"\n },\n \"reported_balance\": {\n \"balance\": 123,\n \"at\": \"2023-11-07T05:31:56Z\"\n },\n \"memo\": \"<string>\",\n \"metadata\": {},\n \"reference_number\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"loan_type\": \"TERM_LOAN\",\n \"display_name\": \"<string>\",\n \"origination_date\": \"2023-12-25\",\n \"original_principal\": 123,\n \"loan_term_months\": 123,\n \"proceeds\": [\n {\n \"loan_proceed_type\": \"ASSET\",\n \"amount\": 123,\n \"date\": \"2023-12-25\",\n \"asset\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"external_id\": \"<string>\"\n },\n \"external_id\": \"<string>\",\n \"included_in_opening_balance\": false\n }\n ],\n \"opening_balance\": {\n \"balance\": 123,\n \"effective_at\": \"2023-11-07T05:31:56Z\"\n },\n \"reported_balance\": {\n \"balance\": 123,\n \"at\": \"2023-11-07T05:31:56Z\"\n },\n \"memo\": \"<string>\",\n \"metadata\": {},\n \"reference_number\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"loan_type\": \"TERM_LOAN\",\n \"display_name\": \"<string>\",\n \"origination_date\": \"2023-12-25\",\n \"original_principal\": 123,\n \"loan_term_months\": 123,\n \"proceeds\": [\n {\n \"loan_proceed_type\": \"ASSET\",\n \"amount\": 123,\n \"date\": \"2023-12-25\",\n \"asset\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"external_id\": \"<string>\"\n },\n \"external_id\": \"<string>\",\n \"included_in_opening_balance\": false\n }\n ],\n \"opening_balance\": {\n \"balance\": 123,\n \"effective_at\": \"2023-11-07T05:31:56Z\"\n },\n \"reported_balance\": {\n \"balance\": 123,\n \"at\": \"2023-11-07T05:31:56Z\"\n },\n \"memo\": \"<string>\",\n \"metadata\": {},\n \"reference_number\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"business_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"display_name": "<string>",
"loan_account": {
"type": "Single_Chart_Account",
"id": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"name": "Current Assets",
"account_number": "4000",
"stable_name": {
"type": "StableName",
"stable_name": "CURRENT_ASSETS"
},
"account_type": {
"display_name": "Asset"
},
"account_subtype": {
"display_name": "Current Assets"
}
},
"current_balance": 123,
"origination_date": "2023-12-25",
"transaction_tags": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"key": "ExampleTagKey",
"value": "ExampleTagValue",
"dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"definition_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"dimension_display_name": "<string>",
"value_display_name": "<string>",
"archived_at": "2023-11-07T05:31:56Z"
}
],
"external_id": "<string>",
"opening_balance": {
"ledger_account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"ledger_account_name": "<string>",
"balance": 123,
"effective_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"transaction_tags": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"key": "ExampleTagKey",
"value": "ExampleTagValue",
"dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"definition_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"dimension_display_name": "<string>",
"value_display_name": "<string>",
"archived_at": "2023-11-07T05:31:56Z"
}
],
"memo": "<string>",
"metadata": {},
"reference_number": "<string>"
},
"original_principal": 123,
"credit_limit": 123,
"fee_percentage": "<string>",
"loan_term_months": 123,
"completed_at": "2023-11-07T05:31:56Z",
"cancelled_at": "2023-11-07T05:31:56Z",
"archived_at": "2023-11-07T05:31:56Z",
"memo": "<string>",
"metadata": {},
"reference_number": "<string>"
}
}Update a loan
Updates a loan. Only the fields you include are changed. The request shape depends on loan_type.
curl --request PATCH \
--url https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"loan_type": "TERM_LOAN",
"display_name": "<string>",
"origination_date": "2023-12-25",
"original_principal": 123,
"loan_term_months": 123,
"proceeds": [
{
"loan_proceed_type": "ASSET",
"amount": 123,
"date": "2023-12-25",
"asset": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_id": "<string>"
},
"external_id": "<string>",
"included_in_opening_balance": false
}
],
"opening_balance": {
"balance": 123,
"effective_at": "2023-11-07T05:31:56Z"
},
"reported_balance": {
"balance": 123,
"at": "2023-11-07T05:31:56Z"
},
"memo": "<string>",
"metadata": {},
"reference_number": "<string>"
}
'import requests
url = "https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}"
payload = {
"loan_type": "TERM_LOAN",
"display_name": "<string>",
"origination_date": "2023-12-25",
"original_principal": 123,
"loan_term_months": 123,
"proceeds": [
{
"loan_proceed_type": "ASSET",
"amount": 123,
"date": "2023-12-25",
"asset": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_id": "<string>"
},
"external_id": "<string>",
"included_in_opening_balance": False
}
],
"opening_balance": {
"balance": 123,
"effective_at": "2023-11-07T05:31:56Z"
},
"reported_balance": {
"balance": 123,
"at": "2023-11-07T05:31:56Z"
},
"memo": "<string>",
"metadata": {},
"reference_number": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
loan_type: 'TERM_LOAN',
display_name: '<string>',
origination_date: '2023-12-25',
original_principal: 123,
loan_term_months: 123,
proceeds: [
{
loan_proceed_type: 'ASSET',
amount: 123,
date: '2023-12-25',
asset: {id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', external_id: '<string>'},
external_id: '<string>',
included_in_opening_balance: false
}
],
opening_balance: {balance: 123, effective_at: '2023-11-07T05:31:56Z'},
reported_balance: {balance: 123, at: '2023-11-07T05:31:56Z'},
memo: '<string>',
metadata: {},
reference_number: '<string>'
})
};
fetch('https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}', 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://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'loan_type' => 'TERM_LOAN',
'display_name' => '<string>',
'origination_date' => '2023-12-25',
'original_principal' => 123,
'loan_term_months' => 123,
'proceeds' => [
[
'loan_proceed_type' => 'ASSET',
'amount' => 123,
'date' => '2023-12-25',
'asset' => [
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'external_id' => '<string>'
],
'external_id' => '<string>',
'included_in_opening_balance' => false
]
],
'opening_balance' => [
'balance' => 123,
'effective_at' => '2023-11-07T05:31:56Z'
],
'reported_balance' => [
'balance' => 123,
'at' => '2023-11-07T05:31:56Z'
],
'memo' => '<string>',
'metadata' => [
],
'reference_number' => '<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://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}"
payload := strings.NewReader("{\n \"loan_type\": \"TERM_LOAN\",\n \"display_name\": \"<string>\",\n \"origination_date\": \"2023-12-25\",\n \"original_principal\": 123,\n \"loan_term_months\": 123,\n \"proceeds\": [\n {\n \"loan_proceed_type\": \"ASSET\",\n \"amount\": 123,\n \"date\": \"2023-12-25\",\n \"asset\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"external_id\": \"<string>\"\n },\n \"external_id\": \"<string>\",\n \"included_in_opening_balance\": false\n }\n ],\n \"opening_balance\": {\n \"balance\": 123,\n \"effective_at\": \"2023-11-07T05:31:56Z\"\n },\n \"reported_balance\": {\n \"balance\": 123,\n \"at\": \"2023-11-07T05:31:56Z\"\n },\n \"memo\": \"<string>\",\n \"metadata\": {},\n \"reference_number\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"loan_type\": \"TERM_LOAN\",\n \"display_name\": \"<string>\",\n \"origination_date\": \"2023-12-25\",\n \"original_principal\": 123,\n \"loan_term_months\": 123,\n \"proceeds\": [\n {\n \"loan_proceed_type\": \"ASSET\",\n \"amount\": 123,\n \"date\": \"2023-12-25\",\n \"asset\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"external_id\": \"<string>\"\n },\n \"external_id\": \"<string>\",\n \"included_in_opening_balance\": false\n }\n ],\n \"opening_balance\": {\n \"balance\": 123,\n \"effective_at\": \"2023-11-07T05:31:56Z\"\n },\n \"reported_balance\": {\n \"balance\": 123,\n \"at\": \"2023-11-07T05:31:56Z\"\n },\n \"memo\": \"<string>\",\n \"metadata\": {},\n \"reference_number\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.layerfi.com/v1/businesses/{businessId}/loans/{loanId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"loan_type\": \"TERM_LOAN\",\n \"display_name\": \"<string>\",\n \"origination_date\": \"2023-12-25\",\n \"original_principal\": 123,\n \"loan_term_months\": 123,\n \"proceeds\": [\n {\n \"loan_proceed_type\": \"ASSET\",\n \"amount\": 123,\n \"date\": \"2023-12-25\",\n \"asset\": {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"external_id\": \"<string>\"\n },\n \"external_id\": \"<string>\",\n \"included_in_opening_balance\": false\n }\n ],\n \"opening_balance\": {\n \"balance\": 123,\n \"effective_at\": \"2023-11-07T05:31:56Z\"\n },\n \"reported_balance\": {\n \"balance\": 123,\n \"at\": \"2023-11-07T05:31:56Z\"\n },\n \"memo\": \"<string>\",\n \"metadata\": {},\n \"reference_number\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"business_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"display_name": "<string>",
"loan_account": {
"type": "Single_Chart_Account",
"id": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"name": "Current Assets",
"account_number": "4000",
"stable_name": {
"type": "StableName",
"stable_name": "CURRENT_ASSETS"
},
"account_type": {
"display_name": "Asset"
},
"account_subtype": {
"display_name": "Current Assets"
}
},
"current_balance": 123,
"origination_date": "2023-12-25",
"transaction_tags": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"key": "ExampleTagKey",
"value": "ExampleTagValue",
"dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"definition_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"dimension_display_name": "<string>",
"value_display_name": "<string>",
"archived_at": "2023-11-07T05:31:56Z"
}
],
"external_id": "<string>",
"opening_balance": {
"ledger_account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"ledger_account_name": "<string>",
"balance": 123,
"effective_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"transaction_tags": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"key": "ExampleTagKey",
"value": "ExampleTagValue",
"dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"definition_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"dimension_display_name": "<string>",
"value_display_name": "<string>",
"archived_at": "2023-11-07T05:31:56Z"
}
],
"memo": "<string>",
"metadata": {},
"reference_number": "<string>"
},
"original_principal": 123,
"credit_limit": 123,
"fee_percentage": "<string>",
"loan_term_months": 123,
"completed_at": "2023-11-07T05:31:56Z",
"cancelled_at": "2023-11-07T05:31:56Z",
"archived_at": "2023-11-07T05:31:56Z",
"memo": "<string>",
"metadata": {},
"reference_number": "<string>"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The UUID of the business.
The UUID of the loan.
Body
The loan fields to update.
- Term loan
- Merchant cash advance
- Flex loan
- Line of credit
- Lease
- Equipment financing
Parameters for updating a loan. The shape depends on loan_type.
Discriminator. Must be TERM_LOAN.
TERM_LOAN Updated display name for the loan.
Updated origination date.
Updated original principal, in cents.
Updated term, in months.
Replaces the loan's proceeds with this list.
A loan proceed: funds (or an asset) received from the loan.
- Asset proceed
- Disbursement proceed
Show child attributes
Show child attributes
Sets or replaces the loan's opening balance. Pass null explicitly to remove it (the opening balance ledger entry is reversed). Omit to leave it unchanged. Mutually exclusive with reported_balance.
Show child attributes
Show child attributes
Asserts the loan's outstanding principal at a point in time; Layer derives the opening balance from it and recorded history. Recommended when creating a loan that is already partially repaid. Mutually exclusive with opening_balance. Omitting the field and passing null are equivalent: no assertion is made and any existing opening balance is left unchanged.
Show child attributes
Show child attributes
Updated internal note.
Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged.
Updated reference number.
Response
The updated loan.
A loan held by a business. Each loan has a dedicated child ledger (liability) account.
Show child attributes
Show child attributes