Quick Start

Get your DeFindex API integration running in under 5 minutes. This guide is for developers who want to integrate yield-generating vaults quickly.

πŸš€ Step 1: Get Your API Key (1 minute)

  1. Go to Generate API Key

  2. You'll receive an API key (starts with sk_)

  3. Copy and store securely

⚠️ Authentication Format

// βœ… CORRECT - Use Bearer authentication
const headers = {
  'Authorization': 'Bearer sk_test_1234567890abcdef',
  'Content-Type': 'application/json'
}

// ❌ WRONG - These will result in 403 Forbidden
const wrongHeaders = {
  'X-API-Key': 'sk_test_1234567890abcdef',    // Wrong header name
  'Authorization': 'sk_test_1234567890abcdef', // Missing 'Bearer'
  'Authorization': 'Bearer sk_expiredApiKey', // Expired key
}

πŸ”§ Step 2: Environment Setup (2 minutes)

Quick Testnet Setup

πŸ’± Step 3: Core Integration (2 minutes)

Essential API Flow

4-step process: Get Vault Info β†’ Build Deposit β†’ Sign β†’ Send

Or you can just use the DeFindex SDK for a more streamlined experience.

Working Examples

πŸ“‚ Complete examples available:

πŸ“€ Advanced Options

Gasless Transactions

Custom Transaction Submission

Request Parameters

Deposit Request

Withdraw Request

Send Request

❓ Common Issues & Solutions

"403 Forbidden" errors

  1. API key starts with sk_

  2. Using Authorization: Bearer <key> header

  3. Using correct base URL

  4. API key hasn't been revoked

"Insufficient balance"

  1. Ensure wallet has enough tokens for deposit

  2. Check minimum deposit requirements

  3. Verify vault is active and accepting deposits

Network mismatch

Expected Response Times

  • /vault/{address}: 1-2 seconds

  • /vault/{address}/deposit: 2-5 seconds

  • /send: 3-10 seconds

🚨 Production Considerations

Security

  • Never expose API keys in frontend code for production

  • Use environment variables for sensitive data

  • Implement proper error handling and retry logic

Performance

  • Add request timeouts (30s recommended)

  • Implement exponential backoff for retries

  • Cache quotes for better UX (but respect freshness)

Monitoring

  • Track transaction success rates

  • Monitor API response times

  • Log error patterns for debugging

🎯 Next Steps

  1. Explore full API: api.defindex.io/docs

  2. Add error handling: Implement retry logic and user feedback

  3. Production optimization: Proper state management and caching

  4. Multi-vault support: Integrate multiple vaults and strategies

  5. APY tracking: Use vault APY endpoints for performance metrics

πŸ“š Additional Resources

  • πŸ”— API Documentation: api.defindex.io/docs

  • 🌍 Stellar Expert (Testnet): https://stellar.expert/explorer/testnet

  • 🏦 DeFindex Interface: https://app.defindex.io

  • πŸ’¬ Discord Support: https://discord.gg/ftPKMPm38f

  • πŸ“š SDK Documentation: DeFindex SDK

πŸŽ‰ Ready to build? You now have everything needed for a production-ready DeFindex vault integration!

Last updated