Custom Links
CoW Swap supports URL query parameters to allow anyone to create a custom link for sharing a specific trade with a friend or on social media, or for creating a custom link to a specific trade for your own use.
Examples
https://swap.cow.fi
- CoW Swap main page (swap
is default page)https://swap.cow.fi/#/swap
-swap
pagehttps://swap.cow.fi/#/limit
-limit
orders pagehttps://swap.cow.fi/#/100/swap
-swap
page on Gnosis chain networkhttps://swap.cow.fi/#/100/limit/WXDAI/COW
- Create alimit
order to sellWXDAI
forCOW
https://swap.cow.fi/#/1/swap/WETH/COW?sellAmount=100
- Swap100 WETH
forCOW
https://swap.cow.fi/#/1/swap/WETH/COW?buyAmount=10000&recipient=vitalik.eth
- Buy onswap
sending the outcome to a custom recipient (can be either address or ens)https://swap.cow.fi/#/100/limit/WETH/WXDAI?sellAmount=2&buyAmount=6000
- Create a limit order to sell2 WETH
for6000 WXDAI
Query Parameters
Even though the main page is swap
, each page has it's own specific URL parameters that can be set, in addition to global parameters that are used on all pages. Parameters not applicable to a page will have no effect on UI settings.
Fortunately, the swap
and limit
pages have the same URL query parameters!
URL links format
Swap
https://swap.cow.fi/#/<chainId>/swap/<sellTokenSymbolOrAddress>/<buyTokenSymbolOrAddress>?recipient=<recipient>&sellAmount=<sellAmount>&buyAmount=<buyAmount>
Limit
https://swap.cow.fi/#/<chainId>/limit/<sellTokenSymbolOrAddress>/<buyTokenSymbolOrAddress>?recipient=<recipient>&sellAmount=<sellAmount>&buyAmount=<buyAmount>
Global parameters
Parameter | Type | Default | Description |
---|---|---|---|
theme | String | (determined by browser) | Sets theme to dark or light mode. |
Swap / limit parameters
All parameters are optional. If a parameter is not set, the default value will be used.
Parameter | Type | Default | Description |
---|---|---|---|
chainId | Integer | 1 - Ethereum Mainnet | Supported blockchains |
sellTokenSymbolOrAddress | Token symbol or address | Wrapped native token symbol for the current network (for Mainnet: WETH ) | Sell token symbol or address |
buyTokenSymbolOrAddress | Token symbol or address | Buy token symbol or address | |
recipient | address | undefined | Valid Ethereum account address |
sellAmount | Integer or Float | undefined | Amount of sell token to sell |
buyAmount | Integer or Float | undefined | Amount of buy token to buy |
Only one of sellAmount
or buyAmount
can be set for the swap
page. If both are set, only sellAmount
will be used.