## Documentation Index Fetch the complete documentation index at: https://docs.relay.link/llms.txt Use this file to discover all available pages before exploring further.
## Agent Instructions To quote bridges and swaps, look up chains and tokens, or track Relay transactions from an agent, use the Relay MCP server: npx -y @relayprotocol/relay-mcp. It is read-only and does not sign or broadcast transactions. Setup: https://docs.relay.link/resources/developing-with-ai.md For Relay Protocol's trust model, security architecture, and audits, see https://docs.relay.link/references/protocol/security.md. For address screening, see https://docs.relay.link/security/transaction-screening.md.Refunds
Learn how Relay handles refunds.
The Relay platform tracks refunds when a bridge or swap cannot complete. Solvers can return funds on the origin chain instead of filling on the destination chain. This page describes platform refund behavior; see protocol refunds for how those transfers settle.
What is a refund?
A refund returns funds to a user when a swap or bridge cannot be completed. Refunds are paid on the origin chain to the refundTo address supplied on the quote. If refundTo is not set, automatic refund is disabled.
What causes refunds to happen?
A refund is triggered when the swap or bridge fails to complete. A failure can occur for a variety of reasons including but not exclusive to:
- *Transactions Reverting:* Before giving a quote, we simulate the transaction to ensure it will succeed.
Between the time the quote is given and the user accepts & deposits funds, the transaction could revert. Transactions reverting could be caused by if there is a contested mint or execution was delayed.
- *User's Wallet Address is Different Than Transaction Depositing Address:* This happens when the user
switches wallets right before signing the transaction. Users must execute the transaction with the wallet address that received the quote.
- *User Deposits Too Little:* The user explicitly deposits a lower amount than Relay requested.
- *Destination Chain is Unavailable:* Occasionally, the destination chain will
have a network outage beyond our control. An example could be an RPC that is down or the chain is experiencing a large reorganization.
- *User Sends Deposits With the Same Request ID in the Calldata Multiple Times*
- *User Send Deposits Without a Request ID in the Calldata*
- *Quote Regeneration leads to high slippage*: Quotes are regenerated upon execution. Each quote contains a
currencyOut.minimumAmountwhich details the minimum a user will receive, if regeneration leads to a lowercurrencyOut.minimumAmount, the user will be refunded.
Refund amounts and costs
The refund amount may be less than what you originally deposited due to several factors:
- Gas costs are deducted: The gas cost of processing the refund transaction is deducted from the refunded amount.
- Origin swaps: If your transaction included an origin swap, you will only receive what the depository contract actually received after the swap, not your original deposit amount.
For example, if your deposit transaction swaps a memecoin into USDC, the refundable amount is the USDC deposited after that swap, minus refund gas costs.
Fees on refunded requests
Relay does not keep Platform Fees or app fees on a refunded request.
| Fee | Treatment on a refunded request | |
|---|---|---|
| Platform Fees | Not retained | |
| App fees | Not collected |
On a refunded request, paidAppFees on /requests/v2 is empty or zero. To check, see Verifying Fee Collection.
When is there no refund given?
If the refund amount is not enough to cover the cost of gas, Relay will mark the bridge or swap as failed & no refund will be sent.
What currency is used for refunds?
The refund currency can vary by route. Relay will always attempt to refund the user in the original currency they sent. Usually this is one of the currencies in the solverCurrencies in the chain api response, which are native or stable coins.
Are refunds automatic & instant?
Automatic refunds require `refundTo` to be set and a refundable balance large enough to cover gas. A solver submits the refund when the route's checks permit it; completion depends on the origin chain. Screening failures and other execution errors can prevent automatic refunds.
How can I force a refund for testing purposes?
You can force a refund by passing debug-force-refund as the referrer.
curl -X POST \
'https://api.relay.link/quote/v2' \
-H 'Content-Type: application/json' \
-d '{
"referrer": "debug-force-refund",
"user":"0xf3d63166F0Ca56C3c1A3508FcE03Ff0Cf3Fb691e",
"originChainId":8453,
"destinationChainId": 10,
"originCurrency":"0x0000000000000000000000000000000000000000",
"destinationCurrency":"0x0000000000000000000000000000000000000000",
"recipient":"0xf3d63166F0Ca56C3c1A3508FcE03Ff0Cf3Fb691e",
"tradeType":"EXACT_INPUT",
"amount":"1000000000000000000"
}'This documentation is built and hosted on Mintlify, a developer documentation platform.