/v1/dex/quote
Get swap quote with routing / path finding (successor to POST /account/path-find). Exact-output via destination_value, or exact-input via source_value
Request
https://api.xrpl.to/v1/dex/quote{ source_account, destination_token, destination_value?, source_value?, source_token?, slippage?, destination_account? (the Payment Destination when the output goes to another account; the price is the same, the receive-side checks read that account) }
curl -X POST 'https://api.xrpl.to/v1/dex/quote' \
-H 'Content-Type: application/json' \
-d '{ "source_account": "rJqiMb94hyz41SBTNr2AyPNW8AzELa8nE", "source_token": "XRP", "destination_token": "0dd550278b74cb6690fdae351e8e0df3", "source_value": "100" }'Response
https://api.xrpl.to/v1/dex/quote{ "success": true, "status": "success", "requiresTrustline": { "currency": "524C555344000000000000000000000000000000", "issuer": "rMxCKbEDwqr76QuheSUMdEGf4B9xJ8m5De", "limit": "143.81599964504392" }, "fast": true, "quote": { "source_amount": { "currency": "XRP", "value": "100.000000" }, "destination_amount": { "currency": "524C555344000000000000000000000000000000", "issuer": "rMxCKbEDwqr76QuheSUMdEGf4B9xJ8m5De", "value": "143.81599964504392" }, "execution_rate": "0.69533293", "spot_price": "0.69415730", "price_impact": { "percent": "0.17%", "xrp": "0.17 XRP" }, "amm_price_change": null, "suggested_slippage": 0.45, "savings": null, "slippage_tolerance": "5.0%", "minimum_received": "136.625200", "from_orderbook": "143.816000", "from_amm": "0", "amm_pool_fee": null, "amm_trading_fee_bps": 205, "paths_count": 1, "paths": [], "warnings": [], "route": "xrp" }, "alternatives": [], "amm_info": { "account": "rhWTXC2m2gGGA9WozUaoMm6kLAVPb1tcS3", "amount": "1640557777061", "amount2": { "currency": "524C555344000000000000000000000000000000", "issuer": "rMxCKbEDwqr76QuheSUMdEGf4B9xJ8m5De", "value": "2363380.430905624" }, "asset2_frozen": false, "auction_slot": { "account": "r4uKh2rHuarMZdAgSBYqqicX7MxPBegttw", "auth_accounts": [ { "account": "rNy92d5CrBQ1eC5HUokq1LDfcuLPvTfh4X" }, { "account": "rJrFQCQKgUJwG6bnDLyX33ea4DwWcjk6P3" }, { "account": "rGDuzDRHd7MEPHLykPt6Z2CkQuvBcDrdQZ" }, { "account": "rBJpahxkPrMenKYzKBKEFNGsd7KpBTPL5P" } ], "discounted_fee": 20, "expiration": "2026-03-02T17:05:00+0000", "price": { "currency": "03B245BE580EC4F4386A751C084489EC4B514A2F", "issuer": "rhWTXC2m2gGGA9WozUaoMm6kLAVPb1tcS3", "value": "131482.3939333034" }, "time_interval": 20 }, "lp_token": { "currency": "03B245BE580EC4F4386A751C084489EC4B514A2F", "issuer": "rhWTXC2m2gGGA9WozUaoMm6kLAVPb1tcS3", "value": "1676305205.007748" }, "trading_fee": 205, "vote_slots": [ { "account": "rJ4XeEzorvsQp6un4h9CjtANEsB3Qcc8iA", "trading_fee": 300, "vote_weight": 3150 }, { "account": "rDu4vMpZU5WcwVME6oorzSov4DMLWXUEDf", "trading_fee": 0, "vote_weight": 2093 }, { "account": "rHq1hgWYgaiG9ycudXHoMbqGdJi75UTfzt", "trading_fee": 200, "vote_weight": 3776 }, { "account": "rETg9RYxRAxgNjm33Q4tAWceKKVoMcpM7", "trading_fee": 200, "vote_weight": 3776 }, { "account": "rnEQs55pWyvEfWXkjMCD2TNzCQ1uS7SBGS", "trading_fee": 200, "vote_weight": 3776 } ] }, "took": 51 }
Long arrays and strings are shortened in the example; Send request for the full answer.
{ status, took, requiresTrustline, quote: { source_amount, destination_amount, execution_rate, price_impact, amm_price_change (pool spot price % change if the fill executes — buys positive, sells negative; single-leg XRP routes with AMM participation, else null), suggested_slippage (percent — recommended DeliverMin tolerance for this trade; use it instead of a flat value), paths (XRPL Paths the Payment must include — required for token-to-token routes, empty otherwise), warnings[] ({code, message} pre-flight checks: insufficient_balance | line_frozen | dest_limit_low | token_frozen | split_recommended; with a destination_account: recipient_no_trustline | recipient_not_authorized | recipient_line_frozen | recipient_limit_low | recipient_unverified — each means the Payment would fail), destination_account (echoed when it differs from source_account), route, paths_count }, alternatives[] }
What it does
Get swap quote with routing / path finding (successor to POST /account/path-find). Exact-output via destination_value, or exact-input via source_value