User market position

A user's live position in a Morpho Blue market: collateral deposited, supply shares, and borrow shares.

Path Parameters

user-address*string

Position owner address. Example: 0xabcdefabcdefabcdefabcdefabcdefabcdefabcd.

Formataddress
market-selector*string

Selector formatted as <chain_id>:<market_id>. Example: 1:0xfff1970c0ffae288764186fbb38a9171a17e98676744a1e345809cb8b9e73342.

Format<chain_id>:<market_id>

Response Body

application/json

const baseUrl = process.env.CORE_REST_BASE_URL ?? "https://api.morpho.org";const apiKey = process.env.MORPHO_API_KEY ?? "<MORPHO_API_KEY>";const marketSelector = "1:0xfff1970c0ffae288764186fbb38a9171a17e98676744a1e345809cb8b9e73342";const userAddress = "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd";const url = new URL(`${baseUrl}/v0/blue/markets/${marketSelector}/users/${userAddress}/position`);const response = await fetch(url, {  headers: {    accept: "application/json",    "x-api-key": apiKey,  },});if (!response.ok) throw new Error(await response.text());const body = await response.json();
{
  "data": {
    "chain_id": 1,
    "market_id": "string",
    "user_address": "string",
    "last_indexed_block": "string",
    "collateral_assets": "string",
    "supply_shares": "string",
    "borrow_shares": "string"
  }
}