Upsert Customer Batch
Creates or updates a large batch of customer resources along with their entire loan and payment history within a single request. The maximum amount of resources permitted is 1000 items per batch request. If an object within a batch is malformed in some way, or violates any validation rules, then that object will simply be skipped. All other objects in the same request may still succeed.
Authorization OAuth 2.0
This request requires OAuth 2.0 authorization.
Header Parameters
Request Parameters
customers
arrayrequiredcustomer_id
stringrequiredThe LMS generated customer ID.
customers.loans
arrayrequiredloan_id
stringrequiredThe LMS generated loan ID.
lead_id
integerrequired withoutThe Decision Cloud generated lead ID.
DANGER
Required without management_system_id
management_system_id
integerrequired withoutThe Decision Cloud generated management system ID.
DANGER
Required without lead_id
is_lead_loan
booleanrequiredDetermines if this is the loan generated at the time of the lead post.
application_type
stringEnum:
NewReturningRefinancedloan_type
stringEnum:
PaydayInstallmentLine Of Creditloan_status
stringEnum:
PendingExpiredWithdrawnDeniedApprovedOriginatedReversedPast DueWritten OffCurrentPaid In Fullloan_amount
integerrequiredThe principal loan amount in cents.
funded_amount
integerThe amount in cents of cash that was actually supplied to the consumer.
first_payment_date
stringThe first payment due date. Must be a valid date in ISO 8601 format YYYY-MM-DD.
applied_at
stringrequiredThe datetime the application was submitted. Must be a valid date in ISO 8601 format YYYY-MM-DDTHH:mm:ssZ.
esigned_at
stringThe datetime the electronic signature was received. Must be a valid date in ISO 8601 format YYYY-MM-DDTHH:mm:ssZ.
withdrawn_at
stringThe datetime the loan was withdrawn. Must be a valid date in ISO 8601 format YYYY-MM-DDTHH:mm:ssZ.
originated_at
stringThe datetime the loan was originated. Must be a valid date in ISO 8601 format YYYY-MM-DDTHH:mm:ssZ.
customers.loans.payments
arraypayment_id
stringrequiredThe LMS generated payment ID.
payment_amount
integerThe payment amount in cents.
payment_type
stringEnum:
Funding PaymentFirst PaymentPaymentAdditional PaymentMakeup PaymentPayoffOtherpayment_mode
stringEnum:
ACHACH CollectionCashier CheckPersonal CheckCashCredit CardDebit CardMoney OrderMoney GramLoan TransferWire TransferWestern UnionOtherpayment_status
stringEnum:
PendingPaidPartially PaidLateReturnedFailedOtherprincipal
integerTotal amount in cents of principal paid.
interest
integerTotal amount in cents of interest paid.
fees
integerTotal amount in cents of any fees paid.
return_code
stringThe ACH return code if the payment is a reversal.
returned_at
stringrequired withThe datetime the return came back from the bank. Must be a valid date in ISO 8601 format YYYY-MM-DDTHH:mm:ssZ.
DANGER
Required with return_code
fail_code
stringThe payment transaction response fail code.
failed_at
stringrequired withThe datetime the payment transaction failed. Must be a valid date in ISO 8601 format YYYY-MM-DDTHH:mm:ssZ.
DANGER
Required with fail_code
payment_at
stringrequiredThe datetime of this payment transaction. Must be a valid date in ISO 8601 format YYYY-MM-DDTHH:mm:ssZ.
POST /api/v1/loan-performance/batches/customers
curl --request POST \
"https://api.decisioncloud.me/api/v1/loan-performance/batches/customers" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"customers\": [
{
\"customer_id\": \"{CUSTOMER_ID}\",
\"loans\": [
{
\"loan_id\": \"{LOAN_ID}\",
\"lead_id\": 1,
\"management_system_id\": 1,
\"is_lead_loan\": true,
\"application_type\": \"New\",
\"loan_type\": \"Installment\",
\"loan_status\": \"Pending\",
\"loan_amount\": 75000,
\"funded_amount\": 35000,
\"first_payment_date\": \"2021-09-25\",
\"applied_at\": \"2021-09-25T04:01:57Z\",
\"esigned_at\": \"2021-09-25T04:01:57Z\",
\"withdrawn_at\": \"2021-09-25T04:01:57Z\",
\"originated_at\": \"2021-09-25T04:01:57Z\",
\"payments\": [
{
\"payment_id\": \"{PAYMENT_ID}\",
\"payment_amount\": 8500,
\"payment_type\": \"First Payment\",
\"payment_mode\": \"ACH\",
\"payment_status\": \"Returned\",
\"principal\": 6500,
\"interest\": 500,
\"fees\": 1500,
\"return_code\": \"RO1\",
\"returned_at\": \"2021-09-25T04:02:05Z\",
\"fail_code\": \"01\",
\"failed_at\": \"2021-09-25T04:02:05Z\",
\"payment_at\": \"2021-09-25T04:01:57Z\"
}
]
}
]
}
]
}"const url = new URL(
"https://api.decisioncloud.me/api/v1/loan-performance/batches/customers"
);
const headers = {
"Authorization": "Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"customers": [
{
"customer_id": "{CUSTOMER_ID}",
"loans": [
{
"loan_id": "{LOAN_ID}",
"lead_id": 1,
"management_system_id": 1,
"is_lead_loan": true,
"application_type": "New",
"loan_type": "Installment",
"loan_status": "Pending",
"loan_amount": 75000,
"funded_amount": 35000,
"first_payment_date": "2021-09-25",
"applied_at": "2021-09-25T04:01:57Z",
"esigned_at": "2021-09-25T04:01:57Z",
"withdrawn_at": "2021-09-25T04:01:57Z",
"originated_at": "2021-09-25T04:01:57Z",
"payments": [
{
"payment_id": "{PAYMENT_ID}",
"payment_amount": 8500,
"payment_type": "First Payment",
"payment_mode": "ACH",
"payment_status": "Returned",
"principal": 6500,
"interest": 500,
"fees": 1500,
"return_code": "RO1",
"returned_at": "2021-09-25T04:02:05Z",
"fail_code": "01",
"failed_at": "2021-09-25T04:02:05Z",
"payment_at": "2021-09-25T04:01:57Z"
}
]
}
]
}
]
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api.decisioncloud.me/api/v1/loan-performance/batches/customers',
[
'headers' => [
'Authorization' => 'Bearer {ACCESS_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'customers' => [
[
'customer_id' => '{CUSTOMER_ID}',
'loans' => [
[
'loan_id' => '{LOAN_ID}',
'lead_id' => 1,
'management_system_id' => 1,
'is_lead_loan' => true,
'application_type' => 'New',
'loan_type' => 'Installment',
'loan_status' => 'Pending',
'loan_amount' => 75000,
'funded_amount' => 35000,
'first_payment_date' => '2021-09-25',
'applied_at' => '2021-09-25T04:01:57Z',
'esigned_at' => '2021-09-25T04:01:57Z',
'withdrawn_at' => '2021-09-25T04:01:57Z',
'originated_at' => '2021-09-25T04:01:57Z',
'payments' => [
[
'payment_id' => '{PAYMENT_ID}',
'payment_amount' => 8500,
'payment_type' => 'First Payment',
'payment_mode' => 'ACH',
'payment_status' => 'Returned',
'principal' => 6500,
'interest' => 500,
'fees' => 1500,
'return_code' => 'RO1',
'returned_at' => '2021-09-25T04:02:05Z',
'fail_code' => '01',
'failed_at' => '2021-09-25T04:02:05Z',
'payment_at' => '2021-09-25T04:01:57Z',
],
],
],
],
],
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://api.decisioncloud.me/api/v1/loan-performance/batches/customers'
payload = {
"customers": [
{
"customer_id": "{CUSTOMER_ID}",
"loans": [
{
"loan_id": "{LOAN_ID}",
"lead_id": 1,
"management_system_id": 1,
"is_lead_loan": true,
"application_type": "New",
"loan_type": "Installment",
"loan_status": "Pending",
"loan_amount": 75000,
"funded_amount": 35000,
"first_payment_date": "2021-09-25",
"applied_at": "2021-09-25T04:01:57Z",
"esigned_at": "2021-09-25T04:01:57Z",
"withdrawn_at": "2021-09-25T04:01:57Z",
"originated_at": "2021-09-25T04:01:57Z",
"payments": [
{
"payment_id": "{PAYMENT_ID}",
"payment_amount": 8500,
"payment_type": "First Payment",
"payment_mode": "ACH",
"payment_status": "Returned",
"principal": 6500,
"interest": 500,
"fees": 1500,
"return_code": "RO1",
"returned_at": "2021-09-25T04:02:05Z",
"fail_code": "01",
"failed_at": "2021-09-25T04:02:05Z",
"payment_at": "2021-09-25T04:01:57Z"
}
]
}
]
}
]
}
headers = {
'Authorization': 'Bearer {ACCESS_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()null