List markets

GET
/v0/midnight/markets

Cursor-paginated list of Midnight markets.

Use this to discover markets. For a given user's positions on those markets, follow up with GET /v0/midnight/users/{user-address}/positions.

Filters. Address filters (loan_assets, collateral_assets, oracle_addresses, enter_gates, liquidator_gates) must be combined with chain_ids — an address alone is not chain-unique. Lowercase addresses are checksummed server-side. Pass active_only=true to exclude markets past maturity.

Pagination. Response follows the list envelope: { cursor, data }. Pass back cursor verbatim on the next call. A null cursor means the last page.

Cache. public, max-age=5, stale-while-revalidate=2.

Query Parameters

chain_ids?array<>

Filter by chain ids. Supported chains: Ethereum (1) and Base (8453). Required when any address filter is provided.

Itemsitems <= 100
market_ids?array<string>

Filter by Midnight market ids. These ids are globally unique.

Itemsitems <= 100
market_family_ids?array<string>

Filter by Midnight market family ids. A family contains markets whose immutable parameters differ only by maturity.

Itemsitems <= 100
loan_assets?array<string>

Filter by loan token addresses. Combine with chain_ids; lowercase input is checksummed.

Itemsitems <= 100
collateral_assets?array<string>

Filter by collateral token addresses. Combine with chain_ids; lowercase input is checksummed.

Itemsitems <= 100
oracle_addresses?array<string>

Filter by collateral oracle addresses. Combine with chain_ids; lowercase input is checksummed.

Itemsitems <= 100
enter_gates?array<string>

Filter by enter gate addresses. Combine with chain_ids; lowercase input is checksummed.

Itemsitems <= 100
liquidator_gates?array<string>

Filter by liquidator gate addresses. Combine with chain_ids; lowercase input is checksummed.

Itemsitems <= 100
maturities?array<|>

Filter by exact maturity timestamps, in unix seconds.

Itemsitems <= 100
active_only?string

When true, enforces maturity strictly after the current timestamp.

Value in

  • "true"
  • "false"
maturity_gte?|

Filter for maturities greater than or equal to this unix timestamp.

maturity_lte?|

Filter for maturities less than or equal to this unix timestamp.

total_units_gte?string

Filter for total units greater than or equal to this value.

Match^\d{1,78}$
total_units_lte?string

Filter for total units less than or equal to this value.

Match^\d{1,78}$
listed?string

Filter by listing status. When true, returns only markets surfaced by the app trust layer; when false, only unlisted markets. Omit to return both.

Value in

  • "true"
  • "false"
sort_by?string

Sort field for cursor pagination.

Default"total_units"

Value in

  • "total_units"
  • "maturity"
sort_direction?string

Sort direction for cursor pagination.

Default"desc"

Value in

  • "asc"
  • "desc"
limit?integer

Maximum number of items to return.

Range1 <= value <= 1000
Default100
cursor?string

Opaque cursor from a previous page response.

Length1 <= length <= 4096

Response Body

application/json

application/json

application/json

curl -X GET "https://example.com/v0/midnight/markets"
{  "cursor": "eyJzIjoidG90YWxfdW5pdHMiLCJkIjoiZGVzYyIsInYiOiIxNDgxNDM5OTkyMDIwMDEzIiwidk51bGwiOmZhbHNlLCJpIjpbODQ1MywiMHhjYzk0MThlYTU5NGM2ZTY1ODY1MGFlZGQyMDVjZTQ1NDRiMjY2YjY5NDkzZjU2ZmQyYWRjNjVjMTRiZDA2NzM4Il0sImYiOiJSQk52bzFXelo0b1JScTBXOS1oa25wIn0",  "data": [    {      "chain_id": 8453,      "market_id": "0xcc9418ea594c6e658650aedd205ce4544b266b69493f56fd2adc65c14bd06738",      "market_family_id": "0x9a6ece688006fb810141501154acfd1aa29ae7ac3753452f4931a092f2653f1f",      "loan_token": "0x4200000000000000000000000000000000000006",      "maturity": 1784300400,      "rcf_threshold": "0",      "enter_gate": "0x0000000000000000000000000000000000000000",      "liquidator_gate": "0x0000000000000000000000000000000000000000",      "collaterals": [        {          "token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",          "lltv": "860000000000000000",          "liquidation_cursor": "300000000000000000",          "oracle": "0xD09048c8B568Dbf5f189302beA26c9edABFC4858"        }      ],      "total_units": "1481439992020013",      "tick_granularity": 4,      "settlement_fee_schedule": [        {          "time_to_maturity_days": 0,          "fee_cbp": "0"        },        {          "time_to_maturity_days": 1,          "fee_cbp": "0"        },        {          "time_to_maturity_days": 7,          "fee_cbp": "0"        },        {          "time_to_maturity_days": 30,          "fee_cbp": "0"        },        {          "time_to_maturity_days": 90,          "fee_cbp": "0"        },        {          "time_to_maturity_days": 180,          "fee_cbp": "0"        },        {          "time_to_maturity_days": 360,          "fee_cbp": "0"        }      ],      "current_settlement_fee_wad": "0",      "current_settlement_fee_cbp": "0",      "continuous_fee_rate": "0",      "listed": false    }  ]}

{  "error": {    "code": "VALIDATION_FAILED",    "message": "Validation failed",    "details": [      {        "code": "invalid_type",        "message": "Expected number, received string",        "path": [          "chain_ids",          0        ]      }    ],    "request_id": "f0e1d2c3-b4a5-4968-8728-1c0d1e2f3a4b"  }}

{  "error": {    "code": "INTERNAL_ERROR",    "message": "Internal server error",    "details": null,    "request_id": "f0e1d2c3-b4a5-4968-8728-1c0d1e2f3a4b"  }}