Borrowing
Borrow More
Draw additional funds against an existing loan
POST
/
lending-external-securities-v2
/
api
/
positions
/
{marketId}
/
borrow-more
curl -X POST "https://api.trusset.org/lending-external-securities-v2/api/positions/{marketId}/borrow-more" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{"loanId": 5, "amount": "10000"}'
const url = `https://api.trusset.org/lending-external-securities-v2/api/positions/${marketId}/borrow-more`;
const headers = {
'X-API-Key': 'trusset_your_key_here',
'Content-Type': 'application/json'
};
const res = await fetch(url, {
method: 'POST',
headers,
body: JSON.stringify({ loanId: 5, amount: '10000' })
});
const { data } = await res.json();
const tx = await borrowerWallet.sendTransaction(data.transaction);
await tx.wait();
await fetch(url, {
method: 'POST',
headers,
body: JSON.stringify({ loanId: 5, txHash: tx.hash })
});
{
"success": true,
"data": {
"action": "SIGN_TRANSACTION",
"transaction": {
"to": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"data": "0x...",
"value": "0",
"chainId": 11155111
},
"functionName": "borrowMore",
"paidTo": "0xaBc7f1093D5E26B804a1C3f78dE025916B47C0d3",
"payeeAddress": null,
"transactionFee": {
"kind": "OPEN",
"fee": "2.0",
"feeRaw": "2000000",
"borrowed": "10000.0",
"netDisbursed": "9998.0",
"netDisbursedRaw": "9998000000",
"message": "This market charges a loan opening fee of 2.0 USDC on this draw, withheld from the amount paid out: the debt grows by 10000.0 USDC and the borrower receives 9998.0 USDC."
},
"warnings": [
"This market charges a loan opening fee of 2.0 USDC on this draw, withheld from the amount paid out: the debt grows by 10000.0 USDC and the borrower receives 9998.0 USDC."
],
"confirmWith": {
"endpoint": "POST /lending-external-securities-v2/api/positions/cmssh7p1k0001cghxq2m4v8rz/borrow-more",
"field": "txHash",
"body": { "loanId": "5", "txHash": null }
}
}
}
{
"success": true,
"data": {
"txHash": "0x5c8e1a7f9b3d2046e1c7a9f08b4d6e2317c5a0f9e8d7b6c5a4f3e2d1c0b9a8f7",
"loanId": "5",
"additionalBorrow": "10000.0",
"paidTo": "0xabc7f1093d5e26b804a1c3f78de025916b47c0d3"
}
}
{
"success": false,
"error": {
"code": "FIXED_RATE_LOAN",
"message": "Loan 5 carries a stamped fixed rate of 800 bps, and additional draws on a stamped loan are refused by the market. Open a new loan at current terms instead."
}
}
Increases the borrowed amount on an active loan without posting more collateral. Only the loan’s borrower can sign it: the contract reverts for any other sender. It also reverts if the resulting debt would exceed what the existing collateral supports at the current price.
Single transaction in both modes. No approval is involved because funds move out of the pool, not in.
On a
While a Dutch auction is open against the loan, the contract reverts the draw. The API does not check for an open auction before offering calldata.
Confirming with
A loan carrying a stamped fixed rate cannot be drawn on again. The extra principal would ride on a rate stamped for a different amount at a different time, so the market refuses it. The call comes back as
FIXED_RATE_LOAN and the message names the stamped rate. Open a new loan at current terms instead.MARKET-priced market the API builds no further draw until the market’s borrower register qualifies as a professional gate, the same check Open Loan runs. It refuses with 409 PROFESSIONAL_BORROWER_GATE_REQUIRED, details.field: "borrowerRegistry", right after the lender-of-record check. A loan already open is not touched: repaying, adding collateral and closing stay open. See Professional borrowers.
Path Parameters
string
required
Body Parameters
integer
required
On-chain loan ID. A positive integer. Accepted as a JSON number or as a numeric string, so the value Get Loan returns passes straight back.
string
Additional amount to borrow, as a positive decimal string in borrow asset units. The loan’s debt grows by this amount. Required when building calldata, not needed on the confirm call.
object
EIP-712 signed price from Sign Price. Omit to price against the stored oracle value. A market that prices from an external feed refuses a signed price with
EXTERNAL_FEED_ACTIVE, and a market with a fixed price with FIXED_PRICE_ACTIVE.string
Hash of the transaction you broadcast for this operation. Send it to confirm the transaction and record the result. Omit it to receive the calldata.
Draws on a loan with a payee
A loan opened with apayToAddress pays every draw to that payee, never to the signing wallet. The payee was fixed when the loan was opened and cannot be changed. The calldata response names it in paidTo and payeeAddress, and its warnings state it. See Pay the proceeds to another wallet.
The payee must still pass the market’s borrower register. A payee the register no longer admits is refused with 400 PAYEE_NOT_VERIFIED, or with 409 IDENTITY_GATE_RETIRED when the register is the previous Trusset ID Register, and one whose removal is pending with 409 ELIGIBILITY_REMOVAL_PENDING. Either refusal holds until the payee is admitted again, because no other wallet can take its place. Repaying, adding collateral and closing are not affected. When where the draw would be paid cannot be read, the call answers 503 MARKET_STATE_UNAVAILABLE.
Opening fee and vault draws
A market that charges an opening fee charges it on every draw, this one included. The debt grows byamount and the borrower receives amount less the fee, which is the flat fee or 0.5 percent of amount, whichever is smaller. The calldata response then carries transactionFee, shaped as on Open Loan, and its message in warnings.
On a market that draws on vault liquidity, a draw larger than the pool’s borrowable liquidity pulls the shortfall from the registered vaults in the same transaction. The API does not refuse such a draw for liquidity, because the market itself is the final gate there. The confirm response lists each vault draw in vaultDraws.
Response Fields
object
Show child attributes
Show child attributes
string
SIGN_TRANSACTION when txHash is omitted.object
Unsigned transaction,
{ to, data, value, chainId }, for the borrowMore call. Returned when txHash is omitted.string
borrowMore. Returned when txHash is omitted.string
The wallet this draw pays, checksummed: the loan’s payee, or the borrower when the loan has none. Returned when
txHash is omitted.string
The loan’s payee, checksummed, or
null when the loan pays its borrower. Returned when txHash is omitted.object
{ endpoint, field, body }: this route, txHash as the field, and a body carrying loanId with txHash: null. Returned when txHash is omitted.object
The opening fee on this draw, present only when it is not zero. Carries
kind: "OPEN", fee, feeRaw, borrowed, netDisbursed, netDisbursedRaw and message.array
Present when a preflight found something that does not block the draw. That is the collateral instrument’s recorded maturity, or a market whose lender of record has published no terms of use. Same object shape and
kind values as on Open Loan. An opening fee adds its message as a plain string.string
Transaction hash. Returned when confirming with
txHash.string
Loan ID, echoed back as a string. Returned when confirming with
txHash.string
The amount the loan’s debt grew by, read from the mined transaction. With an opening fee, the wallet paid received this less the fee. Returned when confirming with
txHash.string
The wallet the draw was paid to: the loan’s recorded payee, or the wallet that sent the transaction. Returned when confirming with
txHash.array
Present when the transaction drew on vault liquidity. Each entry carries
vault (the vault address) and amount (in borrow asset units).Borrowing more moves the loan closer to its liquidation threshold. Read the resulting health factor from Get Loan afterwards, and expose it to the borrower before they commit.
Capacity is checked before any transaction is offered. An amount past what the collateral supports is refused with
EXCEEDS_MAX_BORROW. With a signedPrice, that limit is computed at the signed price, because the contract applies it before it prices the collateral. On a market without vault liquidity, one the pool cannot fund is refused with INSUFFICIENT_LIQUIDITY. Compute headroom from Get Max Borrow against the loan’s collateral, less outstanding principal and accrued interest.curl -X POST "https://api.trusset.org/lending-external-securities-v2/api/positions/{marketId}/borrow-more" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{"loanId": 5, "amount": "10000"}'
const url = `https://api.trusset.org/lending-external-securities-v2/api/positions/${marketId}/borrow-more`;
const headers = {
'X-API-Key': 'trusset_your_key_here',
'Content-Type': 'application/json'
};
const res = await fetch(url, {
method: 'POST',
headers,
body: JSON.stringify({ loanId: 5, amount: '10000' })
});
const { data } = await res.json();
const tx = await borrowerWallet.sendTransaction(data.transaction);
await tx.wait();
await fetch(url, {
method: 'POST',
headers,
body: JSON.stringify({ loanId: 5, txHash: tx.hash })
});
{
"success": true,
"data": {
"action": "SIGN_TRANSACTION",
"transaction": {
"to": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"data": "0x...",
"value": "0",
"chainId": 11155111
},
"functionName": "borrowMore",
"paidTo": "0xaBc7f1093D5E26B804a1C3f78dE025916B47C0d3",
"payeeAddress": null,
"transactionFee": {
"kind": "OPEN",
"fee": "2.0",
"feeRaw": "2000000",
"borrowed": "10000.0",
"netDisbursed": "9998.0",
"netDisbursedRaw": "9998000000",
"message": "This market charges a loan opening fee of 2.0 USDC on this draw, withheld from the amount paid out: the debt grows by 10000.0 USDC and the borrower receives 9998.0 USDC."
},
"warnings": [
"This market charges a loan opening fee of 2.0 USDC on this draw, withheld from the amount paid out: the debt grows by 10000.0 USDC and the borrower receives 9998.0 USDC."
],
"confirmWith": {
"endpoint": "POST /lending-external-securities-v2/api/positions/cmssh7p1k0001cghxq2m4v8rz/borrow-more",
"field": "txHash",
"body": { "loanId": "5", "txHash": null }
}
}
}
{
"success": true,
"data": {
"txHash": "0x5c8e1a7f9b3d2046e1c7a9f08b4d6e2317c5a0f9e8d7b6c5a4f3e2d1c0b9a8f7",
"loanId": "5",
"additionalBorrow": "10000.0",
"paidTo": "0xabc7f1093d5e26b804a1c3f78de025916b47c0d3"
}
}
{
"success": false,
"error": {
"code": "FIXED_RATE_LOAN",
"message": "Loan 5 carries a stamped fixed rate of 800 bps, and additional draws on a stamped loan are refused by the market. Open a new loan at current terms instead."
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
NO_MARKET_ADDRESS | 400 | The market has no on-chain address recorded |
MISSING_MARKET_ID | 400 | marketId is longer than 100 characters |
VALIDATION_ERROR | 400 | loanId is not a positive integer, or amount is missing on the build call, not a positive decimal string, or carries more decimal places than the borrow asset supports |
LOAN_NOT_ACTIVE | 400 | The loan is closed and can no longer be modified |
MARKET_PAUSED | 400 | The market is paused. Its admin must unpause it |
IDENTITY_NOT_VERIFIED | 400 | The borrower is no longer verified on the market’s borrower register. borrowMore runs the same gate as openLoan, so a registration that lapsed mid-loan is refused here. details carries register, requiredProfile and accessList, as on Open Loan |
IDENTITY_GATE_RETIRED | 409 | Returned instead of IDENTITY_NOT_VERIFIED when the borrower register that refuses the borrower is the previous Trusset ID Register. It takes no new identities, so the wallet cannot be added to it. details carries register, gate (identity), retired: true and currentRegistry. The market admin moves the gate to the current register with Set Identity Gates, then retry |
PAYEE_NOT_VERIFIED | 400 | The loan’s payee is no longer admitted to the market’s borrower register. The payee cannot be changed, so draws stay refused until it is admitted again. details carries payee, register, requiredProfile and accessList |
PRICE_STALE | 400 | The price is older than the oracle’s staleness window. On an attested market, push a price with Sync Oracle Price or supply a signedPrice. On an external-feed market, wait for the feed to publish |
EXCEEDS_MAX_BORROW | 400 | The request would take the loan past what its collateral supports, at the signed price when a signedPrice is supplied |
INSUFFICIENT_LIQUIDITY | 400 | The market draws on no vault liquidity and holds less borrowable liquidity than the request, after its reserve earmark |
INVALID_SIGNED_PRICE | 400 | The signedPrice is malformed, expired, dated in the future or older than the oracle’s price age window, or it was signed by a wallet that is not an authorized signer on the market’s oracle, which details.signer then names. Sign a fresh quote with Sign Price |
PRICE_DEVIATION_TOO_LARGE | 400 | The signedPrice moves further from the oracle’s current price than its maxDeviationBps allows |
PRICE_WINDOW_DEVIATION_TOO_LARGE | 400 | The signedPrice falls outside the band the oracle accepts within its current one-hour window |
LOAN_NOT_FOUND | 404 | No loan with that ID exists on this market |
MARKET_NOT_FOUND | 404 | No market with this ID on your instance |
MARKET_PENDING_CURATOR | 409 | The market has no lender of record yet. See Lender of record |
PROFESSIONAL_BORROWER_GATE_REQUIRED | 409 | The market is MARKET-priced and its borrower register does not qualify as a professional gate. details.field is borrowerRegistry |
FIXED_RATE_LOAN | 409 | The loan carries a stamped fixed rate, so the market refuses an additional draw |
COLLATERAL_MATURED | 409 | The collateral instrument passed its recorded maturity, and the record was asserted by a party to this market |
EXTERNAL_FEED_ACTIVE | 409 | A signedPrice was sent to a market that prices from an external feed. Retry without it |
FIXED_PRICE_ACTIVE | 409 | A signedPrice was sent to a market with a fixed price. Retry without it |
SIGNED_PRICE_OUTDATED | 409 | The signedPrice is not dated after the price the oracle already holds, so the oracle would refuse it. Sign a fresh quote |
ELIGIBILITY_REMOVAL_PENDING | 409 | The borrower’s or the payee’s admission to the borrower register is waiting for removal, so no new draw is prepared |
MARKET_STATE_UNAVAILABLE | 503 | The market could not be read to check its price source and borrower register, whether it is paused, its price, its transaction fees, or where the draw would be paid. Retry shortly |
STATE_UNAVAILABLE | 503 | The verification profiles behind a MARKET market’s borrower register could not be read, or the admissions to the borrower register could not be checked for a pending removal. Retry shortly |
PRICE_STATE_UNAVAILABLE | 503 | The oracle could not be read to check the signedPrice, so nothing was built. Retry shortly |
LOAN_STATE_UNAVAILABLE | 503 | The loan or its borrow limit could not be read from the network. Retry shortly |
txHash can also return any transaction verification error.⌘I
curl -X POST "https://api.trusset.org/lending-external-securities-v2/api/positions/{marketId}/borrow-more" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{"loanId": 5, "amount": "10000"}'
const url = `https://api.trusset.org/lending-external-securities-v2/api/positions/${marketId}/borrow-more`;
const headers = {
'X-API-Key': 'trusset_your_key_here',
'Content-Type': 'application/json'
};
const res = await fetch(url, {
method: 'POST',
headers,
body: JSON.stringify({ loanId: 5, amount: '10000' })
});
const { data } = await res.json();
const tx = await borrowerWallet.sendTransaction(data.transaction);
await tx.wait();
await fetch(url, {
method: 'POST',
headers,
body: JSON.stringify({ loanId: 5, txHash: tx.hash })
});
{
"success": true,
"data": {
"action": "SIGN_TRANSACTION",
"transaction": {
"to": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"data": "0x...",
"value": "0",
"chainId": 11155111
},
"functionName": "borrowMore",
"paidTo": "0xaBc7f1093D5E26B804a1C3f78dE025916B47C0d3",
"payeeAddress": null,
"transactionFee": {
"kind": "OPEN",
"fee": "2.0",
"feeRaw": "2000000",
"borrowed": "10000.0",
"netDisbursed": "9998.0",
"netDisbursedRaw": "9998000000",
"message": "This market charges a loan opening fee of 2.0 USDC on this draw, withheld from the amount paid out: the debt grows by 10000.0 USDC and the borrower receives 9998.0 USDC."
},
"warnings": [
"This market charges a loan opening fee of 2.0 USDC on this draw, withheld from the amount paid out: the debt grows by 10000.0 USDC and the borrower receives 9998.0 USDC."
],
"confirmWith": {
"endpoint": "POST /lending-external-securities-v2/api/positions/cmssh7p1k0001cghxq2m4v8rz/borrow-more",
"field": "txHash",
"body": { "loanId": "5", "txHash": null }
}
}
}
{
"success": true,
"data": {
"txHash": "0x5c8e1a7f9b3d2046e1c7a9f08b4d6e2317c5a0f9e8d7b6c5a4f3e2d1c0b9a8f7",
"loanId": "5",
"additionalBorrow": "10000.0",
"paidTo": "0xabc7f1093d5e26b804a1c3f78de025916b47c0d3"
}
}
{
"success": false,
"error": {
"code": "FIXED_RATE_LOAN",
"message": "Loan 5 carries a stamped fixed rate of 800 bps, and additional draws on a stamped loan are refused by the market. Open a new loan at current terms instead."
}
}
