# Get Loans

## Get Current Loans

The investor can use this endpoint to fetch their loans either in pending or in funded statuses.

### HTTPS Request

<mark style="color:blue;">`GET`</mark> `https://api.lenmo.app/api/v3/loans/current_loan/`

This endpoint returns a paginated response for loans that are associated with the investor, and they are completed.

#### Headers

| Name                                          | Type   | Description                                                                 |
| --------------------------------------------- | ------ | --------------------------------------------------------------------------- |
| Accept                                        | String | The content type of the response.                                           |
| X-API-KEY<mark style="color:red;">\*</mark>   | String | The API key that gives the user the authentication to perform this request. |
| X-Timestamp<mark style="color:red;">\*</mark> | String | The timestamp of the request.                                               |
| X-HMAC<mark style="color:red;">\*</mark>      | String | The HMAC generated for the request.                                         |

{% tabs %}
{% tab title="200: OK A paginated list of loans either pending or funded" %}

```javascript
{
   "count":2,
   "next":null,
   "previous":null,
   "results":[
      {
         "id": 1,
         "borrower_card_color": 3,
         "loan_amount": 103213.009,
         "payment_terms": 4,
         "monthly_payment_amount": 40.5,
         "loan_return": 123213.009,
         "is_approved": True,
         "loan_paid_off":  False,
         "loan_balance": 2221.21,
         "interest_rate": 0.03,
         "lender": {
            // ... lender data ...
         },
         "next_payment_date": "2018-10-16 00:00:00+00:00",
         "borrower": {
            // ... borrower data ...
         },
         "status": "funded",
         "loan_due_amount": 900.01,
         "created_date": "2018-10-16 00:00:00+00:00",
         "original_debt": 122.031,
         "collected_amount": 900.1,
         "remaining_debt": 100,
         "collection_fee": 5,
         "collected_percentage": 70.0,
         "net_collected": 800,
         "loan_request_id": 2,
      }, ...
   ]
}
```

{% endtab %}

{% tab title="403: Forbidden Permission Denied" %}

```javascript
{
    "detail": "Authentication credentials were not provided."
}
```

{% endtab %}
{% endtabs %}

#### Sample Request

{% tabs %}
{% tab title="cURL" %}

```clike
curl -X GET "https://api.lenmo.app/api/v3/loans/current_loan/" \
    -H "accept: application/json" \
    -H "X-API-KEY: YOUR_API_KEY" \
    -H "X-Timestamp: REQUEST_TIMESTAMP" \
    -H "X-HMAC: REQUEST_HMAC"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = 'https://api.lenmo.app/api/v3/loans/current_loan/'

headers = {
    'Accept': 'application/json',
    'X-API-KEY': 'YOUR_API_KEY',
    'X-Timestamp': 'REQUEST_TIMESTAMP',
    'X-HMAC': 'REQUEST_HMAC'
}

r = requests.get(url, headers=headers)

print(r.text)
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class Main {
    public static void main(String[] args) {
        try {
            String urlString = "https://api.lenmo.app/api/v3/loans/current_loan/";
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setRequestProperty("Accept", "application/json");
            connection.setRequestProperty("X-API-KEY", "YOUR_API_KEY");
            connection.setRequestProperty("X-Timestamp", "REQUEST_TIMESTAMP");
            connection.setRequestProperty("X-HMAC", "REQUEST_HMAC");

            BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "utf-8"));
            String inputLine;
            StringBuilder response = new StringBuilder();
            while ((inputLine = in.readLine()) != null) {
                response.append(inputLine);
            }
            in.close();

            System.out.println(response.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'net/http'
require 'uri'

url = URI("https://api.lenmo.app/api/v3/loans/current_loan/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Accept"] = "application/json"
request["X-API-KEY"] = "YOUR_API_KEY"
request["X-Timestamp"] = "REQUEST_TIMESTAMP"
request["X-HMAC"] = "REQUEST_HMAC"

response = http.request(request)
puts response.body

```

