Get book

Returns one supported, active book with market metadata and both sides. A known book with no visible offers returns empty asks and bids. Each side returns up to depth levels, sorted best price first.

Path Parameters

market-id?string

Market ID whose book to read (market_id in responses).

Query Parameters

depth?number

Maximum levels returned per side. Default: 100. Maximum: 5821.

Response Body

application/json

application/json

application/json

application/json

const baseUrl = "https://api.morpho.org";const marketId = "0xcc9418ea594c6e658650aedd205ce4544b266b69493f56fd2adc65c14bd06738";const url = new URL(`${baseUrl}/v0/midnight/books/${marketId}`);const response = await fetch(url, {  headers: {    accept: "application/json",  },});if (!response.ok) throw new Error(await response.text());const body = await response.json();
{
  "data": {
    "market_id": "0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67",
    "chain_id": 1,
    "midnight": "0x2F7a3AA739ba5792Ce1b4eA046117f2C0095BCA6",
    "loan_token": "0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078",
    "collaterals": [
      {
        "token": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
        "lltv": "860000000000000000",
        "liquidation_cursor": "300000000000000000",
        "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401"
      }
    ],
    "maturity": 1761922800,
    "rcf_threshold": "0",
    "enter_gate": "0x0000000000000000000000000000000000000000",
    "liquidator_gate": "0x0000000000000000000000000000000000000000",
    "asks": [
      {
        "tick": 495,
        "price": "500000000000000000",
        "units": "369216000000000000000000",
        "assets": "184608000000000000000000",
        "count": 5
      }
    ],
    "bids": [
      {
        "tick": 495,
        "price": "500000000000000000",
        "units": "369216000000000000000000",
        "assets": "184608000000000000000000",
        "count": 5
      }
    ]
  }
}
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Limit must be greater than 0.",
    "details": [
      {
        "field": "limit",
        "issue": "Limit must be greater than 0."
      }
    ],
    "request_id": "req-123"
  }
}
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Limit must be greater than 0.",
    "details": [
      {
        "field": "limit",
        "issue": "Limit must be greater than 0."
      }
    ],
    "request_id": "req-123"
  }
}
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Limit must be greater than 0.",
    "details": [
      {
        "field": "limit",
        "issue": "Limit must be greater than 0."
      }
    ],
    "request_id": "req-123"
  }
}