List positions
Cursor-paginated list of a user's current Midnight positions.
Position type. type is lend for positions with credit, borrow for positions with debt, or collateral_only for positions with no credit or debt but remaining collateral. Closed positions with no credit, no debt, and no remaining collateral are excluded.
Performance fields. cost_basis uses the average cost method and is returned as a WAD-scaled bigint string in loan-token units. effective_rate_wad is a WAD-scaled annualized effective rate. Either field can be null when there is not enough attributable history.
Filters. chain_ids is required when loan_assets is provided. Range filters exist on credit, debt, cost_basis, and effective_rate_wad. active_only=true excludes matured markets. listed=true keeps only positions on listed markets; listed=false keeps only positions on unlisted markets.
Pagination. Response envelope: { cursor, data }.
Cache. public, max-age=2, stale-while-revalidate=1.
Path Parameters
User address to list positions for. Lowercase input is checksummed.
Query Parameters
Filter by chain ids. Required when loan_assets is provided.
Filter by Midnight market ids.
Filter by position type.
Filter by loan token addresses. Combine with chain_ids; lowercase input is checksummed.
Filter by exact maturity timestamps, in unix seconds.
When true, keep only positions whose market has not matured yet.
"true" | "false"Filter for maturities greater than or equal to this unix timestamp.
Filter for maturities less than or equal to this unix timestamp.
Filter for credit greater than or equal to this value.
^-?\d+$Filter for credit less than or equal to this value.
^-?\d+$Filter for pending fee greater than or equal to this value.
^-?\d+$Filter for pending fee less than or equal to this value.
^-?\d+$Filter for debt greater than or equal to this value.
^-?\d+$Filter for debt less than or equal to this value.
^-?\d+$Filter for cost basis greater than or equal to this value.
^-?\d+$Filter for cost basis less than or equal to this value.
^-?\d+$Filter for effective rate WAD greater than or equal to this value.
^-?\d+$Filter for effective rate WAD less than or equal to this value.
^-?\d+$Sort field for cursor pagination.
"maturity""credit" | "debt" | "maturity" | "cost_basis" | "effective_rate_wad"Sort direction for cursor pagination.
"desc""asc" | "desc"Maximum number of items to return.
1001 <= value <= 100Opaque cursor from a previous page response.
1 <= lengthFilter by market listing status. When true, returns only positions on listed markets; when false, only positions on unlisted markets. Omit to return both.
"true" | "false"Response Body
application/json
application/json
curl -X GET "https://api.morpho.org/v0/midnight/users/string/positions"{
"cursor": null,
"data": [
{
"chain_id": 8453,
"collaterals": [],
"cost_basis": "950000000000000000000000000000000",
"credit": "1000000000000000",
"debt": "0",
"effective_rate_wad": "52000000000000000",
"last_loss_factor": "0",
"loan_token": "0x4200000000000000000000000000000000000006",
"loss_factor": "0",
"market_id": "0xd92de5e7fbbde5a5e161787426982f7e1b01fb53a7060f95c021236d74447614",
"maturity": 1781276400,
"pending_fee": "0",
"type": "lend",
"user_address": "0x1111111111111111111111111111111111111111"
}
]
}{
"error": {
"code": "INVALID_CURSOR",
"details": null,
"message": "cursor sort/direction does not match request sort/direction",
"request_id": "f0e1d2c3-b4a5-4968-8728-1c0d1e2f3a4b"
}
}