{% endtab %}

{% tab title="Node.Js" %}

```javascript
const fetch = require('node-fetch');

const url = 'https://api.lenmo.app/api/v3/loans/current_loan/';

const headers = {
    "Accept": "application/json",
    "X-API-KEY": "YOUR_API_KEY",
    "X-Timestamp": "REQUEST_TIMESTAMP",
    "X-HMAC": "REQUEST_HMAC",
};

fetch(url, {
    method: 'GET',
    headers: headers
})
.then(response => response.text())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$url = "https://api.lenmo.app/api/v3/loans/current_loan/";

$headers = [
    "Accept: application/json",
    "X-API-KEY: YOUR_API_KEY",
    "X-Timestamp: REQUEST_TIMESTAMP",
    "X-HMAC: REQUEST_HMAC"
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$response = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);
?>

```

{% endtab %}
{% endtabs %}

## Get Completed Loans

The investor can use this endpoint to fetch their completed loans.

## HTTPS Request

<mark style="color:blue;">`GET`</mark> `https://api.lenmo.app/api/v3/loans/completed_loan/`

This endpoint returns a paginated response for loans that are associated with the investor, and they are completed.

#### Headers

| Name                                          | Type   | Description                                                                 |
| --------------------------------------------- | ------ | --------------------------------------------------------------------------- |
| Accept                                        | String | The content type of the response.                                           |
| X-API-KEY<mark style="color:red;">\*</mark>   | String | The API key that gives the user the authentication to perform this request. |
| X-Timestamp<mark style="color:red;">\*</mark> | String | The timestamp of the request.                                               |
| X-HMAC<mark style="color:red;">\*</mark>      | String | The HMAC generated for the request.                                         |

{% tabs %}
{% tab title="200: OK A paginated list of loans either pending or funded" %}

```javascript
{
   "count":2,
   "next":null,
   "previous":null,
   "results":[
      {
         "id": 1,
         "borrower_card_color": 3,
         "loan_amount": 103213.009,
         "payment_terms": 4,
         "monthly_payment_amount": 40.5,
         "loan_return": 123213.009,
         "is_approved": True,
         "loan_paid_off":  False,
         "loan_balance": 2221.21,
         "interest_rate": 0.03,
         "lender": {
            // ... lender data ...
         },
         "next_payment_date": "2018-10-16 00:00:00+00:00",
         "borrower": {
            // ... borrower data ...
         },
         "status": "funded",
         "loan_due_amount": 900.01,
         "created_date": "2018-10-16 00:00:00+00:00",
         "original_debt": 122.031,
         "collected_amount": 900.1,
         "remaining_debt": 100,
         "collection_fee": 5,
         "collected_percentage": 70.0,
         "net_collected": 800,
         "loan_request_id": 2,
      }, ...
   ]
}
```

{% endtab %}

{% tab title="403: Forbidden Permission Denied" %}

```javascript
{
    "detail": "Authentication credentials were not provided."
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="cURL" %}

```clike
curl -X GET "https://api.lenmo.app/api/v3/loans/completed_loan/" \
    -H "accept: application/json" \
    -H "X-API-KEY: YOUR_API_KEY" \
    -H "X-Timestamp: REQUEST_TIMESTAMP" \
    -H "X-HMAC: REQUEST_HMAC"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

# Fetch completed loans for the investor
url = 'https://api.lenmo.app/api/v3/loans/completed_loan/'

headers = {
    'Accept': 'application/json',
    'X-API-KEY': 'YOUR_API_KEY',
    'X-Timestamp': 'REQUEST_TIMESTAMP',
    'X-HMAC': 'REQUEST_HMAC'
}

r = requests.get(url, headers=headers)

