Get Active Loans
Query active borrowed positions across margin managers. This endpoint returns loans with their current amounts, shares, and risk ratios. Use it to monitor borrowed positions, track debt levels, and identify positions at risk of liquidation.
Endpoints
There are two endpoints for querying active loans:
By Owner
GET /deepbook-margin/active-loans/{owner}
Returns active loans for all margin managers owned by a specific address.
General Query
GET /deepbook-margin/active-loans
Returns active loans with optional filters.
Use Cases
- Debt Monitoring — Track all borrowed positions for a wallet
- Risk Dashboard — Identify positions approaching liquidation thresholds
- Liquidation Bot — Find positions eligible for liquidation
- Portfolio Analytics — Calculate total debt exposure across positions
Parameters
Path Parameters (By Owner endpoint)
| Parameter | Type | Required | Description |
|---|---|---|---|
owner | string | Yes | Owner wallet address |
Query Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
page | number | No | 0 | Page number (starts from 0) |
perPage | number | No | 10 | Items per page (max 50) |
marginManagerId | string | No | — | Filter by margin manager ID |
marginPoolId | string | No | — | Filter by margin pool ID |
balanceManagerId | string | No | — | Filter by balance manager ID |
api-key | string | Yes | — | Your Surflux API key |
Response
Returns a paginated response with active loan objects.
Pagination Fields
| Field | Type | Description |
|---|---|---|
items | array | Array of active loan objects |
isLastPage | boolean | Whether this is the last page |
currentPage | number | Current page number |
perPage | number | Items per page |
Active Loan Fields
| Field | Type | Description |
|---|---|---|
margin_manager_id | string | Margin manager that holds the loan |
margin_pool_id | string | Margin pool borrowed from |
loan_amount | number | Original borrowed amount |
loan_shares | number | Loan shares (for interest accrual) |
remaining_amount | number | Current remaining debt |
remaining_shares | number | Current remaining debt shares |
risk_ratio | number | null | Current risk ratio (Total Assets / Total Debt) |
checkpoint | number | Checkpoint of last update |
timestamp | string | ISO timestamp |
checkpoint_timestamp_ms | number | Timestamp in milliseconds |
digest | string | Transaction digest |
margin_manager | object | null | Associated margin manager details |