curl --request POST \
--url https://api.relay.link/price \
--header 'Content-Type: application/json' \
--data '
{
"user": "<string>",
"originChainId": 123,
"destinationChainId": 123,
"originCurrency": "<string>",
"destinationCurrency": "<string>",
"amount": "<string>",
"tradeType": "EXACT_INPUT",
"recipient": "<string>",
"txs": [
{
"to": "<string>",
"value": "<string>",
"data": "<string>"
}
],
"referrer": "<string>",
"refundTo": "<string>",
"refundOnOrigin": true,
"useReceiver": true,
"useExternalLiquidity": true,
"useFallbacks": true,
"usePermit": true,
"useDepositAddress": true,
"slippageTolerance": "<string>",
"appFees": [
{
"recipient": "<string>",
"fee": "<string>"
}
]
}
'{
"fees": {
"gas": {
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png",
"verified": false,
"isNative": false
}
},
"amount": "30754920",
"amountFormatted": "30.75492",
"amountUsd": "30.901612",
"minimumAmount": "30454920"
},
"relayer": {
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png",
"verified": false,
"isNative": false
}
},
"amount": "30754920",
"amountFormatted": "30.75492",
"amountUsd": "30.901612",
"minimumAmount": "30454920"
},
"relayerGas": {
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png",
"verified": false,
"isNative": false
}
},
"amount": "30754920",
"amountFormatted": "30.75492",
"amountUsd": "30.901612",
"minimumAmount": "30454920"
},
"relayerService": {
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png",
"verified": false,
"isNative": false
}
},
"amount": "30754920",
"amountFormatted": "30.75492",
"amountUsd": "30.901612",
"minimumAmount": "30454920"
},
"app": {
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png",
"verified": false,
"isNative": false
}
},
"amount": "30754920",
"amountFormatted": "30.75492",
"amountUsd": "30.901612",
"minimumAmount": "30454920"
},
"subsidized": {
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png",
"verified": false,
"isNative": false
}
},
"amount": "30754920",
"amountFormatted": "30.75492",
"amountUsd": "30.901612",
"minimumAmount": "30454920"
}
},
"details": {
"operation": "<string>",
"timeEstimate": 123,
"userBalance": "<string>",
"sender": "<string>",
"recipient": "<string>",
"currencyIn": {
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png",
"verified": false,
"isNative": false
}
},
"amount": "30754920",
"amountFormatted": "30.75492",
"amountUsd": "30.901612",
"minimumAmount": "30454920"
},
"currencyOut": {
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png",
"verified": false,
"isNative": false
}
},
"amount": "30754920",
"amountFormatted": "30.75492",
"amountUsd": "30.901612",
"minimumAmount": "30454920"
},
"totalImpact": {
"usd": "<string>",
"percent": "<string>"
},
"swapImpact": {
"usd": "<string>",
"percent": "<string>"
},
"rate": "<string>",
"slippageTolerance": {
"origin": {
"usd": "<string>",
"value": "<string>",
"percent": "<string>"
},
"destination": {
"usd": "<string>",
"value": "<string>",
"percent": "<string>"
}
}
}
}This API returns a lightweight quote without calldata or steps.
curl --request POST \
--url https://api.relay.link/price \
--header 'Content-Type: application/json' \
--data '
{
"user": "<string>",
"originChainId": 123,
"destinationChainId": 123,
"originCurrency": "<string>",
"destinationCurrency": "<string>",
"amount": "<string>",
"tradeType": "EXACT_INPUT",
"recipient": "<string>",
"txs": [
{
"to": "<string>",
"value": "<string>",
"data": "<string>"
}
],
"referrer": "<string>",
"refundTo": "<string>",
"refundOnOrigin": true,
"useReceiver": true,
"useExternalLiquidity": true,
"useFallbacks": true,
"usePermit": true,
"useDepositAddress": true,
"slippageTolerance": "<string>",
"appFees": [
{
"recipient": "<string>",
"fee": "<string>"
}
]
}
'{
"fees": {
"gas": {
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png",
"verified": false,
"isNative": false
}
},
"amount": "30754920",
"amountFormatted": "30.75492",
"amountUsd": "30.901612",
"minimumAmount": "30454920"
},
"relayer": {
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png",
"verified": false,
"isNative": false
}
},
"amount": "30754920",
"amountFormatted": "30.75492",
"amountUsd": "30.901612",
"minimumAmount": "30454920"
},
"relayerGas": {
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png",
"verified": false,
"isNative": false
}
},
"amount": "30754920",
"amountFormatted": "30.75492",
"amountUsd": "30.901612",
"minimumAmount": "30454920"
},
"relayerService": {
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png",
"verified": false,
"isNative": false
}
},
"amount": "30754920",
"amountFormatted": "30.75492",
"amountUsd": "30.901612",
"minimumAmount": "30454920"
},
"app": {
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png",
"verified": false,
"isNative": false
}
},
"amount": "30754920",
"amountFormatted": "30.75492",
"amountUsd": "30.901612",
"minimumAmount": "30454920"
},
"subsidized": {
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png",
"verified": false,
"isNative": false
}
},
"amount": "30754920",
"amountFormatted": "30.75492",
"amountUsd": "30.901612",
"minimumAmount": "30454920"
}
},
"details": {
"operation": "<string>",
"timeEstimate": 123,
"userBalance": "<string>",
"sender": "<string>",
"recipient": "<string>",
"currencyIn": {
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png",
"verified": false,
"isNative": false
}
},
"amount": "30754920",
"amountFormatted": "30.75492",
"amountUsd": "30.901612",
"minimumAmount": "30454920"
},
"currencyOut": {
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png",
"verified": false,
"isNative": false
}
},
"amount": "30754920",
"amountFormatted": "30.75492",
"amountUsd": "30.901612",
"minimumAmount": "30454920"
},
"totalImpact": {
"usd": "<string>",
"percent": "<string>"
},
"swapImpact": {
"usd": "<string>",
"percent": "<string>"
},
"rate": "<string>",
"slippageTolerance": {
"origin": {
"usd": "<string>",
"value": "<string>",
"percent": "<string>"
},
"destination": {
"usd": "<string>",
"value": "<string>",
"percent": "<string>"
}
}
}
}Address that is depositing funds on the origin chain and submitting transactions or signatures
Amount to swap as the base amount (can be switched to exact input/output using the dedicated flag), denoted in the smallest unit of the specified currency (e.g., wei for ETH)
Whether to use the amount as the output or the input for the basis of the swap
EXACT_INPUT, EXACT_OUTPUT, EXPECTED_OUTPUT Address that is receiving the funds on the destination chain, if not specified then this will default to the user address
Address to send the refund to in the case of failure, if not specified then the recipient address or user address is used
Always refund on the origin chain in case of any issues
Enable this to route payments via a receiver contract. This contract will emit an event when receiving payments before forwarding to the solver. This is needed when depositing from a smart contract as the payment will be an internal transaction and detecting such a transaction requires obtaining the transaction traces.
Enable this to use canonical+ bridging, trading speed for more liquidity
Enable this for specific fallback routes
Enable this to use permit (eip3009) when bridging, only works on supported currency such as usdc
Enable this to use a deposit address when bridging, in scenarios where calldata cannot be sent alongside the transaction. only works on native currency bridges.
Slippage tolerance for the swap, if not specified then the slippage tolerance is automatically calculated to avoid front-running. This value is in basis points (1/100th of a percent), e.g. 50 for 0.5% slippage
Default Response
Show child attributes
Origin chain gas fee
Show child attributes
Show child attributes
{
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png",
"verified": false,
"isNative": false
}
},
"amount": "30754920",
"amountFormatted": "30.75492",
"amountUsd": "30.901612",
"minimumAmount": "30454920"
}
Combination of the relayerGas and relayerService to give you the full relayer fee
Show child attributes
Show child attributes
{
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png",
"verified": false,
"isNative": false
}
},
"amount": "30754920",
"amountFormatted": "30.75492",
"amountUsd": "30.901612",
"minimumAmount": "30454920"
}
Destination chain gas fee
Show child attributes
Show child attributes
{
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png",
"verified": false,
"isNative": false
}
},
"amount": "30754920",
"amountFormatted": "30.75492",
"amountUsd": "30.901612",
"minimumAmount": "30454920"
}
Fees paid to the relay solver, note that this value can be negative (which represents network rewards for moving in a direction that optimizes liquidity distribution)
Show child attributes
Show child attributes
{
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png",
"verified": false,
"isNative": false
}
},
"amount": "30754920",
"amountFormatted": "30.75492",
"amountUsd": "30.901612",
"minimumAmount": "30454920"
}
Fees paid to the app. Currency will be the same as the relayer fee currency. This needs to be claimed later by the app owner and is not immediately distributed to the app
Show child attributes
Show child attributes
{
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png",
"verified": false,
"isNative": false
}
},
"amount": "30754920",
"amountFormatted": "30.75492",
"amountUsd": "30.901612",
"minimumAmount": "30454920"
}
The amount of fees for the request that are subsidized by the request sponsor. Does not include deposit origin gas unless it is a permit based deposit.
Show child attributes
Show child attributes
{
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png",
"verified": false,
"isNative": false
}
},
"amount": "30754920",
"amountFormatted": "30.75492",
"amountUsd": "30.901612",
"minimumAmount": "30454920"
}
A summary of the swap and what the user should expect to happen given an input
Show child attributes
The operation that will be performed, possible options are send, swap, wrap, unwrap, bridge
Estimated swap time in seconds
The user's balance in the given currency on the origin chain
The address that deposited the funds
The address that will be receiving the swap output
Show child attributes
Show child attributes
{
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png",
"verified": false,
"isNative": false
}
},
"amount": "30754920",
"amountFormatted": "30.75492",
"amountUsd": "30.901612",
"minimumAmount": "30454920"
}
Show child attributes
Show child attributes
{
"currency": {
"chainId": 8453,
"address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"metadata": {
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png",
"verified": false,
"isNative": false
}
},
"amount": "30754920",
"amountFormatted": "30.75492",
"amountUsd": "30.901612",
"minimumAmount": "30454920"
}
The swap rate which is equal to 1 input unit in the output unit, e.g. 1 USDC -> x ETH. This value can fluctuate based on gas and fees.
Show child attributes
Was this page helpful?