Skip to main content
The Jupiter Lend API and SDK give you access to Earn (deposit-and-earn) and Borrow (collateralised borrowing) on Solana. Deposit into Earn vaults to earn yield, or use assets as collateral in Borrow markets to take out loans. The SDK and API provide deposits, withdrawals, borrows, and repayments as ready-made transactions or as raw instructions for CPI and custom flows.

Integrate Jupiter Earn / Borrow

TypeScript SDK

Compose on-chain flows for Jupiter Earn and Borrow. The SDK returns raw instructions so you can build transactions, sign, send, or use them in CPI and custom flows.

REST API

REST API for Earn: deposit, withdraw, mint, and redeem as unsigned base64 transactions or as raw instructions; read endpoints for vault tokens, user positions, and earnings. Borrow API coming soon.

Jupiter Lend Products

Jupiter Earn vaults

Deposit assets into Jupiter Earn vaults and generate yield.

Borrow markets

Borrow assets against collateral in Jupiter markets.

Advanced Integration

Flashloans

Borrow and repay within a single transaction with zero fees and no collateral.

Advanced Recipes

Multiply, unwind, vault swap, and other composite flows using flashloans.

CPI Integration

Call Jupiter Lend directly from your on-chain Solana program.

Getting Started

Set up your development environment:
1

Install Dependencies

Add the Jupiter Lend TypeScript SDK and Solana web3.js to your dependencies.
npm i @jup-ag/lend @solana/web3.js
Jupiter Lend SDK is built on top of @solana/web3.js for RPC communication and transaction construction.
2

Setup the RPC

import { Connection } from "@solana/web3.js";

const connection = new Connection(
  "https://api.mainnet-beta.solana.com",
  {
    commitment: "confirmed",
  }
);
Public RPC endpoints are rate-limited and not recommended for production use.Use a dedicated RPC provider such as Helius, Triton, or Alchemy for improved reliability and performance.
3

Create or Import Wallet

Choose a method to create or import a wallet for signing transactions.
Alternatively, create a wallet using a browser wallet provider like Jupiter Wallet
Use the Solana CLI to generate a new keypair file.
solana-keygen new -o wallet.json
Generate a new keypair programmatically using the Solana web3.js.
import { Keypair } from "@solana/web3.js";

const keypair = Keypair.generate();
console.log("Public Key:", keypair.publicKey.toBase58());
Import a wallet from an existing keypair file.
import { Keypair } from "@solana/web3.js";
import fs from "fs";
import path from "path";

function loadKeypair(filePath: string): Keypair {
  const resolvedPath = path.resolve(filePath);
  const secret = JSON.parse(fs.readFileSync(resolvedPath, "utf8"));
  return Keypair.fromSecretKey(new Uint8Array(secret));
}

const userKeypair = loadKeypair("/path/to/wallet.json");
console.log("Public Key:", userKeypair.publicKey.toBase58());
Import a private key exported from a browser wallet (base58-encoded string).
import { Keypair } from "@solana/web3.js";
import bs58 from "bs58";

const privateKey = "YOUR_BASE58_PRIVATE_KEY"; // exported from your browser wallet
const userKeypair = Keypair.fromSecretKey(bs58.decode(privateKey));
console.log("Public Key:", userKeypair.publicKey.toBase58());
Never expose or commit private keys to version control. Use secure key management in production environments.