API Overview

πŸ’° Earn Revenue from Every Trade

The LiquidSwap API isn't just about integrating swap functionalityβ€”it's about building a sustainable business. Every swap routed through your application can generate revenue for you.

πŸš€ Why Developers Love Our API

βœ… Earn up to 1% on every swap your users make βœ… Keep 97.5% of all fees collected (we keep just 2.5%) βœ… Automatic payments sent directly to your wallet βœ… Bonus revenue from positive slippage capture βœ… Ready-to-use code - integrate in minutes, not weeks

πŸ’‘ Perfect for Building

  • Trading dApps - Add swap functionality and monetize your users

  • Portfolio Tools - Earn from rebalancing and trading features

  • DeFi Protocols - Integrate optimal swap routing with revenue sharing

  • Trading Bots - Build high-frequency trading systems with built-in monetization

  • Mobile Wallets - Add trading features that generate passive income


How the API Works

The LiquidSwap API provides programmatic access to our DEX aggregation infrastructure. Instead of building complex routing logic or maintaining connections to multiple DEXs, you can leverage our optimized system and earn revenue from every trade.

Core Benefits:

  • Simplified Integration: Access all major DEXs through a single, consistent API

  • Real-Time Data: Get up-to-date pricing, liquidity, and routing information

  • Optimized Routes: Benefit from our advanced routing algorithms without building your own

  • Comprehensive Coverage: Access tokens and pools across the entire Hyperliquid ecosystem

  • Revenue Sharing: Monetize your integration from day one

Common Use Cases

Trading Applications:

  • Build custom trading interfaces with aggregated liquidity

  • Create portfolio management tools with optimal execution

  • Develop trading bots that automatically find the best rates

DeFi Protocols:

  • Integrate swap functionality into yield farming platforms

  • Add liquidity optimization to lending protocols

  • Build complex DeFi strategies that require efficient token swapping

Analytics & Tools:

  • Create price comparison tools across multiple DEXs

  • Build liquidity analysis dashboards

  • Develop arbitrage detection systems

Mobile & Web Apps:

  • Add token swapping to mobile wallets

  • Create simplified trading interfaces for specific use cases

  • Build educational tools that demonstrate DeFi concepts

Quick Start - Start Earning in 5 Minutes

Ready to integrate and start earning? Here's how:

Step 1: Make your first API call

curl "https://api.liqd.ag/v2/route?tokenIn=0x5555555555555555555555555555555555555555&tokenOut=0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb&amountIn=100&feeBps=10&feeRecipient=YOUR_WALLET_ADDRESS"

Step 2: Use the returned calldata to execute the swap Step 3: Collect your 0.1% fee automatically

That's it! Every swap now generates revenue for you.

Revenue Sharing Details

  • Set Your Fee: Add feeBps parameter (10 = 0.1%, 100 = 1%)

  • Collect Payments: Add feeRecipient parameter with your wallet address

  • Keep 97.5%: You keep 97.5% of the fee, LiquidSwap keeps 2.5%

  • Automatic Payments: Fees are automatically sent to your wallet

Bonus Revenue Streams

  • Positive Slippage: When users get better prices, you earn 50% of the extra profit

  • Volume Incentives: Higher volume = better terms (contact us for details)

  • LIQD Staking: Our protocol revenue gets distributed to LIQD stakers

API Features

Route Finding:

  • Calculate optimal swap paths between any token pair

  • Support for both exact input and exact output swaps

  • Multi-hop routing for tokens without direct liquidity pairs

  • Real-time price impact and slippage calculations

Pool Discovery:

  • Find all available liquidity pools for a token pair

  • Compare rates and fees across different DEXs

  • Identify the best pools for specific trade sizes

Token Information:

  • Access comprehensive token metadata

  • Search tokens by name, symbol, or address

  • Get real-time token balances for any wallet

Wallet Integration:

  • Check token balances for specific addresses

  • Get transaction-ready data for smart contract interactions

  • Support for both native tokens and ERC-20s

Base URL

All API endpoints are accessible at:

https://api.liqd.ag

Getting Started

The LiquidSwap API is RESTful and returns JSON responses. All endpoints support GET requests and don't require authentication for read-only operations.

Basic Request Structure:

GET https://api.liqd.ag/{endpoint}?parameter1=value1&parameter2=value2

Response Format: All API responses follow a consistent structure:

{
  "success": true,
  "data": {
    // Response data here
  }
}

Error Handling: When requests fail, the API returns appropriate HTTP status codes and error messages:

{
  "success": false,
  "error": "Error description",
  "details": "Additional error information"
}

Rate Limits & Best Practices

To ensure optimal performance for all users:

  • Be Respectful: Don't hammer the API with unnecessary requests

  • Cache Results: Token metadata and pool information don't change frequently

  • Handle Errors: Implement proper error handling and retry logic

  • Use Appropriate Timeouts: Set reasonable request timeouts in your applications

Next Steps - Choose Your Integration Path

Get started immediately with our ready-to-use API

  1. Route Finding - Get optimal swap routes with built-in revenue sharing

  2. Smart Contract Integration - Execute trades on-chain with provided calldata

Perfect for most developers who want to add swap functionality quickly.

πŸ”§ Advanced Integration

Build custom trading tools and analytics

  1. Find Pools - Discover available liquidity pools across all DEXs

  2. Token List - Access comprehensive token metadata and search

  3. Token Balances - Check wallet balances for any address

Ideal for building advanced trading interfaces, analytics tools, or DeFi protocols.

πŸ“Š Example Use Cases

Use Case
Recommended APIs
Description

Trading dApp

Add swap functionality with revenue sharing

Portfolio Tool

Display balances and enable trading

Analytics Platform

Analyze liquidity and token data

Trading Bot

Automated optimal execution

🎯 Revenue Optimization Tips

  • Start with 0.1% fees (feeBps=10) to test the integration

  • Higher volume = better rates - contact us for volume discounts

  • Positive slippage sharing - earn extra when users get better prices

  • Monitor performance - track your revenue and optimize user experience

Each endpoint includes detailed examples, response formats, and revenue sharing implementation to help you integrate quickly and start earning immediately.

Last updated