- Your parent organization has enabled Swaps via
ACTIVITY_TYPE_UPSERT_SWAP_CONFIGwith a validfeeReceiverWalletAddressandfeeBps. Quote requests against organizations without the Swaps feature flag will fail. Without a swap configuration, quotes default to a client fee of 0. SeeEnable Swaps. - The signing address (
signWith) is a wallet account in the organization submitting the activity. Parent organization wallets and sub-organization wallets can both swap: the activity belongs to the organization that owns the wallet. In a delegated access setup, a delegate can submit the activity to the wallet owner’s organization or act as the second signer on an activity submitted by the wallet owner.
Swaps is currently an Early Access Product. Contact us to enable it for your organization.
Call create_swap_quote
Quoting is an activity: submit anACTIVITY_TYPE_CREATE_SWAP_QUOTE activity with the standard envelope (type, timestampMs, organizationId) and a parameters object.
string
required
The organization that owns the swapping wallet. Parent organizations and sub-organizations can both swap; the parent’s swap configuration applies in either case.
string
required
The wallet account address that will sign and fund the swap. Quotes are computed against this address, so balances and allowances are reflected accurately.
string
required
CAIP-19 identifier for the asset being sold, e.g.
eip155:8453/erc20:0x833589fCD6EDB6E08f4c7C32D4f71b54bdA02913 (USDC on Base). The origin chain is derived from this identifier.string
required
CAIP-19 identifier for the asset being bought. If its CAIP-2 prefix matches
inputToken, the swap is same-chain; otherwise it’s a cross-chain route. Native assets use slip44:, e.g. eip155:137/slip44:966 (POL).string
required
In raw onchain units of the input asset, e.g.
"1000000" for 1 USDC at 6 decimals.string
Slippage tolerance in basis points as a stringified integer, e.g.
"50" for 0.5%. Used to compute each quote’s minOutputAmount.cURL
JavaScript
Read the response
The result contains a quotes array. Each quote is executable as-is:quoteId— identifies this quote. Pass it toACTIVITY_TYPE_EXECUTE_SWAP_V2to execute against this quote’s pricing; execution is pinned to the quote it references.provider— the provider that produced the quote and will execute the swap.outputAmount— expected output in raw onchain units, net of all fees. This is what the recipient receives if the swap fills at the quoted price.minOutputAmount— the floor enforced at execution, derived fromoutputAmountand your slippage tolerance. If the swap cannot deliver at least this amount, it fails rather than filling worse.slippageBps— the slippage tolerance this quote was priced with, echoed from the request.clientFeeBps— your organization’s configured fee, for display or audit. Turnkey’s fee is baked into the quoted amounts and is not itemized. See Fees.estimatedTimeSeconds— estimated time to settlement.expiresAt— millisecond epoch after which the quote can no longer be executed.
Execution price semantics
Execution is pinned to the quote:ACTIVITY_TYPE_EXECUTE_SWAP_V2 references a quoteId, and the signed intent carries that quote’s quotedOutputAmount and minOutputAmount. The economics your user signs are the economics that execute.
Within those bounds, the actual fill can move:
minOutputAmountis the enforced floor. If the swap cannot deliver at least this amount, it will fail — the user never receives less than the floor they signed.outputAmountis the expected fill, not a guarantee. The settled amount can be higher or lower than quoted, bounded on the low side byminOutputAmount. The actual amount is reported asoutputAmountin swap status onCOMPLETED.- Quotes expire. A quote can only be executed before its
expiresAt; after that, request a new quote. Quotes may still be technically valid while the route the quote describes is no longer available in the market due to price movements. In that situation, if the quote cannot be executed with the economic parameters, it will fail at execution time.
Slippage
Slippage is the difference between the price reflected in a quote and the price at which the swap actually executes onchain. It occurs because prices can move between quoting and execution. Low-liquidity pairs, large trade sizes, and periods of high network activity can increase slippage. You set your tolerance at quote time viaslippageBps, in basis points (e.g. "50" for 0.5%). Each quote derives its minOutputAmount from the quoted outputAmount and your tolerance, and the signed execute intent carries that floor. If the swap would return less than minOutputAmount, it fails rather than filling worse.
Choosing a tolerance is a tradeoff worth surfacing to your users:
- A tighter slippage tolerance reduces the risk of an unfavorable fill but increases the chance the swap fails if the market moves.
- A wider tolerance makes execution more likely but exposes the user to a worse price, down to the floor.
- A swap that fails on the floor still incurs gas for the reverted origin transaction. If the swap is sponsored, that cost falls on your organization, not the user — slippage-driven reverts are a gas cost to budget for in sponsored flows.
expiresAt; if a quote has expired before the user confirms, request a new one rather than executing stale economics. Quotes are more likely to succeed the closer they are generated to execution time.
How fees are applied
Every quote’soutputAmount and minOutputAmount already reflect all fees — Turnkey’s and yours. There is no fee math to do on your side: the amount you display to the user is the quote’s outputAmount, and the amount they receive is the settled outputAmount from swap status.
Your fee configuration is applied when the quote is created. The fee baked into a quote travels with it: executing a quote settles at that quote’s economics, even if you change your fee configuration in between. Fee changes take effect for new quotes.
Same-chain vs. cross-chain quotes
Quote shape is identical for same-chain and cross-chain routes. Whether a swap is same-chain or cross-chain is determined by the CAIP-2 prefixes ofinputToken and outputToken; the provider selects the route within that. Same-chain routes cover EVM and Solana. Cross-chain routes are EVM ↔ EVM, with EVM ↔ SVM coming soon.
Cross-chain quotes are subject to the same freshness and slippage semantics as same-chain quotes, but cross-chain execution has a longer post-broadcast lifecycle — the swap stays PENDING until the destination leg settles or funds are refunded. See Track swap status for the two lifecycle models.
Next steps
- Execute a swap: the signing activity that runs the swap end-to-end.
- Track swap status: same-chain vs. cross-chain polling.