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 created_at, 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. Positions are ordered newest-first by created_at by default.
Cache. public, max-age=2, stale-while-revalidate=1.
Path Parameters
Midnight market id.
Query Parameters
Filter by chain ids. Supported chains: Ethereum (1) and Base (8453). Required when loan_assets is provided.
items <= 100Filter by position type.
items <= 100Filter by loan token addresses. Combine with chain_ids; lowercase input is checksummed.
items <= 100Filter by exact maturity timestamps, in unix seconds.
items <= 100When true, keep only positions whose market has not matured yet.
Value in
- "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{1,78}$Filter for credit less than or equal to this value.
^\d{1,78}$Filter for pending fee greater than or equal to this value.
^\d{1,78}$Filter for pending fee less than or equal to this value.
^\d{1,78}$Filter for debt greater than or equal to this value.
^\d{1,78}$Filter for debt less than or equal to this value.
^\d{1,78}$Filter for cost basis greater than or equal to this value.
^\d{1,78}$Filter for cost basis less than or equal to this value.
^\d{1,78}$Filter for effective rate WAD greater than or equal to this value.
^-?\d{1,78}$Filter for effective rate WAD less than or equal to this value.
^-?\d{1,78}$Filter for position created_at greater than or equal to this unix timestamp.
Filter for position created_at less than or equal to this unix timestamp.
Sort field for cursor pagination.
"created_at"Value in
- "created_at"
- "credit"
- "debt"
- "maturity"
- "cost_basis"
- "effective_rate_wad"
Sort direction for cursor pagination.
"desc"Value in
- "asc"
- "desc"
Maximum number of items to return.
1 <= value <= 100100Opaque cursor from a previous page response.
1 <= length <= 4096Response Body
application/json
application/json
application/json
curl -X GET "https://example.com/v0/midnight/markets/0xcc9418ea594c6e658650aedd205ce4544b266b69493f56fd2adc65c14bd06738/positions"{ "cursor": "eyJzIjoiY3JlYXRlZEF0IiwiZCI6ImRlc2MiLCJ2IjoiMTc4MzU0NjA5MyIsInZOdWxsIjpmYWxzZSwiaSI6eyJjaGFpbklkIjo4NDUzLCJtYXJrZXRJZCI6IjB4Y2M5NDE4ZWE1OTRjNmU2NTg2NTBhZWRkMjA1Y2U0NTQ0YjI2NmI2OTQ5M2Y1NmZkMmFkYzY1YzE0YmQwNjczOCIsInVzZXJBZGRyZXNzIjoiMHg1MzU2OTBDQjEzMzAyMzJkZDRmMmFjNUI3MjQwNDA3NTFiZEY0QzkxIn0sImYiOiJCcVJWSnR0WEdkeFY1UG1kMlp1VFFFIn0", "data": [ { "chain_id": 8453, "market_id": "0xcc9418ea594c6e658650aedd205ce4544b266b69493f56fd2adc65c14bd06738", "user_address": "0xd4F43105098845fFE89B16E7A3DCdd0A31898118", "loan_token": "0x4200000000000000000000000000000000000006", "maturity": 1784300400, "type": "borrow", "credit": "0", "pending_fee": "0", "last_loss_factor": "0", "loss_factor": "0", "debt": "1046492040981691", "collaterals": [ { "token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "amount": "4000000" } ], "created_at": 1783606647, "cost_basis": "1046483736229728000000000000000000", "effective_rate_wad": "327402597840809" }, { "chain_id": 8453, "market_id": "0xcc9418ea594c6e658650aedd205ce4544b266b69493f56fd2adc65c14bd06738", "user_address": "0x958eB498a4172EA513c79b09E7f064070C5b1917", "loan_token": "0x4200000000000000000000000000000000000006", "maturity": 1784300400, "created_at": 1783584485, "type": "lend", "credit": "1481439992020013", "pending_fee": "0", "last_loss_factor": "0", "loss_factor": "0", "debt": "0", "cost_basis": "1480000000000000000000000000000000", "effective_rate_wad": "41189691462004744", "collaterals": [] }, { "chain_id": 8453, "market_id": "0xcc9418ea594c6e658650aedd205ce4544b266b69493f56fd2adc65c14bd06738", "user_address": "0x535690CB1330232dd4f2ac5B724040751bdF4C91", "loan_token": "0x4200000000000000000000000000000000000006", "maturity": 1784300400, "created_at": 1783546093, "type": "borrow", "credit": "0", "pending_fee": "0", "last_loss_factor": "0", "loss_factor": "0", "debt": "80001344022580", "cost_basis": "80000000000000000000000000000000", "effective_rate_wad": "763977389592662", "collaterals": [ { "token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "amount": "1000000" } ] } ]}{ "error": { "code": "VALIDATION_FAILED", "message": "Validation failed", "details": [ { "code": "invalid_type", "message": "Expected number, received string", "path": [ "chain_ids", 0 ] } ], "request_id": "f0e1d2c3-b4a5-4968-8728-1c0d1e2f3a4b" }}{ "error": { "code": "INTERNAL_ERROR", "message": "Internal server error", "details": null, "request_id": "f0e1d2c3-b4a5-4968-8728-1c0d1e2f3a4b" }}