> For the complete documentation index, see [llms.txt](https://docs.banx.gg/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.banx.gg/banx-protocol/how-to-borrow/detailed-borrowing-process.md).

# Detailed borrowing process

<figure><img src="/files/m3JB02c0wHbCGma2SjRL" alt=""><figcaption></figcaption></figure>

### 1. The borrower takes the loan

* Interest starts accruing linearly, every second

### 2. The borrower repays the loan in full

* The borrower repays: the principal, accrued linear interest and the protocol fee
* The borrower recovers full control of their collateral

### 3. The lender sends a refinancing call

* A lender can send a refinancing call to an active loan, at any given time. Reasons why may include:
  * The loan being unhealthy or displaying downward trending health
  * The loan being healthy, and the lender decides to claim the liquidity owed
  * The lender wants to exit this market
* What happens next will be determined by the offers in the order book:

### 4. The order book can auto-refinance the loan

* A healthy loan is more than likely to match an existing offer in the order book
* If so, the loan will be auto-refinanced
* The lender will recover the principal + interest and exit
* The new lender will enter the loan from scratch
* Nothing changes for the borrower, the loan keeps accruing linear interest every second

### 5. The order book cannot auto-refinance the loan

* If the order book contains no better or matching offers, the loan is sent to the refinancing auction

### 6. The 72 hour refinancing auction starts

* The loan will be offered to new lenders on the same terms
* During this time the collateral cannot be liquidated
* The borrower is able to repay if they want to

### 7. New lender refinances via the auction

* Refinancing involves covering the principal of the previous loan and accrued interest, allowing the previous lender to exit in full
* The borrower continues to borrow, and can still repay anytime

### 8. The refinancing auction ends

* The auction ends after 72 hours if no new lender has stepped in to refinance the loan, *and* if the borrower still hasn't repaid
* If this is the case, the lender receives the collateral and the borrower loses it


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.banx.gg/banx-protocol/how-to-borrow/detailed-borrowing-process.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
