Get quote
Returns a bundle-ready quote for the requested assets or units, plus expected best/worst average prices and maximum executable liquidity.
The endpoint optimizes for successful target-aware bundle execution under contention: takeable_offers are best-priced per-offer caps and their total can exceed the requested target, giving a bundle executor fallback liquidity when earlier offers are partially consumed or skipped.
At most limit (default and maximum 10,000) best-priced takeable offers are walked and returned; prices and availability always describe exactly the returned window. A request that cannot fill within limit offers returns 422.
Use the returned takeable offers with a bundle abstraction that stops at your requested target and applies your max/min asset or unit protections. If you execute takeable offers independently with Midnight.take, do not submit every returned unit blindly: clamp each offer to your remaining target and current takeability, or you may execute more than intended.
If the requested size cannot be fully satisfied at quote time under the selected guard, the endpoint returns 422.
For enterprise access, use https://private.api.morpho.org as the base URL and send your API key in the x-api-key header. Request an API key.
Path Parameters
Book side to quote (asks or bids).
"asks" | "bids"Market ID whose book to quote (market_id in responses).
Query Parameters
Maximum number of best-priced takeable offers the quote may walk and return. Returned prices and availability describe exactly this window, and a request that cannot fill within limit offers returns 422. Maximum: 10000. Default: 10000.
Optional conservative average worst-price guard for the requested target. For asks, the returned average_worst_price is at or below this value; for bids, it is at or above it. The target-closing offer is clipped exactly when needed, and only whole additional fallback caps whose conservative bound remains inside the guard are returned. If the target itself cannot satisfy the guard, the request fails with 422. Mutually exclusive with slippage.
Optional slippage percentage used to derive a worst-price guard from the realized average_best_price for the requested target. The returned fallback window is trimmed until its conservative average_worst_price stays inside that guard. For asks, the guard increases by slippage; for bids, it decreases by slippage. The response reports the conservative bound, not the derived guard. Range: 0.1 to 100, with at most one decimal place. Mutually exclusive with average_worst_price.
Target unit amount. Provide exactly one of assets or units.
Target assets amount. Provide exactly one of assets or units.
Response Body
application/json
application/json
application/json
application/json
curl -X GET "https://api.morpho.org/v0/midnight/books/0xcc9418ea594c6e658650aedd205ce4544b266b69493f56fd2adc65c14bd06738/asks/quote?limit=10000&average_worst_price=1000000000000000000&slippage=0.5&units=1000000000000000000&assets=1000000000000000000"{
"data": {
"average_best_price": "1000000000000000000",
"average_worst_price": "1000000000000000000",
"available_assets": "1500000000000000000",
"available_units": "1500000000000000000",
"takeable_offers": [
{
"market_id": "0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67",
"units": "369216000000000000000000",
"offer": {
"market": {
"chain_id": 8453,
"midnight": "0x2F7a3AA739ba5792Ce1b4eA046117f2C0095BCA6",
"loan_token": "0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078",
"collaterals": [
{
"token": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
"lltv": "860000000000000000",
"liquidation_cursor": "300000000000000000",
"oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401"
}
],
"maturity": 1761922799,
"rcf_threshold": "0",
"enter_gate": "0x0000000000000000000000000000000000000000",
"liquidator_gate": "0x0000000000000000000000000000000000000000"
},
"buy": false,
"maker": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
"max_units": "369216000000000000000000",
"start": 1761922790,
"expiry": 1761922799,
"tick": 495,
"group": "0x000000000000000000000000000000000000000000000000000000000008b8f4",
"callback": "0x0000000000000000000000000000000000000000",
"callback_data": "0x",
"receiver_if_maker_is_seller": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
"ratifier": "0x0000000000000000000000000000000000000002",
"reduce_only": false,
"max_assets": "0",
"continuous_fee_cap": "115792089237316195423570985008687907853269984665640564039457584007913129639935"
},
"ratifier_data": "0x000000000000000000000000000000000000000000000000000000000000001b12121212121212121212121212121212121212121212121212121212121212123434343434343434343434343434343434343434343434343434343434343434"
}
]
}
}{
"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"
}
}