TorqueTorque

Search docs

Search Torque documentation pages and sections

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

AuthAuthorization: Bearer sk_live_…
Yield routeGET /api/v1/opportunities/yield
Lending routeGET /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 caseAPI
Home-style "Earn X% on idle cash" tilesGET /opportunities/yield + optional walletAddress
"Borrow USD at X%" tilesGET /opportunities/lending → borrowAction
Macro/news rail with occasional lend linksGET /intelligence/feed or /happening-now
Personalized cash guidance (conversational)Assistant chat or yield + wallet
Actually submit lend/borrowAssistant 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.

QueryPurpose
walletAddressOptional — adds personalized idle-cash ideas
minIdleUsdDefault 50
maxPersonalizedDefault 4, max 12
fetch-yield.sh
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:

YieldOpportunitiesResponseV1
{
  "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).

QueryPurpose
chainIdFilter to one chain
tokenFiltere.g. USD, ETH
protocole.g. aave, morpho, kamino
limitDefault 24, max 48
fetch-lending.sh
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:

LendingOpportunitiesResponseV1
{
  "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.

app/api/opportunities/yield/route.ts
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-actions npm 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.

Was this helpful?