# Offer Loan Requests

## HTTPS Request

<mark style="color:green;">`POST`</mark> `https://api.lenmo.app/api/v3/loan_requests/{id}/make_offer/`

#### Path Parameters

| Name                                 | Type | Description                        |
| ------------------------------------ | ---- | ---------------------------------- |
| id<mark style="color:red;">\*</mark> | Long | The loan request id to be offered. |

#### 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.                                         |

#### Request Body

| Name                                                | Type    | Description                                                                                                                |
| --------------------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------- |
| offered\_interest<mark style="color:red;">\*</mark> | Float   | A Float value between 0.03 and 2.0                                                                                         |
| automate\_fund                                      | Boolean | Boolean flag to specify whether to automatically fund the loan after offer acceptance (defaults to false if not provided). |

{% tabs %}
{% tab title="201: Created An offer is created for that loan request." %}

```json
{
    "id": 1,
    "offered_interest": 0.03,
     "offer_status": "pending",
      "lender": { 
        // ...lender data...
      }, 
      "loan_request": { 
        // ...loan request data... 
      },
      "monthly_payment": 100,
      "loan_gain": 100.02,
      "created": "2022-05-27T10:37:14.658672Z",
      "offer_status_changed": "2020-05-06 17:25:01 Etc/GMT",
      "processed_on_dwolla": true,
      "automate_fund": true
}
```

{% endtab %}

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

1. If  authentication credentials are invalid&#x20;

   ```json
   {
       "detail": "Authentication credentials were not provided."
   }
   ```
2. If the investor is currently borrowing

   ```json
   {
       "message": "Borrower can not offer."
   }
   ```

{% endtab %}

{% tab title="400: Bad Request" %}
**Cases:**

1. Offered interest is more than the loan request max interest rate

   ```json
   {
       "message": "The maximum interest rate allowed for this loan request is {loan_request_max_interest_rate}"
   }
   ```
2. The investor does not have sufficient balance to offer the loan (applicable only if automate\_fund is True).

   <pre class="language-json"><code class="lang-json"><strong>{
   </strong><strong>    "message": "Your balance isn't enough to offer this loan. Please add {REQUIRED_AMOUNT} to proceed."
   </strong>}
   </code></pre>
3. The loan request has been canceled

   ```json
   {
       "message": "This Loan Request has been Canceled"
   }
   ```
4. The loan request has been signed

   ```json
   {
       "message": "You can't make an offer to a Signed Loan Request"
   }
   ```
5. The investor already made an offer for this loan request

   <pre class="language-json"><code class="lang-json"><strong>{
   </strong><strong>    "message": "You have already made an offer for this Loan Request"
   </strong><strong>}
   </strong></code></pre>
6. Borrower accepted another offer

   ```json
   {
       "message": "You can't make an offer as the borrower has already accepted another offer"
   }
   ```
7. The investor has no verified bank account.

   ```json
   {
       "message": "We cannot process this request as it appears that your bank account has not been verified. Please verify your bank account and try again later."
   }
   ```

{% endtab %}
{% endtabs %}

#### Sample Request

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

```sh
curl -X POST "https://api.lenmo.app/api/v3/loan_requests/$loan_request_id/make_offer/" \
    -H "accept: application/json" \
    -H "Content-Type: application/json" \
    -H "X-API-KEY: YOUR_API_KEY" \
    -H "X-Timestamp: REQUEST_TIMESTAMP" \
    -H "X-HMAC: REQUEST_HMAC"
    -d '{
            "offered_interest": 0.3,
            "automate_fund": true
        }'
```

{% endtab %}

{% tab title="Python" %}
{% code overflow="wrap" %}

```python
import requests

lq_id = 126315

url = "https://api.lenmo.app/api/v3/loan_requests/{}/make_offer/".format(lq_id)

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

body = {"offered_interest": 1, "automate_fund": True}

r = requests.post(url, json=body, headers=headers)
print(r.text)
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}

```java
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;

public class Main {
    public static void main(String[] args) {
        try {
            int lqId = 126315;
            String urlString = "https://api.lenmo.app/api/v3/loan_requests/" + lqId + "/make_offer/";
            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("POST");
            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");
            connection.setRequestProperty("Content-Type", "application/json; utf-8");
            connection.setDoOutput(true);

            String jsonInputString = "{\"offered_interest\": 1}";
            try(OutputStream os = connection.getOutputStream()) {
                byte[] input = jsonInputString.getBytes("utf-8");
                os.write(input, 0, input.length);
            }

            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 'json'
require 'uri'

lq_id = 126315
url = URI("https://api.lenmo.app/api/v3/loan_requests/#{lq_id}/make_offer/")

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

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

```

{% endtab %}

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

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

const lqId = 126315;
const url = `https://api.lenmo.app/api/v3/loan_requests/${lqId}/make_offer/`;

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

const body = {
    offered_interest: 1
};

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

```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$lqId = 126315;
$url = "https://api.lenmo.app/api/v3/loan_requests/$lqId/make_offer/";

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

$body = json_encode([
    "offered_interest" => 1
]);

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

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

curl_close($ch);
?>

```

{% endtab %}
{% endtabs %}

#### Response Parameters

| Parameter                                                  | Type    | Description                                                              |
| ---------------------------------------------------------- | ------- | ------------------------------------------------------------------------ |
| id                                                         | Long    | Offer id                                                                 |
| offered\_interest                                          | Float   | The interest rate of the offer                                           |
| offer\_status                                              | String  | Status of the offer .e.g `pending`, `accepted`, `rejected`, `expired` .. |
| lender                                                     | Dict    | Contains lender data for loan                                            |
| [loan\_request](/reference/list-borrowers-loan-request.md) | Dict    | Contains loan request details for this offer                             |
| monthly\_payment                                           | Float   | Monthly payment of the offer                                             |
| loan\_gain                                                 | Float   | The loan gain of the offered loan request                                |
| created                                                    | Date    | UTC time of the offer creation on the database                           |
| offer\_status\_changed                                     | Date    | UTC time of the last action took on this offer                           |
| processed\_on\_dwolla                                      | Boolean | Status of transfer associated with the offer                             |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lenme.com/reference/offer-loan-requests.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
