MidnightPositions

Get position

Detail lookup for a single position by (market-id, user-address).

:market-id is the stable Midnight market id and is globally unique across supported chains. :user-address accepts any casing and is checksummed server-side.

Returns the position inside a data envelope. When the position is closed (no credit, no debt, no remaining collateral) or has never existed for a known market, the endpoint returns zero balances with type: null. Positions with credit == 0 && debt == 0 but non-empty collaterals are returned as type: "collateral_only".

GET
/v0/midnight/markets/{market-id}/users/{user-address}/position

Path Parameters

market-id*string

Midnight market id.

user-address*string

User address for the requested position. Lowercase input is checksummed.

Response Body

application/json

application/json

curl -X GET "https://api.morpho.org/v0/midnight/markets/string/users/string/position"
{
  "data": {
    "chain_id": 8453,
    "collaterals": [],
    "credit": "1000000000000000",
    "debt": "0",
    "last_indexed_block": "47457420",
    "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": "MARKET_NOT_FOUND",
    "details": null,
    "message": "Market 0xd92de5e7fbbde5a5e161787426982f7e1b01fb53a7060f95c021236d74447614 not found",
    "request_id": "f0e1d2c3-b4a5-4968-8728-1c0d1e2f3a4b"
  }
}