print(r.text)curl -X GET "https://api.lenmo.app/api/v3/loans/completed_loan/" \
    -H "accept: application/json" \
    -H "X-API-KEY: YOUR_API_KEY" \
    -H "X-Timestamp: REQUEST_TIMESTAMP" \
    -H "X-HMAC: REQUEST_HMAC"curl -X GET "https://api.lenmo.app/api/v3/loans/completed_loan/" \
    -H "accept: application/json" \
    -H "X-API-KEY: YOUR_API_KEY" \
    -H "X-Timestamp: REQUEST_TIMESTAMP" \
    -H "X-HMAC: REQUEST_HMAC"
```

{% endtab %}
{% endtabs %}

## Get Collection Loans

The investor can use this endpoint to fetch their funded loans which are in collection status.

## HTTPS Request

<mark style="color:blue;">`GET`</mark> `https://api.lenmo.app/api/v3/loans/collection_loan/`

This endpoint returns a paginated response for loans in collection status that are associated with the investor.

#### Headers

| Name                                          | Type   | Description                                                                 |
| --------------------------------------------- | ------ | --------------------------------------------------------------------------- |
| Accept                                        | String | The content type of the response.                                           |
| X-API-KEY<mark style="color:red;">\*</mark>   | String | The API key that gives the user the authentication to perform this request. |
| X-Timestamp<mark style="color:red;">\*</mark> | String | The timestamp of the request.                                               |
| X-HMAC<mark style="color:red;">\*</mark>      | String | The HMAC generated for the request.                                         |

{% tabs %}
{% tab title="200: OK A paginated list of loans either pending or funded" %}

```javascript
{
   "count":2,
   "next":null,
   "previous":null,
   "results":[
      {
         "id": 1,
         "borrower_card_color": 3,
         "loan_amount": 103213.009,
         "payment_terms": 4,
         "monthly_payment_amount": 40.5,
         "loan_return": 123213.009,
         "is_approved": True,
         "loan_paid_off":  False,
         "loan_balance": 2221.21,
         "interest_rate": 0.03,
         "lender": {
            // ... lender data ...
         },
         "next_payment_date": "2018-10-16 00:00:00+00:00",
         "borrower": {
            // ... borrower data ...
         },
         "status": "funded",
         "loan_due_amount": 900.01,
         "created_date": "2018-10-16 00:00:00+00:00",
         "original_debt": 122.031,
         "collected_amount": 900.1,
         "remaining_debt": 100,
         "collection_fee": 5,
         "collected_percentage": 70.0,
         "net_collected": 800,
         "loan_request_id": 2,
      }, ...
   ]
}
```

{% endtab %}

{% tab title="403: Forbidden Permission Denied" %}

```javascript
{
    "detail": "Authentication credentials were not provided."
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="cURL" %}

```clike
curl -X GET "https://api.lenmo.app/api/v3/loans/collection_loan/" \
    -H "accept: application/json" \
    -H "X-API-KEY: YOUR_API_KEY" \
    -H "X-Timestamp: REQUEST_TIMESTAMP" \
    -H "X-HMAC: REQUEST_HMAC"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

# Fetch loans in collection status for the investor
url = 'https://api.lenmo.app/api/v3/loans/collection_loan/'

headers = {
    'Accept': 'application/json',
    'X-API-KEY': 'YOUR_API_KEY',
    'X-Timestamp': 'REQUEST_TIMESTAMP',
    'X-HMAC': 'REQUEST_HMAC'
}

r = requests.get(url, headers=headers)

print(r.text)
```

{% endtab %}
{% endtabs %}

## Get Default Loans

The investor can use this endpoint to fetch their loans in default status.

## HTTPS Request

<mark style="color:blue;">`GET`</mark> `https://api.lenmo.app/api/v3/loans/default_loan/`

This endpoint returns a paginated response for loans that are associated with the investor, and they are default.

#### Headers

| Name                                          | Type   | Description                                                                 |
| --------------------------------------------- | ------ | --------------------------------------------------------------------------- |
| Accept                                        | String | The content type of the response.                                           |
| X-API-KEY<mark style="color:red;">\*</mark>   | String | The API key that gives the user the authentication to perform this request. |
| X-Timestamp<mark style="color:red;">\*</mark> | String | The timestamp of the request.                                               |
| X-HMAC<mark style="color:red;">\*</mark>      | String | The HMAC generated for the request.                                         |

