Opportunities API
Read-only discovery for structured rate data and rate-backed action tiles — the same markets Torque shows in Yield Spotlight and Lend & Borrow. Use business API key auth; this API does not execute on-chain. For execution, deep-link users via torqueUrl or use Actions API with a smart wallet JWT.
At a glance
| Auth | Authorization: Bearer sk_live_… |
| Yield route | GET /api/v1/opportunities/yield |
| Lending route | GET /api/v1/opportunities/lending |
| SDK (unified) | torque-node — getYieldOpportunities(), getLendingOpportunities() |
| SDK (split) | torque-intelligence — same methods |
| Types | @torquefi/types/opportunities |
SDK methods ship in torque-intelligence@0.1.1 and torque-node@0.1.1. See API & SDK coverage for the full matrix.
When to use which API
| Use case | API |
|---|---|
| Home-style "Earn X% on idle cash" tiles | GET /opportunities/yield + optional walletAddress |
| "Borrow USD at X%" tiles | GET /opportunities/lending → borrowAction |
| Macro/news rail with occasional lend links | GET /intelligence/feed or /happening-now |
| Personalized cash guidance (conversational) | Assistant chat or yield + wallet |
| Actually submit lend/borrow | Assistant functionResults, Actions API + JWT, or torqueUrl deep link |
Yield — idle cash APY
Same data as the in-app Yield Spotlight widget. Scans Enso/Aave markets across Base, Ethereum, and Arbitrum.
| Query | Purpose |
|---|---|
| walletAddress | Optional — adds personalized idle-cash ideas |
| minIdleUsd | Default 50 |
| maxPersonalized | Default 4, max 12 |
curl -sS "https://app.torque.fi/api/v1/opportunities/yield?walletAddress=0x…&minIdleUsd=50" \
-H "Authorization: Bearer sk_live_…" \
| jq '.meta, (.markets | length), (.personalized | length)'Response shape:
{
"meta": { "generatedAtMs": 1710000000000, "personalized": true, "walletAddress": "0x…" },
"markets": [
{
"symbol": "USD",
"lendSymbol": "USDC",
"apyPercent": 23.45,
"chainId": 8453,
"protocol": "Aave",
"action": { "label": "Lend USD", "subtitle": "Earn 23.45% APY on USD via Aave.", "torqueUrl": "…" }
}
],
"personalized": [
{
"idleUsd": 1200,
"estimatedAnnualUsd": 281.4,
"action": { "label": "Lend USD", "subtitle": "Earn 23.45% APY on USD via Aave." }
}
]
}SDK: getYieldOpportunities({ walletAddress?, minIdleUsd?, maxPersonalized? }) · Types: @torquefi/types/opportunities
Lending — supply APY + borrow APR
Same data as the in-app Lend & Borrow Markets table. One row per asset × chain × protocol. Does not include wallet personalization (unlike yield).
| Query | Purpose |
|---|---|
| chainId | Filter to one chain |
| tokenFilter | e.g. USD, ETH |
| protocol | e.g. aave, morpho, kamino |
| limit | Default 24, max 48 |
curl -sS "https://app.torque.fi/api/v1/opportunities/lending?tokenFilter=USD&protocol=aave&limit=24" \
-H "Authorization: Bearer sk_live_…" \
| jq '.meta, (.markets[0] | { displayName, supplyApyPercent, borrowAprPercent })'Response shape:
{
"meta": { "generatedAtMs": 1710000000000, "reserveCount": 42, "tokenFilter": "USD" },
"markets": [
{
"displayName": "USD · Base · Aave",
"productBucket": "USD",
"supplyApyPercent": 23.45,
"borrowAprPercent": 3.35,
"tvlUsd": 120000000,
"lendAction": { "label": "Lend USD", "subtitle": "Earn 23.45% APY on USD via Aave.", "torqueUrl": "…" },
"borrowAction": { "label": "Borrow USD", "subtitle": "Borrow USD at 3.35% via Aave.", "torqueUrl": "…" }
}
]
}Rows sorted by borrow APR, then supply APY, then TVL. SDK: getLendingOpportunities({ chainId?, tokenFilter?, protocol?, limit? })
BFF example (torque-node)
@torquefi/react does not wrap opportunities yet — proxy from your server with torque-node or torque-intelligence.
import { createTorqueFromEnv } from 'torque-node'
import { NextRequest, NextResponse } from 'next/server'
export async function GET(req: NextRequest) {
const { searchParams } = req.nextUrl
const torque = createTorqueFromEnv()
const data = await torque.opportunities.getYieldOpportunities({
walletAddress: searchParams.get('walletAddress') ?? undefined,
minIdleUsd: Number(searchParams.get('minIdleUsd') ?? 50),
})
return NextResponse.json(data)
}Not supported yet
- No REST endpoint that executes lend/borrow — discovery and deep links only
- No
torque-actionsnpm client - No partner OAuth / delegated wallet auth for Actions
- Lending opportunities has no wallet personalization (yield endpoint does)
Related
Intelligence API — narrative feed with enriched action tiles (rates from outlook/completion when present). Assistant API — tools get_auto_yield_ideas and get_evm_lending_market_rates mirror the same data. OpenAPI — machine-readable schemas.