Lending
Create Loan Offer
Offer a peer-to-peer loan with interest and collateral terms
POST
/
lending
/
offers
Create Loan Offer
curl --request POST \
--url https://api.example.com/lending/offers \
--header 'Content-Type: application/json' \
--data '
{
"amount": 123,
"currency": "<string>",
"interestRate": 123,
"durationDays": 123,
"collateralPercent": 123,
"expiresInHours": 123
}
'import requests
url = "https://api.example.com/lending/offers"
payload = {
"amount": 123,
"currency": "<string>",
"interestRate": 123,
"durationDays": 123,
"collateralPercent": 123,
"expiresInHours": 123
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 123,
currency: '<string>',
interestRate: 123,
durationDays: 123,
collateralPercent: 123,
expiresInHours: 123
})
};
fetch('https://api.example.com/lending/offers', 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/lending/offers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 123,
'currency' => '<string>',
'interestRate' => 123,
'durationDays' => 123,
'collateralPercent' => 123,
'expiresInHours' => 123
]),
CURLOPT_HTTPHEADER => [
"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://api.example.com/lending/offers"
payload := strings.NewReader("{\n \"amount\": 123,\n \"currency\": \"<string>\",\n \"interestRate\": 123,\n \"durationDays\": 123,\n \"collateralPercent\": 123,\n \"expiresInHours\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://api.example.com/lending/offers")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 123,\n \"currency\": \"<string>\",\n \"interestRate\": 123,\n \"durationDays\": 123,\n \"collateralPercent\": 123,\n \"expiresInHours\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/lending/offers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 123,\n \"currency\": \"<string>\",\n \"interestRate\": 123,\n \"durationDays\": 123,\n \"collateralPercent\": 123,\n \"expiresInHours\": 123\n}"
response = http.request(request)
puts response.read_bodyRequest
number
required
Amount to lend.
string
required
Currency code.
number
required
Interest rate as percentage (e.g.
5 for 5%).number
required
Loan duration in days.
number
required
Collateral requirement as percentage of loan amount.
number
Hours until the offer expires (optional).
curl -X POST https://api.midasprotocol.org/lending/offers \
-H "Authorization: Bearer pp_your_key" \
-H "Content-Type: application/json" \
-d '{
"amount": 100, "currency": "USDC", "interestRate": 5,
"durationDays": 30, "collateralPercent": 50
}'
Response
{
"id": "uuid",
"lenderId": "your-uuid",
"amount": "100.00",
"currency": "USDC",
"interestRate": 5,
"durationDays": 30,
"collateralPercent": 50,
"status": "OPEN",
"expiresAt": null
}
The loan amount is placed in escrow when the offer is created.
⌘I
Create Loan Offer
curl --request POST \
--url https://api.example.com/lending/offers \
--header 'Content-Type: application/json' \
--data '
{
"amount": 123,
"currency": "<string>",
"interestRate": 123,
"durationDays": 123,
"collateralPercent": 123,
"expiresInHours": 123
}
'import requests
url = "https://api.example.com/lending/offers"
payload = {
"amount": 123,
"currency": "<string>",
"interestRate": 123,
"durationDays": 123,
"collateralPercent": 123,
"expiresInHours": 123
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 123,
currency: '<string>',
interestRate: 123,
durationDays: 123,
collateralPercent: 123,
expiresInHours: 123
})
};
fetch('https://api.example.com/lending/offers', 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/lending/offers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 123,
'currency' => '<string>',
'interestRate' => 123,
'durationDays' => 123,
'collateralPercent' => 123,
'expiresInHours' => 123
]),
CURLOPT_HTTPHEADER => [
"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://api.example.com/lending/offers"
payload := strings.NewReader("{\n \"amount\": 123,\n \"currency\": \"<string>\",\n \"interestRate\": 123,\n \"durationDays\": 123,\n \"collateralPercent\": 123,\n \"expiresInHours\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://api.example.com/lending/offers")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 123,\n \"currency\": \"<string>\",\n \"interestRate\": 123,\n \"durationDays\": 123,\n \"collateralPercent\": 123,\n \"expiresInHours\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/lending/offers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 123,\n \"currency\": \"<string>\",\n \"interestRate\": 123,\n \"durationDays\": 123,\n \"collateralPercent\": 123,\n \"expiresInHours\": 123\n}"
response = http.request(request)
puts response.read_body