This endpoint performs a multi-hop swap through a sequence of liquidity pools, allowing users to exchange assets that may not have direct trading pairs. Each hop in the route represents a swap through a different pool.
The route is executed atomically:
Before execution, the system validates:
Fees are applied at each hop:
Two levels of slippage protection:
Requires a valid JWT bearer token. The token’s public key must match
the user_public_key in the request. The request must be signed with
the user’s private key.
user_public_key - Public key of the user executing the swaphops - Ordered list of pools and assets for the routeinitial_spark_transfer_id - Spark transfer proof for input assetinput_amount - Amount of initial asset to swapmax_route_slippage_bps - Maximum slippage for entire routenonce - Unique value for replay protectionsignature - Request signature for verificationintegrator_fee_rate_bps - Optional default integrator feeintegrator_public_key - Optional integrator identifier200 OK with route swap details if successful400 Bad Request if validation fails or route cannot be executed401 Unauthorized if authentication or signature verification fails500 Internal Server Error if route execution failsBearer authentication header of the form Bearer <token>, where <token> is your auth token.
Route swap execution details including hop sequence and authentication
Defines the request to execute a swap across a defined route of liquidity pools.
The public key of the user initiating the swap. Must match the key in the auth token.
"02abcdef0123456789abcdef0123456789abcdef0123456789abcdef01234567"
An ordered sequence of pools and assets that defines the swap route. Must contain 1-4 hops.
[
{
"assetInAddress": "03bitcoinassetpubkey0000000000000000000000000000000000000000000000",
"assetOutAddress": "03ethereumassetpubkey1111111111111111111111111111111111111111111111",
"hopIntegratorFeeRateBps": "25",
"poolId": "03pool1aabbccddeeff00112233445566778899aabbccddeeff00112233445566778"
},
{
"assetInAddress": "03ethereumassetpubkey1111111111111111111111111111111111111111111111",
"assetOutAddress": "03usdstablecoinpubkey2222222222222222222222222222222222222222222222",
"hopIntegratorFeeRateBps": "25",
"poolId": "03pool2bbccddeeffffaabbccddeeff00112233445566778899aabbccddeeff0011"
}
]The unique identifier of the Spark transfer for the initial input asset deposit.
"spark-route-transfer-uuid-123456"
The total amount of the input asset to be swapped, in its smallest unit.
x >= 0100000000
The maximum acceptable slippage for the entire route, in basis points.
x >= 0200
The minimum amount of the final output asset the user agrees to receive.
x >= 0100000000
A unique, user-generated string to prevent replay attacks.
"unique-route-swap-nonce-789"
Cryptographic signature of the request payload for verification.
"3045022100b8c9d2e3f4a5b6c7d8e9f0a1b2c3d4e5f6789012345678901234567890123402207f6e5d4c3b2a1908f7e6d5c4b3a29180706f5e4d3c2b1a0908070605040302010"
An optional default fee in basis points for the route integrator.
x >= 050
The public key of the integrator to receive fees. Required if integrator_fee_rate_bps is
set.
"03integratorpubkey33445566778899aabbccddeeff00112233445566778899aa"
Route swap execution successful
Represents the response after a route swap execution attempt.
A unique identifier for the request, for tracing and logging.
Indicates whether the route swap was accepted for processing.
The final amount of the output asset received, in its smallest unit.
x >= 0The effective price of the swap, calculated as output_amount / input_amount.
The unique identifier of the final Spark transfer for the output asset.
Settlement service request ID for correlation
"018D5E56-9D80-7890-A1B2-C3D4E5F6G7H8"
If the swap failed, this field contains a description of the error.
If the swap failed and a refund was issued, this is the public key of the refunded asset.
The amount of the refunded asset.
x >= 0The unique identifier of the refund transfer on Spark.