Skip to main content

Documentation Index

Fetch the complete documentation index at: https://kamino.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Market state is readable through three channels: the REST API (best for dashboards and monitoring), the TypeScript SDK (best for integrations that compute derived values on-chain), and direct Solana RPC reads (for the lowest-level access). Most curators use the API for monitoring and the SDK for any integration that needs to react to market state.

Channels at a glance

ChannelBest forEndpoint / package
REST APIDashboards, alerts, integrations that need historical datahttps://api.kamino.finance
TypeScript SDKApps computing live APYs, building transactions, reacting to state@kamino-finance/klend-sdk
Direct RPCLowest-latency access, minimal dependenciesSolana RPC + the program’s account decoders

List all markets

// SDK loads individual markets by address; the API is the place to enumerate
const response = await fetch('https://api.kamino.finance/v2/kamino-market');
const markets = await response.json();
Returns the full set of klend markets the API knows about, with addresses and basic metadata.

Market-wide TVL and totals

import { createSolanaRpc, address } from '@solana/kit';
import { KaminoMarket, getMedianSlotDurationInMsFromLastEpochs } from '@kamino-finance/klend-sdk';

const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com');
const slotDuration = await getMedianSlotDurationInMsFromLastEpochs();
const market = await KaminoMarket.load(rpc, address('<MARKET_ADDRESS>'), slotDuration);

console.log({
  depositTVL: market!.getTotalDepositTVL().toString(),
  borrowTVL:  market!.getTotalBorrowTVL().toString(),
});

Per-reserve metrics

import { createSolanaRpc, address } from '@solana/kit';
import { KaminoMarket, getMedianSlotDurationInMsFromLastEpochs } from '@kamino-finance/klend-sdk';

const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com');
const slotDuration = await getMedianSlotDurationInMsFromLastEpochs();
const market = await KaminoMarket.load(rpc, address('<MARKET_ADDRESS>'), slotDuration);
const slot = await rpc.getSlot().send();

for (const reserve of market!.getReserves()) {
  console.log(`Reserve ${reserve.symbol}:`);
  console.log(`  Deposit TVL:   ${reserve.getDepositTvl().toFixed(2)}`);
  console.log(`  Borrow TVL:    ${reserve.getBorrowTvl().toFixed(2)}`);
  console.log(`  Borrow APY:    ${reserve.totalBorrowAPY(slot)}%`);
  console.log(`  Supply APY:    ${reserve.totalSupplyAPY(slot)}%`);
  console.log(`  Utilization:   ${reserve.calculateUtilizationRatio()}%`);
}

Historical reserve metrics

Historical time-series data is API-only. The SDK reads live state; the API serves historical series.
const marketPubkey = '<MARKET_ADDRESS>';
const reservePubkey = '<RESERVE_ADDRESS>';

const url = `https://api.kamino.finance/kamino-market/${marketPubkey}/reserves/${reservePubkey}/metrics/history`;

const response = await fetch(url);
const { history } = await response.json();

for (const item of history) {
  console.log({
    timestamp:        item.timestamp,
    symbol:           item.metrics.symbol,
    supplyInterestAPY: item.metrics.supplyInterestAPY,
    borrowInterestAPY: item.metrics.borrowInterestAPY,
    depositTvl:       item.metrics.depositTvl,
    borrowTvl:        item.metrics.borrowTvl,
  });
}

Rewards data

The Kamino API exposes reward data such as active campaigns and per-user claimable amounts for klend reserves.

All active reward programs

const response = await fetch('https://api.kamino.finance/klend/rewards');
const rewards = await response.json();
console.log('Active KLend rewards:', rewards);

A user’s claimable rewards across all reserves

const userPubkey = '<USER_WALLET_ADDRESS>';
const response = await fetch(
  `https://api.kamino.finance/klend/users/${userPubkey}/rewards`
);
const rewards = await response.json();
console.log('User rewards:', rewards);

Live farm state from the SDK

For real-time emission rates and on-chain farm balances, read the kfarms FarmState directly:
import { createSolanaRpc, address } from '@solana/kit';
import { KaminoMarket, getMedianSlotDurationInMsFromLastEpochs } from '@kamino-finance/klend-sdk';
import { FarmState } from '@kamino-finance/farms-sdk';

const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com');
const slotDuration = await getMedianSlotDurationInMsFromLastEpochs();
const market = await KaminoMarket.load(rpc, address('<MARKET_ADDRESS>'), slotDuration);

for (const reserve of market!.getReserves()) {
  const collFarm = reserve.getCollateralFarmAddress();
  const debtFarm = reserve.getDebtFarmAddress();

  if (collFarm) {
    const farmState = await FarmState.fetch(rpc, collFarm);
    console.log(`${reserve.symbol} collateral farm:`, farmState);
  }
  if (debtFarm) {
    const farmState = await FarmState.fetch(rpc, debtFarm);
    console.log(`${reserve.symbol} debt farm:`, farmState);
  }
}
For the full APY calculation walkthrough, see Calculate reserve reward APY.

What the SDK exposes per reserve

reserve instances loaded via market.getReserves() provide the following getters:
MethodReturns
reserve.symbolToken symbol
reserve.addressReserve account pubkey
reserve.getDepositTvl()Total USD value deposited
reserve.getBorrowTvl()Total USD value borrowed
reserve.totalBorrowAPY(slot)Combined borrow APY (curve + host fixed)
reserve.totalSupplyAPY(slot)Supply-side APY paid to depositors
reserve.calculateUtilizationRatio()Borrowed / deposited, as a fraction
reserve.getCollateralFarmAddress()Farm address for the collateral side, or null
reserve.getDebtFarmAddress()Farm address for the debt side, or null
reserve.configThe on-chain ReserveConfig (every editable parameter)

Direct RPC reads

For the lowest-level access (minimal dependencies, fastest reads, no SDK abstraction), fetch the on-chain accounts directly via Solana RPC and decode them with the program’s IDL or struct definitions. The relevant accounts:
AccountWhat it holds
LendingMarketMarket-level config + flags
ReservePer-reserve config + live state (liquidity, collateral, withdraw queue)
ObligationPer-user position (deposits + borrows)
FarmStatekfarms reward state for a collateral or debt farm
See Programmatic integration for routing to the SDK and API documentation that covers each surface in depth.

Reference

Full API Reference

OpenAPI-rendered reference for every endpoint

SDK examples

Working code examples in the klend-sdk repo

Programmatic integration

Where to go for SDK / API / RPC integration docs

Farms & rewards

Curator-side farm management