Step Transaction
Use this endpoint to convert a selected advanced route (returned by /v1/advanced/routes) into the final transaction payload a wallet needs to execute. It validates the route, enriches it with current gas data, and returns the transactionRequest object ready for signing.
If you want to learn more about how to use this endpoint, please have a look at our guide.
API
Endpoint Details
POST /v1/advanced/stepTransaction
Submit a selected route step and get the final wallet transaction.
Request
Headers
X-API-KeystringAPI key issued by Router Protocol
Content-TypestringrequiredSet to `application/json`
Query Parameters
senderAddressstringrequiredWallet that signs and submits the transaction
recipientAddressstringrequiredWallet that should receive the bridged funds
Request Body
idstringrequiredStep identifier from advanced routes
typestringrequiredStep type (`bridge`, `swap`, etc.)
toolstringrequiredBridge/DEX/tool that will execute this step
toolDetailsobjectDetailed metadata about the tool
fromChainIdstringrequiredtoChainIdstringrequiredfromTokenobjectrequiredtoTokenobjectrequiredfromAmountstringrequiredslippagenumberfromAddressstringrequiredtoAddressstringrequiredtoolstringrequiredtoAmountMinstringrequiredtoAmountstringrequiredfromAmountstringrequiredfeeCostsobject[]gasCostsobject[]includedStepsobject[]transactionRequestobjectexecutionobjectResponse
Status Code: 200 OK
Content Type: application/json
Response
idstringrequiredStep identifier
typestringrequiredStep type
toolstringrequiredBridge/DEX/tool used
toolDetailsobjectactionobjectrequiredSame action object returned for reference
estimateobjectrequiredUpdated estimate with gas costs
includedStepsobject[]fromstringrequiredtostringrequiredchainIdstringrequireddatastringrequiredCalldata for the bridge/swap contract
valuestringrequiredAmount of native token to send (wei)
gasPricestringgasLimitstringrequiredexecutionobjectExample Request
curl -X POST \
'https://xplore.api.v2.routerprotocol.com/v1/advanced/stepTransaction?senderAddress=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045&recipientAddress=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"id": "bf35012e-bac0-421b-9d85-23b058610f8f",
"type": "bridge",
"tool": "across",
"toolDetails": null,
"action": {
"fromChainId": "1",
"toChainId": "42161",
"fromToken": { "address": "0x0000000000000000000000000000000000000000", "chainId": "1", "symbol": "ETH", "decimals": 18, "name": "ETH" },
"toToken": { "address": "0x0000000000000000000000000000000000000000", "chainId": "42161", "symbol": "ETH", "decimals": 18, "name": "ETH" },
"fromAmount": "999900000000000000",
"slippage": 0.03,
"fromAddress": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
"toAddress": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
},
"estimate": {
"tool": "across",
"toAmountMin": "999819035819119513",
"toAmount": "999819035819119513",
"fromAmount": "999900000000000000",
"feeCosts": [],
"gasCosts": []
}
}'
Example Response
{
"id": "bf35012e-bac0-421b-9d85-23b058610f8f",
"type": "bridge",
"tool": "across",
"toolDetails": null,
"action": {
"fromChainId": "1",
"toChainId": "42161",
"fromToken": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": "1",
"symbol": "ETH",
"decimals": 18,
"name": "ETH"
},
"toToken": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": "42161",
"symbol": "ETH",
"decimals": 18,
"name": "ETH"
},
"fromAmount": "999900000000000000",
"slippage": 0.03,
"fromAddress": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
"toAddress": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
},
"estimate": {
"tool": "across",
"toAmountMin": "999819035819119513",
"toAmount": "999819035819119513",
"fromAmount": "999900000000000000",
"feeCosts": [],
"gasCosts": [
{
"type": "SEND",
"price": "20000000000",
"estimate": "73356",
"limit": "110034",
"amount": "1467120000000000",
"token": {
"address": "0x0000000000000000000000000000000000000000",
"chainId": "1",
"symbol": "ETH",
"decimals": 18,
"name": "Ethereum"
}
}
]
},
"includedSteps": null,
"transactionRequest": {
"from": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
"to": "0x5c7BCd6E7De5423a257D81B442095A1a6ced35C5",
"chainId": "1",
"data": "0x7b939232000000000000000000000000...",
"value": "999900000000000000",
"gasPrice": null,
"gasLimit": "73356"
},
"execution": null
}
Code Examples
JavaScript (fetch)
interface StepTransactionPayload {
id: string;
type: string;
tool: string;
action: Record<string, unknown>;
estimate: Record<string, unknown>;
}
async function createStepTransaction(payload: StepTransactionPayload) {
const url =
'https://xplore.api.v2.routerprotocol.com/v1/advanced/stepTransaction' +
'?senderAddress=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045' +
'&recipientAddress=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045';
const res = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'your-api-key-here',
},
body: JSON.stringify(payload),
});
if (!res.ok) {
throw new Error(`Request failed: ${res.status}`);
}
return res.json();
}
Python (requests)
import requests
def create_step_transaction(payload, sender, recipient, api_key=None):
params = {
'senderAddress': sender,
'recipientAddress': recipient,
}
headers = {'Content-Type': 'application/json'}
if api_key:
headers['X-API-Key'] = api_key
response = requests.post(
'https://xplore.api.v2.routerprotocol.com/v1/advanced/stepTransaction',
params=params,
json=payload,
headers=headers,
timeout=30,
)
response.raise_for_status()
return response.json()