MidnightPositions

List market positions

Cursor-paginated list of current Midnight positions for a market.

:market-id is the stable Midnight market id and is globally unique across supported chains.

The response uses the same public position item shape as GET /v0/midnight/users/{user-address}/positions: { cursor, data }, with type, state fields, collateral balances, and performance analytics.

Filters. Range filters exist on credit, debt, cost_basis, and effective_rate_wad. active_only=true excludes matured markets. The path market id is always enforced.

Pagination. Pass back cursor verbatim on the next call.

Cache. public, max-age=2, stale-while-revalidate=1.

GET
/v0/midnight/markets/{market-id}/positions

Path Parameters

market-id*string

Midnight market id.

Query Parameters

chain_ids?array<>

Filter by chain ids. Required when loan_assets is provided.

types?array<>

Filter by position type.

loan_assets?array<string>

Filter by loan token addresses. Combine with chain_ids; lowercase input is checksummed.

maturities?array<|>

Filter by exact maturity timestamps, in unix seconds.

active_only?string

When true, keep only positions whose market has not matured yet.

Value in"true" | "false"
maturity_gte?|

Filter for maturities greater than or equal to this unix timestamp.

maturity_lte?|

Filter for maturities less than or equal to this unix timestamp.

credit_gte?string

Filter for credit greater than or equal to this value.

Match^-?\d+$
credit_lte?string

Filter for credit less than or equal to this value.

Match^-?\d+$
pending_fee_gte?string

Filter for pending fee greater than or equal to this value.

Match^-?\d+$
pending_fee_lte?string

Filter for pending fee less than or equal to this value.

Match^-?\d+$
debt_gte?string

Filter for debt greater than or equal to this value.

Match^-?\d+$
debt_lte?string

Filter for debt less than or equal to this value.

Match^-?\d+$
cost_basis_gte?string

Filter for cost basis greater than or equal to this value.

Match^-?\d+$
cost_basis_lte?string

Filter for cost basis less than or equal to this value.

Match^-?\d+$
effective_rate_wad_gte?string

Filter for effective rate WAD greater than or equal to this value.

Match^-?\d+$
effective_rate_wad_lte?string

Filter for effective rate WAD less than or equal to this value.

Match^-?\d+$
sort_by?string

Sort field for cursor pagination.

Default"maturity"
Value in"credit" | "debt" | "maturity" | "cost_basis" | "effective_rate_wad"
sort_direction?string

Sort direction for cursor pagination.

Default"desc"
Value in"asc" | "desc"
limit?integer

Maximum number of items to return.

Default100
Range1 <= value <= 100
cursor?string

Opaque cursor from a previous page response.

Length1 <= length

Response Body

application/json

application/json

curl -X GET "https://api.morpho.org/v0/midnight/markets/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"
  }
}