curl --request GET \
--url https://api.example.com/v1/loans/{loan_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.example.com/v1/loans/{loan_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.example.com/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.example.com/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 => "GET",
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.example.com/v1/loans/{loan_id}"
req, _ := http.NewRequest("GET", 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.get("https://api.example.com/v1/loans/{loan_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/loans/{loan_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"loan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "<string>",
"currency": "USD",
"principal_cents": 123,
"interest_cents": 123,
"hold_cents": 123,
"outstanding_cents": 123,
"installments": [
{
"seq": 123,
"amount_due_cents": 123,
"principal_due_cents": 123,
"interest_due_cents": 123,
"amount_paid_cents": 123,
"due_date": "2023-12-25",
"provisional_due_date": "2023-12-25",
"paid_at": "2023-11-07T05:31:56Z",
"status": "<string>"
}
],
"instructions": [
{
"instruction_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kind": "place_hold",
"amount_cents": 123,
"currency": "USD",
"issued_at": "2023-11-07T05:31:56Z"
}
],
"deduction": {
"instruction_version": 2,
"status": "active",
"installment_seq": 123,
"amount_cents": 123,
"currency": "USD",
"deposit_filter": "inbound_bank_transfer_from_outside",
"max_deposit_pct": 100
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
"<unknown>"
]
},
"request_id": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
"<unknown>"
]
},
"request_id": "<string>"
}Read a loan with its pending instructions
The same loan view as the loan of the application view and of every POST /v1/events answer:
the schedule, instructions (pending only, oldest first) and deduction (the current deduction
instruction, null until the first payout). Read it every 30
seconds while status is pending_disbursement or instructions is not empty, and perform what is
listed. Read it once more 1 minute after the loan leaves pending_disbursement, and 1 minute after
every deposit.settled that was sent. Otherwise read each open loan once a day after 06:00
Colombia time. 404 for an unknown loan, a malformed id, or another partner’s loan.
curl --request GET \
--url https://api.example.com/v1/loans/{loan_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.example.com/v1/loans/{loan_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.example.com/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.example.com/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 => "GET",
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.example.com/v1/loans/{loan_id}"
req, _ := http.NewRequest("GET", 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.get("https://api.example.com/v1/loans/{loan_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/loans/{loan_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"loan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "<string>",
"currency": "USD",
"principal_cents": 123,
"interest_cents": 123,
"hold_cents": 123,
"outstanding_cents": 123,
"installments": [
{
"seq": 123,
"amount_due_cents": 123,
"principal_due_cents": 123,
"interest_due_cents": 123,
"amount_paid_cents": 123,
"due_date": "2023-12-25",
"provisional_due_date": "2023-12-25",
"paid_at": "2023-11-07T05:31:56Z",
"status": "<string>"
}
],
"instructions": [
{
"instruction_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kind": "place_hold",
"amount_cents": 123,
"currency": "USD",
"issued_at": "2023-11-07T05:31:56Z"
}
],
"deduction": {
"instruction_version": 2,
"status": "active",
"installment_seq": 123,
"amount_cents": 123,
"currency": "USD",
"deposit_filter": "inbound_bank_transfer_from_outside",
"max_deposit_pct": 100
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
"<unknown>"
]
},
"request_id": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": [
"<unknown>"
]
},
"request_id": "<string>"
}Response
The loan view
Contractual balance, the sum of amount due less amount paid over the current installments. It is 0 while the loan is pending_disbursement or cancelled, because nothing is owed until the payout is confirmed; each installment's amount_due_cents still shows the schedule.
