This guide will walk you through making your first request to the nexroute API.
Prerequisites
Before you begin, you need to obtain an API Key.
Please reach out to our team to request an API Key if you haven’t received one already.
Make Your First Request
Use the endpoint below to get a swap quote. You’ll need to pass your API key in the X-API-Key header.
Get a Quote
This example requests a quote for swapping WBNB to USDT on BSC.
curl -X POST https://api.nexroute.io/v1/quote \
-H "Content-Type: application/json" \
-H "X-API-Key: <YOUR_API_KEY>" \
-d '{
"tokenIn": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
"tokenOut": "0x55d398326f99059fF775485246999027B3197955",
"amountIn": "1000000000000000000"
}'
Response
The API returns a JSON object containing the amountOut, estimated gas, calldata, and other transaction details.
{
"amountOut": "8643194859422640072",
"gas": 237995,
"calldata": "0x8f01f039...",
"router": "0x365193e7e200CC2Ce82eb67DB0Fed117F8C7c660",
"spender": "0x365193e7e200CC2Ce82eb67DB0Fed117F8C7c660"
}
Next Steps
Now that you’ve successfully fetched a quote, check out the Authentication page or explore the full API Reference.