How is API integration?

Get your Soroswap API integration running in under 5 minutes. This guide is for developers who want to integrate quickly.

📚 Documentation Hierarchy

Choose your path:

Prerequisites

  • JavaScript/TypeScript experience

  • Wallet integration knowledge (Freighter/StellarWalletsKit)

  • API integration experience

  • 3-5 minutes of your time

🚀 Step 1: Get Your API Key (1 minute)

  1. Generate API key (starts with sk_)

  2. Copy and store securely

⚠️ Authentication Format

🔧 Step 2: Environment Setup (2 minutes)

Quick Testnet Setup

💱 Step 3: Core Integration (2 minutes)

Essential API Flow

4-step process: Quote → Build → Sign → Send

Working Examples

📂 Complete examples available:

📤 Advanced Options

Gasless Transactions

Custom Transaction Submission

Request Parameters

Quote Request

Build 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 (staging vs production)

  4. API key hasn't been revoked

"Insufficient liquidity"

  1. Reduce trade amount

  2. Check if pool exists at app.soroswap.finance

  3. Try different token pairs

Network mismatch

Expected Response Times

  • /quote: 1-3 seconds

  • /build: 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.soroswap.finance/docs

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

  3. Production optimization: Proper state management and caching

  4. Multi-token support: Beyond just XLM→USDC swaps

📚 Additional Resources

  • 🔗 API Documentation: api.soroswap.finance/docs

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

  • 🏦 Soroswap Interface: https://app.soroswap.finance

  • 💬 Discord Support: https://discord.gg/soroswap

🎉 Ready to build? You now have everything needed for a production-ready Soroswap integration!

Last updated