Skip to main content
POST
/
rpc
/
Trails
/
YieldGetMarkets
YieldGetMarkets returns DeFi markets with optional filters.
curl --request POST \
  --url https://trails-api.sequence.app/rpc/Trails/YieldGetMarkets \
  --header 'Content-Type: application/json' \
  --data '
{
  "provider": "<string>",
  "chainId": "<string>",
  "type": "<string>",
  "search": "<string>",
  "sort": "<string>",
  "limit": 123,
  "offset": 123
}
'
{
  "payload": {}
}

Overview

YieldGetMarkets returns DeFi markets available for deposit through Trails, including lending markets (Aave, Morpho) and yield vaults (Yearn, ERC-4626). Use this to power market selection UIs or discover marketId values for composable actions. The SDK’s useEarnMarkets hook wraps this endpoint with typed filters and caching — prefer it in React apps.

Request Parameters

All fields are optional.
FieldTypeDescription
providerstringFilter by protocol (e.g. "aave", "morpho", "yearn")
chainIdstringFilter by chain ID (e.g. "8453" for Base)
typestringMarket category: "lending" or "vault"
searchstringFree-text search over market names and tokens
sortstringSort order (e.g. "rewardRateDesc")
limitnumberNumber of results to return
offsetnumberPagination offset

Response

Returns payload containing an array of market objects. Each market includes:
FieldDescription
idUnique market ID — pass this to lend() or deposit() composable actions
providerIdProtocol identifier (e.g. "aave", "morpho")
rewardRateCurrent APY as a decimal (e.g. 0.045 = 4.5%)
statistics.tvlUsdTotal value locked in USD
metadata.nameHuman-readable market name
metadata.tokenUnderlying token info (symbol, address, decimals)

Examples

List all markets on Base

const response = await fetch('https://trails-api.sequence.app/rpc/Trails/YieldGetMarkets', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Access-Key': 'YOUR_ACCESS_KEY',
  },
  body: JSON.stringify({
    chainId: '8453',
    limit: 20,
    offset: 0,
  }),
})

const { payload } = await response.json()
const markets = JSON.parse(payload)

markets.forEach(market => {
  console.log(`${market.id}: ${(market.rewardRate * 100).toFixed(2)}% APY`)
})

Filter lending markets by protocol

const response = await fetch('https://trails-api.sequence.app/rpc/Trails/YieldGetMarkets', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Access-Key': 'YOUR_ACCESS_KEY',
  },
  body: JSON.stringify({
    provider: 'aave',
    type: 'lending',
    sort: 'rewardRateDesc',
  }),
})

const { payload } = await response.json()
const markets = JSON.parse(payload)

Search for USDC markets

const response = await fetch('https://trails-api.sequence.app/rpc/Trails/YieldGetMarkets', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Access-Key': 'YOUR_ACCESS_KEY',
  },
  body: JSON.stringify({
    search: 'usdc',
    sort: 'rewardRateDesc',
    limit: 10,
  }),
})

SDK alternative

In React, use the typed useEarnMarkets hook instead of calling this endpoint directly:
import { useEarnMarkets } from '0xtrails'

const { data: markets, isLoading } = useEarnMarkets({
  chain: 'base',
  type: 'lending',
  provider: 'aave',
  search: 'usdc',
  sortBy: 'rewardRateDesc',
  limit: 20,
})

// markets[i].id → pass to lend() or deposit() actions

See also

Body

application/json
provider
string

Filter by protocol ID (e.g. "aave", "morpho", "yearn")

chainId
string

Filter by chain ID as a string (e.g. "8453" for Base)

type
string

Market category: "lending" or "vault"

Free-text search over market names and tokens

sort
string

Sort order (e.g. "rewardRateDesc")

limit
integer<int32>

Number of results to return

offset
integer<int32>

Pagination offset

Response

OK

payload
object
required

JSON array of market objects from the yield provider