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)
Go to Generate API Key
You'll receive an API key (starts with
sk_)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:
beginner-example.html- Full interactive tutorial with vault deposit/withdrawTypescript SDK examples - Available in the DeFindex SDK repository
π€ Advanced Options
Gasless Transactions
Custom Transaction Submission
Request Parameters
Deposit Request
Withdraw Request
Send Request
β Common Issues & Solutions
"403 Forbidden" errors
API key starts with
sk_Using
Authorization: Bearer <key>headerUsing correct base URL
API key hasn't been revoked
"Insufficient balance"
Ensure wallet has enough tokens for deposit
Check minimum deposit requirements
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
Explore full API: api.defindex.io/docs
Add error handling: Implement retry logic and user feedback
Production optimization: Proper state management and caching
Multi-vault support: Integrate multiple vaults and strategies
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