Swap and Send
By default, swapped tokens are returned to the address that initiates the trade (the taker). With the recipient parameter, you can send the output tokens directly to any wallet address — in a single transaction.
This unlocks use cases like:
- Swapping and gifting tokens to another wallet
- Purchasing tokens on behalf of a user
- Automating treasury distributions in a different token
- Powering “pay with any token” checkout flows
The recipient parameter is supported on both the Swap API and Gasless
API.
How it works
When you include recipient in your request, the buyToken is delivered to that address at settlement. The taker (the address signing and submitting the transaction) still pays and authorizes the swap — they just don’t receive the output.
If recipient is omitted, it defaults to the taker’s address, so existing integrations are unaffected.
API Reference
recipient
recipient is not supported for wrap and unwrap operations (e.g. ETH ↔
WETH). Passing it for those trade types will result in an error. Check for
native/wrapped token pairs and omit recipient before calling the API.
Swap API Example
Include recipient as a query parameter when fetching a quote and submitting the swap.
TypeScript
Python
cURL
Gasless API Example
The recipient parameter works the same way with the Gasless API. Include it in the quote request body — the relayer will deliver buyToken to the recipient address on settlement.
TypeScript
Python
cURL
Errors
The API validates recipient at the price and quote stage — before any transaction is submitted — so no gas is wasted. There are two common error cases: an invalid recipient address and passing recipient on a wrap/unwrap operation.
Invalid recipient address
The recipient value must be a valid Ethereum address — a 42-character hex string starting with 0x. This error is triggered by things like a truncated address, a non-hex character, or passing a raw ENS name instead of a resolved address.
Always resolve ENS names to addresses client-side before passing them to the API. The recipient field does not support ENS.
To catch this before hitting the API, validate the address client-side:
Wrap/unwrap operations
recipient is not supported when sellToken and buyToken are a native/wrapped pair (e.g. ETH ↔ WETH, MATIC ↔ WMATIC). These operations don’t route through the swap protocol, so the recipient field has no effect and is rejected.
Guard against this by detecting wrap/unwrap pairs before building your request and omitting recipient in those cases:
The zid in the error response is a trace ID — include it when contacting support to help diagnose the issue.
Key considerations
- Taker still pays. The
takersigns and funds the transaction. Only the output destination changes. - Omitting
recipientis safe, it falls back to the taker address, so no changes are needed for existing flows. - Validate before sending. Always validate
recipientclient-side to avoid wasted gas on failed transactions. - Wrap/unwrap is not supported. Check for native/wrapped token pairs and strip
recipientbefore calling the API.