curl --request POST \
--url https://api.soroswap.finance/quote/build \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"quote": {
"assetIn": "CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75",
"assetOut": "CDTKPWPLOURQA2SGTKTUQOWRCBZEORB4BWBOMJ3D3ZTQQSGE5F6JBQLV",
"amountIn": "10000000",
"amountOut": "9067253",
"otherAmountThreshold": "9067253",
"tradeType": "EXACT_IN",
"priceImpactPct": "0.50",
"platform": "aggregator",
"rawTrade": {
"amountIn": "10000000",
"amountOutMin": "9067253",
"distribution": [
{
"protocol_id": "soroswap",
"path": [
"CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75",
"CD25MNVTZDL4Y3XBCPCJXGXATV5WUHHOWMYFF4YBEGU5FCPGMYTVG5JY",
"CDTKPWPLOURQA2SGTKTUQOWRCBZEORB4BWBOMJ3D3ZTQQSGE5F6JBQLV"
],
"parts": 10,
"is_exact_in": true
}
]
},
"routePlan": [
{
"swapInfo": {
"protocol": "soroswap",
"path": [
"CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75",
"CD25MNVTZDL4Y3XBCPCJXGXATV5WUHHOWMYFF4YBEGU5FCPGMYTVG5JY",
"CDTKPWPLOURQA2SGTKTUQOWRCBZEORB4BWBOMJ3D3ZTQQSGE5F6JBQLV"
]
},
"percent": "100"
}
]
},
"to": "GCSQJ7TCEVWXK2JZPTTTCJCVZZNMQXEJWVHIOCUAQHWNJSXKHX7OHVUW",
"from": "GBQJ4HBCQHJQKSKNT3JRKC5VKA3QJUXBVFWIVSMHKPQSJ7XP2IXTCAAK"
}
'{
"xdr": "AAAAAgAAAAB8shYDi1JO9x2/3jMeVzK2IGtrsFVWLCL4uHRJf+YPyAAAA+gCzi7HAAAApgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAGAAAAAAAAAABc12cL..."
}{
"message": "User signature required for sponsored transaction",
"action": "SIGN_USER_TRANSACTION",
"actionData": {
"xdr": "AAAAAgAAAAB8shYDi1JO9x2...",
"step": 1,
"totalSteps": 2,
"description": "Sign the transaction with the user wallet and send back the signed XDR"
}
}Build
Builds an unsigned XDR for a quote.
If Gasless Trustline Swap is enabled, the XDR must be signed by both the user and the sponsor.
β‘ Gasless Trustline Flow
When enabled, the transaction will include all the operations required to perform the swap, plus extra operations to:
- π° Buy 0.5 XLM β The user purchases 0.5 XLM and sends it to the sponsor wallet.
- π‘ Sponsor Trustline Reserve β The sponsor wallet covers the reserve required to open the userβs trustline.
Note: The
gaslessTrustlinefeature only works with a swap on the Stellar Classic DEX, and will be applied only to the first swap for a specific user.
On mainnet, an EXACT_OUT quote against the Soroswap Aggregator sizes a fixed spend rather than an exact output: amountIn and otherAmountThreshold both become the amount that will actually be spent, and amountOut is the minimum you will receive, with any surplus delivered on top. SDEX quotes and every testnet quote are unaffected β EXACT_OUT there still means an exact output behind a slipped maximum input.
curl --request POST \
--url https://api.soroswap.finance/quote/build \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"quote": {
"assetIn": "CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75",
"assetOut": "CDTKPWPLOURQA2SGTKTUQOWRCBZEORB4BWBOMJ3D3ZTQQSGE5F6JBQLV",
"amountIn": "10000000",
"amountOut": "9067253",
"otherAmountThreshold": "9067253",
"tradeType": "EXACT_IN",
"priceImpactPct": "0.50",
"platform": "aggregator",
"rawTrade": {
"amountIn": "10000000",
"amountOutMin": "9067253",
"distribution": [
{
"protocol_id": "soroswap",
"path": [
"CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75",
"CD25MNVTZDL4Y3XBCPCJXGXATV5WUHHOWMYFF4YBEGU5FCPGMYTVG5JY",
"CDTKPWPLOURQA2SGTKTUQOWRCBZEORB4BWBOMJ3D3ZTQQSGE5F6JBQLV"
],
"parts": 10,
"is_exact_in": true
}
]
},
"routePlan": [
{
"swapInfo": {
"protocol": "soroswap",
"path": [
"CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75",
"CD25MNVTZDL4Y3XBCPCJXGXATV5WUHHOWMYFF4YBEGU5FCPGMYTVG5JY",
"CDTKPWPLOURQA2SGTKTUQOWRCBZEORB4BWBOMJ3D3ZTQQSGE5F6JBQLV"
]
},
"percent": "100"
}
]
},
"to": "GCSQJ7TCEVWXK2JZPTTTCJCVZZNMQXEJWVHIOCUAQHWNJSXKHX7OHVUW",
"from": "GBQJ4HBCQHJQKSKNT3JRKC5VKA3QJUXBVFWIVSMHKPQSJ7XP2IXTCAAK"
}
'{
"xdr": "AAAAAgAAAAB8shYDi1JO9x2/3jMeVzK2IGtrsFVWLCL4uHRJf+YPyAAAA+gCzi7HAAAApgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAGAAAAAAAAAABc12cL..."
}{
"message": "User signature required for sponsored transaction",
"action": "SIGN_USER_TRANSACTION",
"actionData": {
"xdr": "AAAAAgAAAAB8shYDi1JO9x2...",
"step": 1,
"totalSteps": 2,
"description": "Sign the transaction with the user wallet and send back the signed XDR"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Network on which the operation will be performed
testnet, mainnet Body
Data required to build the quote
The quote to build the XDR for
The wallet address that will send the funds
The wallet address that will receive the funds. If Gasless Trustline Swap is enabled, this is the wallet address must be the same as the from address (hence, don't provide this parameter)
Ignored. Fee destinations are no longer caller-supplied; the value you send is recorded so Soroswap can propose your payout address.
The wallet address that will sponsor the transaction. Only required for Gasless Trustline Swap and Soroban sponsored transactions
The signed transaction XDR from Step 1 of Soroban sponsored transactions. Required for Step 2 when sponsor is provided for non-SDEX platforms.
Response
XDR built successfully
Transaction XDR ready for signing and execution
"AAAAAgAAAAB8shYDi1JO9x2/3jMeVzK2IGtrsFVWLCL4uHRJf+YPyAAAA+gCzi7HAAAApgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAGAAAAAAAAAABc12cL..."