MidnightBooks

List books

Returns books for active markets with market metadata and the top 3 ask/bid levels. Past maturities are excluded, even when requested with ids. Supports filtering, sorting, and pagination; default sort is id ascending.

GET
/v0/midnight/books

Query Parameters

sort?string

Sort by comma-separated fields (id, ask, bid, maturity). Prefix a field with - for descending. Max 3 fields.

maturities?array<number>

Exact maturity timestamp filter in unix seconds (comma-separated). Maximum 20 values.

collateral_tokens?array<string>

Collateral token filter (comma-separated, matches any collateral). Maximum 20 values.

loan_tokens?array<string>

Loan token address filter (comma-separated). Maximum 20 values.

chain_ids?array<number>

Chain ID filter (comma-separated). Currently accepts at most one chain id.

ids?string

Market ID filter as a single comma-separated query parameter. Returns books for the matching markets. Maximum 20 IDs.

limit?number

Maximum number of items to return (max 20, default 10).

cursor?string

Opaque pagination cursor from a previous response.

Response Body

application/json

application/json

application/json

curl -X GET "https://api.morpho.org/v0/midnight/books?sort=-ask%2Cbid%2Cmaturity&maturities=1761922800%2C1764524800&collateral_tokens=0x34Cf890dB685FC536E05652FB41f02090c3fb751%2C0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078&loan_tokens=0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078%2C0x34Cf890dB685FC536E05652FB41f02090c3fb751&chain_ids=1&ids=0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67%2C0x22590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f68&limit=10&cursor=eyJzb3J0IjpbImlkIl0sImlkIjoiMHgxMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExIiwiYXNrIjoiMCIsImJpZCI6IjAiLCJtYXR1cml0eSI6MTc2MTkyMjgwMH0"
{
  "cursor": "eyJzb3J0IjpbImlkIl0sImlkIjoiMHgxMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExIiwiYXNrIjoiMCIsImJpZCI6IjAiLCJtYXR1cml0eSI6MTc2MTkyMjgwMH0",
  "data": [
    {
      "asks": [
        {
          "assets": "184608000000000000000000",
          "count": 5,
          "price": "500000000000000000",
          "tick": 495,
          "units": "369216000000000000000000"
        }
      ],
      "bids": [
        {
          "assets": "184608000000000000000000",
          "count": 5,
          "price": "500000000000000000",
          "tick": 495,
          "units": "369216000000000000000000"
        }
      ],
      "chain_id": 1,
      "collaterals": [
        {
          "liquidation_cursor": "250000000000000000",
          "lltv": "860000000000000000",
          "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401",
          "token": "0x34Cf890dB685FC536E05652FB41f02090c3fb751"
        }
      ],
      "enter_gate": "0x0000000000000000000000000000000000000000",
      "liquidator_gate": "0x0000000000000000000000000000000000000000",
      "loan_token": "0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078",
      "market_id": "0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67",
      "maturity": 1761922800,
      "midnight": "0x2F7a3AA739ba5792Ce1b4eA046117f2C0095BCA6",
      "rcf_threshold": "0"
    }
  ]
}
{
  "error": {
    "code": "VALIDATION_ERROR",
    "details": [
      {
        "field": "limit",
        "issue": "Limit must be greater than 0."
      }
    ],
    "message": "Limit must be greater than 0.",
    "request_id": "req-123"
  }
}
{
  "error": {
    "code": "VALIDATION_ERROR",
    "details": [
      {
        "field": "limit",
        "issue": "Limit must be greater than 0."
      }
    ],
    "message": "Limit must be greater than 0.",
    "request_id": "req-123"
  }
}