Skip to main content
Monitor a Borrow loan by reading its current state on demand or by registering a webhook to receive updates when the loan enters a different health band.

Prerequisites

Before you begin, ensure that you’ve:

Check loan state

Call getLoans with a wallet address and blockchain to fetch a page of the wallet’s loans (up to 100 per call), along with each loan’s collateral, debt, health factor, band, LTV, and liquidation price. Pass the returned pagination.pageAfter cursor back to fetch the next page. If you already have a loanId, call kit.borrow.getPosition({ loanId }) to read that specific loan. It returns the same shape, except the owner field is named wallet instead of walletAddress.
TypeScript
Each Loan looks like:
For what the health fields mean, see How loan health works.

Subscribe to health updates

Register a webhook to receive updates when a loan enters a different health band.

Register a webhook

Call registerWebhook with the loan’s loanId and your webhookUrl. The connected wallet must equal the loan’s persisted owner.
TypeScript
The wallet signs the registration. There is no onchain transaction.

Unregister a webhook

Omit webhookUrl (or pass null) to remove a loan’s current webhook.
TypeScript