{% tabs %}
{% tab title="200: OK A paginated list of loans either pending or funded" %}

```javascript
{
   "count":2,
   "next":null,
   "previous":null,
   "results":[
      {
         "id": 1,
         "borrower_card_color": 3,
         "loan_amount": 103213.009,
         "payment_terms": 4,
         "monthly_payment_amount": 40.5,
         "loan_return": 123213.009,
         "is_approved": True,
         "loan_paid_off":  False,
         "loan_balance": 2221.21,
         "interest_rate": 0.03,
         "lender": {
            // ... lender data ...
         },
         "next_payment_date": "2018-10-16 00:00:00+00:00",
         "borrower": {
            // ... borrower data ...
         },
         "status": "funded",
         "loan_due_amount": 900.01,
         "created_date": "2018-10-16 00:00:00+00:00",
         "original_debt": 122.031,
         "collected_amount": 900.1,
         "remaining_debt": 100,
         "collection_fee": 5,
         "collected_percentage": 70.0,
         "net_collected": 800,
         "loan_request_id": 2,
      }, ...
   ]
}
```

{% endtab %}

{% tab title="403: Forbidden Permission Denied" %}

```javascript
{
    "detail": "Authentication credentials were not provided."
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="cURL" %}

```clike
curl -X GET "https://api.lenmo.app/api/v3/loans/default_loan/" \
    -H "accept: application/json" \
    -H "X-API-KEY: YOUR_API_KEY" \
    -H "X-Timestamp: REQUEST_TIMESTAMP" \
    -H "X-HMAC: REQUEST_HMAC"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

# Fetch loans in default status for the investor
url = 'https://api.lenmo.app/api/v3/loans/default_loan/'

headers = {
    'Accept': 'application/json',
    'X-API-KEY': 'YOUR_API_KEY',
    'X-Timestamp': 'REQUEST_TIMESTAMP',
    'X-HMAC': 'REQUEST_HMAC'
}

r = requests.get(url, headers=headers)

print(r.text)
```

{% endtab %}
{% endtabs %}

## Response Parameters

| Parameter                | Type    | Description                                                   |
| ------------------------ | ------- | ------------------------------------------------------------- |
| borrower\_card\_color    | Integer | An integer value that reflect the risk level of the borrower. |
| loan\_amount             | Float   | The amount of loan in USD                                     |
| payment\_terms           | Integer | Number of payments to pay back the loan                       |
| monthly\_payment\_amount | Float   | Payment amount in a month                                     |
| loan\_return             | Float   | Loan return after it is paid off                              |
| is\_approved             | Boolean | Approval status for the loan                                  |
| loan\_paid\_off          | Boolean | Status on the completion of the loan                          |
| loan\_balance            | Float   | Current remaining loan balance to be paid off                 |
| interest\_rate           | Float   | A value between 0.03 to 2.0 for the interest rate of the loan |
| lender                   | Dict    | Contains lender data for loan                                 |
| next\_payment\_date      | Date    | UTC time for the upcoming loan payment                        |
| borrower                 | Dict    | Contains borrower data for loan                               |
| status                   | String  | Current Loan Status                                           |
| loan\_due\_amount        | Float   | The loan due amount                                           |
| created\_date            | Date    | UTC time for loan creation                                    |
| original\_debt           | Float   | Amount of debt for this loan                                  |
| collected\_amount        | Float   | Collected amount of the loan in USD                           |
| remaining\_debt          | Float   | Amount of debt to be collected later                          |
| collection\_fee          | Float   | Fee of collection                                             |
| collected\_percentage    | Float   | Percentage of the collection amount                           |
| net\_collected           | Float   | The net value of the collection amount                        |
| loan\_request\_id        | Integer | Loan request id, associated with this loan                    |
