Route Finding

Endpoint

GET https://api.liqd.ag/v2/route

Calculates optimal swap routes across all DEXs with built-in revenue sharing.

Authentication: None required

Rate Limits: None

Parameters

Required Parameters

Name
Type
Description
Required
Example

tokenIn

address

Contract address of the input token (0x format)

Yes

0x5555555555555555555555555555555555555555 (WHYPE)

tokenOut

address

Contract address of the output token (0x format)

Yes

0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb (USDT)

amountIn

number

Amount of input token (human readable, e.g., 100 for 100 tokens)

Yes*

1000 (for 1000 WHYPE)

amountOut

number

Desired output amount (human readable, for exact output swaps)

Yes*

50000 (for exactly 50,000 USDT)

Note: Provide either amountIn OR amountOut, not both.

Optional Parameters

Name
Type
Description
Default
Example

multiHop

boolean

Enable multi-hop routing through intermediate tokens

false

true

slippage

number

Slippage tolerance as percentage (0.1-5.0 recommended)

1.0

0.5

unwrapWHYPE

boolean

Automatically unwrap WHYPE to native HYPE

false

true

excludeDexes

string

Comma-separated DEX indices to exclude from routing

none

1,3,5

includeDexes

string

Comma-separated DEX indices to include only (overrides excludeDexes)

none

1,5,15

feeBps

number

Your fee in basis points (100 = 1%, max 100) - you keep 97.5% of this

0

50

feeRecipient

address

Your wallet address to receive fee payments and positive slippage

none

0xaC7d...

Available DEXs

Index
DEX Name

1

KittenSwapV2

2

HyperSwapV2

3

HyperSwapV3

4

LaminarV3

5

KittenSwapV3

6

Valantis

7

HybraFinanceV2

8

HybraFinanceV3

9

Gliquid

10

RamsesV3

11

HyperCat

12

ProjectX

13

LiquidLaunch

14

HyperBrick

15

KittenSwapV4

16

HXFinance

17

UpheavalV3

18

UltraSolidV2

19

UltraSolidV3

20

CurveStableswapNG

21

CurveTwoCryptoNG

22

FunnelV3

23

Hyperpie

24

HyperpieDex

25

HybraFinanceV4

26

LiquidCore

27

RamsesV3Legacy

28

NestExchange

Note: This mapping may change over time. Use routerName in API responses when displaying protocol names.

Revenue Sharing

Fee Collection:

  • feeBps is optional — set to 0 for no trading fees

  • Charge up to 1% (100 bps) per swap via feeBps

  • Set feeRecipient to your wallet; fees are sent there directly during execution

  • 97.5% of your configured fee goes to feeRecipient; 2.5% goes to protocol

Positive Slippage Sharing:

  • When swaps perform better than expected, 50% of positive slippage is captured

  • If feeRecipient is set: 50% of captured slippage is sent to feeRecipient, 50% to protocol

  • If feeRecipient is not set or zero address: all captured positive slippage goes to protocol

  • You can set feeBps=0 and still receive positive slippage by providing feeRecipient

Example Requests

Basic Exact Input Swap:

Multi-hop with Custom Slippage:

Exact Output with WHYPE Unwrapping:

Exclude Specific DEXs:

Include Only Specific DEXs:

With Revenue Sharing (0.1% fee):

Response Format

TypeScript Interface

Example Response

Understanding the Response

Token Information

  • tokens.tokenIn: Complete metadata for the input token (what you're swapping from)

  • tokens.tokenOut: Complete metadata for the output token (what you're swapping to)

  • tokens.intermediates: Array of intermediate tokens used in multi-hop routes (only present for multi-hop swaps)

  • amountIn/amountOut: Human-readable amounts (e.g., "100" means 100 tokens)

  • averagePriceImpact: Overall price impact across all routes

Execution Data

  • execution.to: Contract address to send the transaction to

  • execution.calldata: Ready-to-use transaction data for your swap

  • execution.details.path: Token addresses in the swap path

  • execution.details.minAmountOut: Minimum output considering slippage

  • execution.details.hopSwaps: Detailed breakdown of each routing step

Last updated