> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pods.finance/llms.txt
> Use this file to discover all available pages before exploring further.

# Add Yield to Your App in 5 Minutes

> Integrate DeFi yield strategies into your application in 4 steps

This quickstart walks you through integrating a DeFi yield strategy into your
application. You'll browse available strategies, generate deposit transaction
data, and execute it with your user's wallet.

<CardGroup cols={2}>
  <Card title="API Key" icon="key">
    Get your API key at [Pods](https://www.pods.finance/plg/select-plan)
  </Card>

  <Card title="Wallet" icon="wallet">
    Have an Ethereum/Polygon wallet address and sufficient USDC balance
  </Card>
</CardGroup>

<Warning>
  Ensure your wallet has sufficient USDC on Polygon and MATIC for gas fees.
</Warning>

Create a `.env` file:

```bash theme={null}
PODS_API_KEY=your-api-key
WALLET_ADDRESS=0x...
PRIVATE_KEY=0x...
POLYGON_RPC_URL=https://polygon-rpc.com
```

<Warning>
  Never commit your `.env` file to version control. Add it to `.gitignore`.
</Warning>

## Step 1: Browse Available Strategies

List all available yield strategies to find one for your use case.

```javascript JavaScript theme={null}
import axios from 'axios'

const walletAddress = process.env.WALLET_ADDRESS // Your wallet address

const pods = axios.create({
  baseURL: 'https://api.pods.finance',
  headers: { 'x-api-key': process.env.PODS_API_KEY }
})

const { data: strategies } = await pods.get('/strategies')

strategies.data.forEach(s => {
  console.log(`${s.id} — ${s.protocol} on ${s.network} — APY: ${(s.apy * 100).toFixed(2)}%`)
})
```

<Accordion title="Example Response">
  ```json theme={null}
  {
    "data": [
      {
        "id": "Aave-USDC-polygon",
        "protocol": "Aave",
        "assetName": "USDC",
        "network": "polygon",
        "asset": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
        "assetDecimals": 6,
        "apy": 0.0482,
        "paused": false,
        "fee": "0",
        "availableActions": ["lend", "withdraw"]
      }
    ],
    "pagination": {
      "page": 1,
      "limit": 100,
      "total": 5,
      "totalPages": 1,
      "hasMore": false
    }
  }
  ```
</Accordion>

<Tip>
  Use `id` (e.g. `Aave-USDC-polygon`) as the strategy identifier in the next steps.
</Tip>

## Step 2: Generate Deposit Bytecode

Request ready-to-execute transaction data for depositing into the strategy.

```javascript JavaScript theme={null}
const { data: result } = await pods.get('/strategies/aave-usdc-polygon/bytecode', {
  params: {
    action: 'lend',
    amount: '10000000', // 10 USDC (6 decimals)
    wallet: walletAddress
  }
})

console.log('Transactions to execute:', result.bytecode.length)
console.log('ID:', result.id)
```

```bash cURL theme={null}
curl -X GET "https://api.pods.finance/strategies/aave-usdc-polygon/bytecode" \
  -H "x-api-key: $PODS_API_KEY" \
  -G \
  --data-urlencode "action=lend" \
  --data-urlencode "amount=10000000" \
  --data-urlencode "wallet=$WALLET_ADDRESS"
```

<Accordion title="Example Response">
  ```json theme={null}
  {
    "feeCharged": "0",
    "chainIdIn": 137,
    "chainIdOut": 137,
    "id": "65f3a1c8e9b2d4f8a7c1d2e3",
    "crossChain": {
      "isCrossChain": false,
      "chainIdIn": 137,
      "chainIdOut": 137
    },
    "quote": null,
    "bytecode": [
      {
        "to": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
        "data": "0x095ea7b3...",
        "value": "0",
        "chainId": 137
      },
      {
        "to": "0x794a61358D6845594F94dc1DB02A252b5b4814aD",
        "data": "0x617ba037...",
        "value": "0",
        "chainId": 137
      }
    ]
  }
  ```
</Accordion>

<Info>
  The response may contain multiple transactions (e.g. token approval + deposit).
  Execute them in order.
</Info>

## Step 3: Execute Transactions

Sign and broadcast each transaction using your wallet library.

```javascript ethers.js theme={null}
import { ethers } from 'ethers'

const provider = new ethers.JsonRpcProvider(process.env.POLYGON_RPC_URL)
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider)

for (const tx of result.bytecode) {
  const transaction = await wallet.sendTransaction({
    to: tx.to,
    data: tx.data,
    value: tx.value || '0',
    chainId: tx.chainId
  })

  console.log('Transaction sent:', transaction.hash)
  const receipt = await transaction.wait()
  console.log('Confirmed in block:', receipt.blockNumber)
}

console.log('Deposit successful!')
```

```javascript viem theme={null}
import { createWalletClient, http } from 'viem'
import { polygon } from 'viem/chains'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount(process.env.PRIVATE_KEY)
const client = createWalletClient({
  account,
  chain: polygon,
  transport: http(process.env.POLYGON_RPC_URL)
})

for (const tx of result.bytecode) {
  const hash = await client.sendTransaction({
    to: tx.to,
    data: tx.data,
    value: BigInt(tx.value || '0')
  })

  console.log('Transaction sent:', hash)
  const receipt = await client.waitForTransactionReceipt({ hash })
  console.log('Confirmed in block:', receipt.blockNumber)
}

console.log('Deposit successful!')
```

## Step 4: Check Your Position

After depositing, use the `/wallets` endpoint to check the current position and profit for your strategy.

```javascript JavaScript theme={null}
const { data: wallet } = await pods.get(`/wallets/${walletAddress}`)

wallet.positions.forEach(p => {
  console.log(`Strategy: ${p.strategy.protocol} ${p.strategy.assetName} on ${p.strategy.network}`)
  console.log(`  Current Position: ${p.spotPosition.currentPosition.humanized} ${p.spotPosition.currentPosition.symbol}`)
  console.log(`  Principal: ${p.spotPosition.principal.humanized} ${p.spotPosition.principal.symbol}`)
  console.log(`  Profit: ${p.spotPosition.profit.humanized} ${p.spotPosition.profit.symbol}`)
  console.log(`  APY: ${(p.spotPosition.apy * 100).toFixed(2)}%`)
})

console.log(`Total Balance (USD): $${wallet.summary.totalUnderlyingBalanceUSD}`)
```

```bash cURL theme={null}
curl -X GET "https://api.pods.finance/wallets/$WALLET_ADDRESS" \
  -H "x-api-key: $PODS_API_KEY"
```

<Accordion title="Example Response">
  ```json theme={null}
  {
    "positions": [
      {
        "spotPosition": {
          "currentPosition": {
            "value": "10048700",
            "decimals": 6,
            "humanized": "10.0487",
            "symbol": "USDC"
          },
          "profit": {
            "value": "48700",
            "decimals": 6,
            "humanized": "0.0487",
            "symbol": "USDC"
          },
          "principal": {
            "value": "10000000",
            "decimals": 6,
            "humanized": "10.00",
            "symbol": "USDC"
          },
          "underlyingBalanceUSD": 10.05,
          "apy": 0.0482
        },
        "strategy": {
          "id": "Aave-USDC-polygon",
          "assetName": "USDC",
          "protocol": "Aave",
          "network": "polygon",
          "asset": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
          "assetDecimals": 6
        }
      }
    ],
    "summary": {
      "totalUnderlyingBalanceUSD": 10.05
    }
  }
  ```
</Accordion>

<Tip>
  Call this endpoint periodically to track how your user's position grows over time.
</Tip>

## Next Steps

<CardGroup cols={2}>
  <Card title="Check Positions" icon="chart-line" href="/guides/yield/check-positions">
    Verify the deposit and monitor your user's yield position
  </Card>

  <Card title="Withdraw" icon="arrow-down-right" href="/guides/yield/withdraw">
    Generate withdrawal transaction data
  </Card>

  <Card title="All Yield Guides" icon="book-open" href="/guides/yield/check-protocol-info">
    Browse strategies, deposit, check positions, and withdraw
  </Card>

  <Card title="Add Swaps" icon="arrows-rotate" href="/guides/swaps/get-quote">
    Also integrate token swaps into your app
  </Card>
</CardGroup>
