Advanced swap (Solana)
Execute a low-latency synchronous Solana token swap with an embedded wallet.
Overview
The advanced swap endpoint performs a synchronous Solana token swap in a single request: Privy fetches a quote, signs the transaction via the enclave, and submits it to the network. Wallet data preparation is parallelized with the swap quote fetching to minimize latency. Unlike the standard swap endpoint, this endpoint returns the signed transaction directly rather than creating an asynchronous wallet action. To learn more about the design of this endpoint, see our blog post on reducing trading latency.Prerequisites
- The wallet must be a Solana embedded wallet
- Your app must be approved for access to this Labs endpoint
Considerations
This endpoint behaves similarly tooptimistic_broadcast on the standard Solana sign-and-send endpoint:
- The response is returned as soon as the transaction is signed and submitted, it does not wait for onchain confirmation.
- The
submission_statusfield indicates whether the network acknowledged the transaction, not whether it confirmed onchain. Monitor the returnedtransaction_hashvia Solana RPC for final status. - The
signed_transactionfield contains the fully signed transaction (base64-encoded), which can be rebroadcast to any Solana RPC endpoint for redundancy or improved landing rates. - Your app is responsible for checking transaction validity and rebroadcasting if needed.
Authorizations
Basic Auth header with your app ID as the username and your app secret as the password.
Headers
ID of your Privy app.
Request authorization signature. If multiple signatures are required, they should be comma separated.
Path Parameters
ID of the wallet.
Body
Request body for initiating a synchronous Solana token swap through an embedded wallet.
Input token address (base58 mint address).
Output token address (base58 mint address).
Amount in the smallest unit of the input token (e.g. lamports for SOL).
CAIP-2 chain identifier. Defaults to Solana mainnet.
Max slippage tolerance in basis points (0-10000), or "auto" for provider-determined. Defaults to "auto".
0 <= x <= 10000When true, skip transaction submission (quote + sign only). The signed transaction is still returned.
Platform fee in basis points, taken from the output token. Requires fee_recipient when > 0.
0 <= x <= 10000Token account (base58) to receive the platform fee. Must exist on-chain for the output token.
Response
Swap executed successfully.
Response from the synchronous Solana swap endpoint.
Solana transaction signature (base58).
"accepted" if the network has acknowledged the transaction, "rejected" if the network refused it, "skipped" if dry_run was set. Not an onchain confirmation.
accepted, rejected, skipped Fully signed transaction (base64). Callers can re-submit to any Solana RPC for redundancy.
Which aggregator fulfilled the swap (e.g. "dflow").
Input token address (base58).
Output token address (base58).
Input amount consumed (smallest unit).
Expected output amount before slippage (smallest unit).
Minimum output amount guaranteed by slippage tolerance (smallest unit).
Slippage applied in basis points. Reflects the resolved value if "auto" was requested.
Platform fee details, present when a fee was applied.

