Instruction Mode API
Overview
- Partner code must be agreed upon in advance and passed through the header:
Partner-Code; - Currently supported chains: ETH, SOL, BNB chain, Base, Polygon, Arbitrum, Morph. Please notify us in advance for integration with other chains;
- Transaction fees:
- Currently, fees are collected in our contract and settled periodically;
- Custom fee collection addresses are under development;
HTTP Status Code Definitions
| Status Code | Description |
|---|---|
| 200 | Success |
| 400 | Bad Request |
| 403 | Forbidden (Not whitelisted or signature error) |
| 429 | Too many requests (Rate limited) |
Quote API
Request Path: /bgw-pro/swapx/pro/quote
Request Method: POST
Request Parameters:
| Field Name | Field Type | Required | Description |
|---|---|---|---|
| fromSymbol | string | No | Source token name |
| fromContract | string | Yes | Source token contract address, pass empty string for native token |
| fromAmount | string | Yes | Quote amount (input amount) |
| fromChain | string | Yes | Source chain |
| toSymbol | string | No | Target token name |
| toContract | string | Yes | Target token contract address, pass empty string for native token |
| toChain | string | Yes | Target chain |
| fromAddress | string | No | Debit address, used for gas estimation. If not provided, a default address will be used for gas estimation |
| estimateGas | bool | No | Whether to estimate gas, default is false. Should be used together with fromAddress |
| market | string | No | Specify quote channel, e.g., uniswap.v3, pancakeswap. All supported markets are used by default |
| feeRate | number | No | Fee rate in per mille (‰), defaults to channel-configured fee rate. Pass 0 for no fee |
| solMaxAccounts | number | No | Maximum number of accounts, unlimited by default. Only applicable to SOL chain (limiting accounts may affect price advantage) |
Request Example:
{
"fromSymbol": "USDT",
"fromContract": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
"fromAmount": "1",
"fromChain": "sol",
"toSymbol": "USDC",
"fromAddress": "ApPjjUmJuraNuFZ2n41TBzdshd3pmDEQvH6hFukQ1Yv2",
"toChain": "sol",
"toContract": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"estimateGas": true,
"skipCache": true
}Response Description:
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| status | number | Yes | Response code, 0 indicates success |
| data | object | Yes | - |
| toAmount | string | Yes | Output amount |
| market | string | Yes | Channel name |
| estimateRevert | bool | Yes | Chain identifier |
| slippage | string | Yes | Slippage |
| computeUnits | number | No | SOL chain tx compute unit consumption |
| gasLimit | number | No | Estimated gas limit |
Response Example:
{
"status": 0,
"data": {
"toAmount": "1.000972",
"market": "jupiter.router",
"slippage": "2",
"estimateRevert": true,
"gasLimit": 0,
"computeUnits": 650000
}
}Get Calldata API
Request Path: /bgw-pro/swapx/pro/swap
Request Method: POST
Request Parameters:
| Field Name | Field Type | Required | Description |
|---|---|---|---|
| fromSymbol | string | No | Source token name |
| fromContract | string | Yes | Source token contract address, pass empty string for native token |
| fromAmount | string | Yes | Sell amount (input amount) |
| fromChain | string | Yes | Source chain |
| toSymbol | string | No | Target token name |
| toContract | string | Yes | Target token contract address, pass empty string for native token |
| toChain | string | Yes | Target chain |
| toMinAmount | string | No | Minimum amount to receive. If not provided, calculated using slippage |
| fromAddress | string | Yes | Debit address |
| toAddress | string | Yes | Recipient address |
| slippage | number | No | Slippage in percentage (e.g., 1 means 1%), defaults to system-configured slippage |
| market | string | Yes | Optimal channel returned by the quote API |
| feeRate | number | No | Fee rate in per mille (‰), defaults to channel-configured fee rate. Pass 0 for no fee |
| executorAddress | string | No | Executor contract address. Required if transaction is not initiated by fromAddress |
| solMaxAccounts | number | No | Maximum number of accounts, unlimited by default. Only applicable to SOL chain |
| feePayer | string | No | Fee payer address. Defaults to using fromAddress to pay SOL chain account creation fees |
| deadline | number | No | Transaction expiration time in seconds, default is 600 seconds |
| protocols | string | No | Protocol list, defaults to all supported protocols |
| requestMod | string | No | Request mode, optional values are “simple” or “rich” |
Request Example:
{
"fromSymbol": "USDT",
"fromContract": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
"fromAmount": "0.5",
"fromChain": "sol",
"toSymbol": "USDC",
"fromAddress": "ApPjjUmJuraNuFZ2n41TBzdshd3pmDEQvH6hFukQ1Yv2",
"toAddress": "ApPjjUmJuraNuFZ2n41TBzdshd3pmDEQvH6hFukQ1Yv2",
"toChain": "sol",
"toContract": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"slippage": 1,
"toMinAmount": 0.4,
"market": "bgw.aggregator"
}Response Description:
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| status | number | Yes | Response code, 0 indicates success |
| data | object | Yes | - |
| id | string | Yes | Order ID |
| market | string | Yes | Channel name |
| contract | string | No | Contract address, returned for EVM chains |
| calldata | string | Yes | Calldata |
| deadline | number | Yes | Order timeout (seconds) |
| computeUnits | number | No | SOL chain tx compute unit consumption |
| addressLookupTableAccount | string[] | No | SOL only: Address Lookup Table pubkeys; use with instructionLists to build a versioned transaction |
| instructionLists | object[] | No | SOL only: instruction list; by default returns data you can use to assemble the on-chain transaction |
On Solana, calldata still returns serialized data; addressLookupTableAccount and instructionLists are for assembling the transaction on the client.
Response example (EVM):
{
"status": 0,
"error_code": 0,
"data": {
"id": "fbc288e957b14524b20ebcdd8a7fc740",
"market": "bgwevmaggregator",
"contract": "0x6D0034c7DA87e8f0526b21aa890d40A77C755B68",
"calldata": "0xd984396a000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000055d398326f99059ff775485246999027b3197955000000000000000000000000ff7d6a96ae471bbcd7713af9cb1feeb16cf56b41000000000000000000000000d8febd1c242a282f1b8226d34282942f6f63248b000000000000000000000000000000000000000000000000016345785d8a0000000000000000000000000000000000000000000000000000016345785d8a00000000000000000000000000000000000000000000000000001953035fe9b0ae410000000000000000000000000000000000000000000000000000000069bcec8600000000000000000000000000000000fbc288e957b14524b20ebcdd8a7fc7400000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e04ee3c15060ef3235618b11c4344303793eaac7310811765c0a4ad141864dfc0100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000041cfb144b7d769f5e777b9646b5a86936af75585cb0646c369a152b5db1fb1263f07a56f6728e5b5ff206a46fd9c644130234b9cd8458736b35bb8980760bada711c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000006d0034c7da87e8f0526b21aa890d40a77c755b6800000000000000000000000000000000000000000000000000000000000000000000000000000000000000007e58f160b5b77b8b24cd9900c09a3e730215ac4700000000000000000000000055d398326f99059ff775485246999027b3197955000000000000000000000000000ae314e2a2172a039b26378814c252734f556a0000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000006d0034c7da87e8f0526b21aa890d40a77c755b680000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005c9d8a69a6c4b84aa1999220e831be07f2ef96000000000000000000000000000ae314e2a2172a039b26378814c252734f556a000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c0000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000271000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001000000000000000000000000d8febd1c242a282f1b8226d34282942f6f63248b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ce94aba9086f408b3f2af4e8b5ac1abc42f4da9a000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c000000000000000000000000ff7d6a96ae471bbcd7713af9cb1feeb16cf56b410000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000000",
"deadline": 600,
"computeUnits": 650000
},
"msg": "success",
"title": "",
"timestamp": 1773988879125,
"trace": "Root=1-69bcec0e-5447a0b1395a5f57335d6a44"
}Response example (Solana, with instruction list):
In the example below, each instructionLists entry’s accounts array is truncated to the first few items; production responses follow the actual swap route.
{
"status": 0,
"error_code": 0,
"data": {
"id": "6a49cf127d4c44daa9b31b379be26735",
"market": "jupiter",
"contract": "",
"calldata": "29WN6gXVcTCRZnFQxbG5ojxY3Q8vX5GJH9hFGU4VPVZegrcTroNpBuXrxCPLkPohU8rZBJQKGPREdy4oyZTGxrfrFZ4gbQiwxivqpxHgMHJ7Bs4unPDUEf7GzwcjNJp8jmN1hDyuatWt9SR5HAaBzgMkmEzR2tM57dhiKzabAxKAYaHbHrfTYaVdDoFx9MTRkVGqbjimAKL2ARMACLhbP73zcKBcyxB7exvhVd34KEGjBpht98fmQGfhSQf2wPg6oGEkyfDVGGiCF7UCQAfzg4o6pSNdrnZjzFh2URMtTL7eheU2evMzLFiLZFmoAs6vwtHD7yNLsqacWWTRG3QQA4kBSAg46kcszSVVUUztvdXp43c3e3XTjhYqDKYzz1RGHenGVXw4sQuqZQgC5McxAxthGEE8GtwzyDofbrdnKdPtHX1VXXUx6Mk3sqSKLVYLy198n17zf4L9qQqN2j6kN8kDFxyH3BPYoVrKu9LPdbZeHQxzDbZ7zBFAx3bzfto34ityKwQnairyDGaR7AJUF2VQc5awv1LvvvTxWhQNQUiTu1RDXX6UxhcLsnrsfVSgNmMSm2wDz71Z17ZmTXmLkUoNvovKAnP3J6RGBpSPhnxWM3sYKNKBqUrXTp3buGSRhKSkL1pSYeXBCM3Lw2bvP8kdgVLWyPQcy2xenHp3JzfWzJwVX4P3zafxiT3erdU9GFVU4pVkVsdPuA1Dkk6JgQxP9j5AbLjhnp5CXSpCF2kc1gJJNcRcyUiAoSNijjvn1iHEnpgrLtDKWWQr5sZyReBqG1v9QQNpg8CLfQ1t1i7Hs6fzanGDVsndVDDhgsFkgw8rRaHXvsv1bM687ZqyRET1gLJSv2FefZnfW22CQfem5mQ5EzQwgN9jjZa9KtCEq64FzYzAUV9xjn34TX6HVT5Lm4LuENVfFZzY3fC9bbdwXu8XdGMxb55nRYChvRDnJBnpbkHm6Ns6EpH5RkmTuRe3SyYEt1VyagaCJHBAjc6Nj1JnFhpDsTFxBe98Ncgy7oW6oaeUJJi1pkRX",
"deadline": 600,
"computeUnits": 650000,
"addressLookupTableAccount": [
"BDqppwFYeMpUicN9xbfoM7FgRnHVW1uTUtrGA7uG2vQg",
"6JjsmWMgQtjUrBmA1obh4NZpc2CPqLcQ9cRPd2C5WBoM",
"3PiDGEeehivGdhkmLt6Rzyo6mhmogYXtgAjurb25NxxW"
],
"instructionLists": [
{
"programId": "ComputeBudget111111111111111111111111111111",
"accounts": [
{
"pubkey": "jitodontfront111111111111111111BitgetWaLLet",
"isSigner": false,
"isWritable": false
}
],
"data": "AtDdBgA="
},
{
"programId": "ComputeBudget111111111111111111111111111111",
"accounts": [],
"data": "AzgBAwAAAAAA"
},
{
"programId": "JUPSjgjMFjU4453KMgxhqVmzep6W352bQpE4RsNqXAx",
"accounts": [
{
"pubkey": "4Hzo3UJyRq3La26EW8Ft2tUP9efwLoADbBRuQSDWY7ts",
"isSigner": false,
"isWritable": false
},
{
"pubkey": "ApPjjUmJuraNuFZ2n41TBzdshd3pmDEQvH6hFukQ1Yv2",
"isSigner": true,
"isWritable": true
},
{
"pubkey": "5qvgoghnGteY5GbA124TFD1numU7Vdf6ejKg8PhNN3XL",
"isSigner": false,
"isWritable": true
}
],
"data": "0ZhTk3z+2OkAIKEHAAAAAABdlwcAAAAAAGQAMgAAAAIAAAAaECcAAXYzrCwsepkElAEQJwEC"
}
]
},
"msg": "success",
"title": "",
"timestamp": 1773987742783,
"trace": "Root=1-69bce79d-502560c342f7fc8f60263650"
}Reverse Quote Swap API
The Reverse Quote Swap API combines quoting and transaction building into a single call, supporting two trading modes:
- exactIn: User specifies the input token amount, and the system calculates the expected output amount.
- minAmountOut: User specifies the desired minimum output token amount, and the system calculates the required input amount via reverse quoting. If the on-chain execution does not satisfy the amount, the transaction will revert.
Request Path: /bgw-pro/swapx/pro/swapr
Request Method: POST
Request Parameters:
| Field Name | Field Type | Required | Default | Description |
|---|---|---|---|---|
| fromChain | string | Yes | - | Chain identifier, e.g., sol, eth, bnb, base |
| fromContract | string | Yes | - | Source token contract address, pass empty string for native token |
| toContract | string | Yes | - | Target token contract address, pass empty string for native token |
| amount | string | Yes | - | Amount (in token decimals), meaning depends on requestMode |
| requestMode | string | Yes | - | Request mode: exactIn or minAmountOut |
| fromAddress | string | Yes | - | User wallet address (debit address), length 1-256 |
| toAddress | string | Yes | - | Recipient address, length 1-256 |
| slippage | string | No | "0.5" | Slippage tolerance percentage (e.g., "0.5" means 0.5%) |
| feeRate | float64 | Yes | - | Fee rate in per mille, must be >= 0 |
| deadline | int | No | 600 | Transaction expiration time in seconds |
| executorAddress | string | No | - | Executor contract address. Required if transaction is not initiated by fromAddress |
requestMode Description:
| Mode | amount Meaning | Description |
|---|---|---|
| exactIn | Input token amount | Forward quoting: given input, calculate output |
| minAmountOut | Desired minimum output token amount | Reverse quoting: given desired output, calculate required input |
Request Example (exactIn mode):
{
"fromChain": "bnb",
"fromContract": "0x55d398326f99059ff775485246999027b3197955",
"toContract": "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
"amount": "1",
"requestMode": "exactIn",
"fromAddress": "0xd8FeBD1C242a282f1b8226d34282942F6F63248b",
"toAddress": "0xd8FeBD1C242a282f1b8226d34282942F6F63248b",
"slippage": "0.5",
"feeRate": 0.003,
"deadline": 600
}Request Example (minAmountOut mode):
{
"fromChain": "bnb",
"fromContract": "0x55d398326f99059ff775485246999027b3197955",
"toContract": "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
"amount": "1",
"requestMode": "minAmountOut",
"fromAddress": "0xd8FeBD1C242a282f1b8226d34282942F6F63248b",
"toAddress": "0xd8FeBD1C242a282f1b8226d34282942F6F63248b",
"slippage": "0.5",
"feeRate": 0.003,
"deadline": 600
}Response Description:
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| status | number | Yes | Response code, 0 indicates success |
| data | object | Yes | - |
| id | string | Yes | Order ID |
| amountIn | string | Yes | Input amount |
| expectedAmountOut | string | Yes | Expected output amount |
| minAmountOut | string | Yes | Minimum output amount |
| priceImpact | string | Yes | Price impact percentage |
| recommendSlippage | number | Yes | Recommended slippage |
| expiresAt | number | Yes | Expiration timestamp (unix seconds) |
| market | string | Yes | Channel name |
| txs | []object | Yes | Transaction list |
| fee | object | Yes | Fee details |
txs Array Elements:
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| chainId | number | Yes | Chain ID |
| to | string | Yes | Target contract address |
| calldata | string | Yes | Transaction calldata |
| function | string | Yes | Function name |
| gasLimit | string | Yes | Gas limit |
| gasPrice | string | Yes | Gas price |
| nonce | number | Yes | Nonce |
| value | string | Yes | Transaction value |
fee Object:
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| totalAmountInUsd | string | Yes | Total fee in USD |
| platformFee | object | Yes | Platform fee details |
| platformFee.amountInUsd | string | Yes | Platform fee in USD |
| platformFee.items | []object | Yes | Fee breakdown items |
Response Example:
{
"status": 0,
"data": {
"id": "2dde9b1da4044957aec42e9e93416717",
"amountIn": "1",
"expectedAmountOut": "0.9969249606918065",
"minAmountOut": "0.9919403358883475",
"priceImpact": "0.25",
"recommendSlippage": 1,
"expiresAt": 1770620790,
"market": "bgwevmaggregator",
"txs": [
{
"chainId": 56,
"to": "0x6D0034c7DA87e8f0526b21aa890d40a77C755B68",
"calldata": "0xd984396a...",
"function": "swap",
"gasLimit": "752325",
"gasPrice": "0.0000000001875",
"nonce": 235,
"value": "0"
}
],
"fee": {
"totalAmountInUsd": "0.003",
"platformFee": {
"amountInUsd": "0.003",
"items": [
{
"token": {
"chain": "bnb",
"address": "0x55d398326f99059ff775485246999027b3197955",
"symbol": "USDT",
"decimals": 18
},
"amount": "0.003",
"amountInUsd": "0.003"
}
]
}
}
}
}MEV Batch Send
Request Path: /bgw-pro/swapx/pro/send
Request Method: POST
Request Parameters:
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| chain | string | Yes | Chain name, max 64 characters |
| txs | []object | Yes | Transaction list, max 100 items |
txs Array Elements:
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| id | string | Yes | Order ID, max 128 characters |
| chain | string | Yes | Chain name, max 64 characters |
| rawTx | string | Yes | Raw transaction data for on-chain submission, max 8192 characters |
| from | string | Yes | Order sender address, max 128 characters |
| nonce | number | Yes | Nonce, minimum value is 0 |
| provider | string | No | Send provider, max 128 characters |
Request Example:
{
"chain": "bnb",
"txs": [
{
"id": "34bbf08b6ca5bb9d19e2b0e9715d82f6",
"chain": "bnb",
"rawTx": "0xabc...",
"from": "0xabc",
"nonce": 1,
"provider": ""
}
]
}Response Description:
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| status | number | Yes | Response code, 0 indicates success |
| data | []object | Yes | - |
| id | string | Yes | Order ID |
| txHash | string | Yes | Transaction hash |
| code | string | No | Response code, 0 indicates success |
| message | string | Yes | Error message |
Response Example:
{
"status": 0,
"data": {
"result": [
{
"id": "34bbf08b6ca5bb9d19e2b0e9715d82f6",
"code": 0,
"txHash": "2T4UR7tsgiPQsJuEYMwu8wNzukdjzoLgqTNBQ1KgL13nX7CUTQeEkNz8sEiGA35fCvt7MCNsgRGohFLg9dg932jr"
}
]
}
}Further Reading
- API Key Access Documentation: Authentication
- Market API Documentation: Market API


