Cloak API

Private swap

Send one asset and have the recipient receive another. Same endpoints, same flow. You change one field.

Set destinationAssetId to a different swappable asset and Cloak adds a conversion between the deposit and the payout. Quoted duration is longer than a send because of the extra on-chain leg; both swap states still report EXCHANGING, so your status handling needs no new case.

Supported pairs

veilo-usdc, veilo-usdt, veilo-usd1 and veilo-jup swap in any combination. veilo-sol and veilo-wsol do not. Their swap transaction exceeds Solana's size limit.

A rejected pair will not start working

Both assets can be individually valid and still not form a swappable pair. Cloak returns ASSET_NOT_SUPPORTED on destinationAssetId. Pick another asset rather than retrying.

What changes in the request

FieldDescription
destinationAssetIdstringrequiredDifferent from sourceAssetId. This one field is what makes the order a swap.
modestringoptionalMust be exact_in. exact_out returns QUOTE_FAILED on a cross-asset order.
slippageBpsintegeroptionalHow far below the quoted route price the swap commits its floor. Default 100, capped at 500.

amountOut is still exact, not a minimum: the swap commits a floor on-chain and the vault keeps any surplus. So slippageBps is not delivery uncertainty; it trades rate against completion rate. Wider completes more often and delivers less, tighter the reverse. A swap that fails before converting refunds in the source asset.

Fees and refunds

The payout spends the post-conversion note, so fee, feeBreakdown and amountOut are all in the destination token. A swap adds a fourth component, poolSwapFee, charged by the destination pool and neither ours nor yours.

exact_in · veilo-usdc → veilo-usdt · feeBps 50 · slippageBps 100

Sender deposits200.00amountIn
Route quoted199.99quotedOut
Committed floor197.99minSwapOut
− pool swap fee0.99poolSwapFee
− Veilo0.79veiloFee
− your share0.99partnerFee
− network0.21networkFee
Recipient receives195.02amountOut

The minimum is $10, the same as a send, but that is the smallest swap that can complete, not a cheap one. All-in cost runs about 15% at $10, 4% at $100 and 2% at $1,000. Show the quote, never a rate card.

A refund can return the destination asset

If the conversion succeeded and only the payout failed, the sender is refunded in the destination asset. Veilo does not swap back. An order that fails before its swap refunds in the source asset, exactly like a send. Disclose this before you ship; see Refunds.