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 |
Response Example:
{
"status": 0,
"data": {
"id": "9b4d17ccf0e84a9e976788bfc1f31423",
"market": "bgw.aggregator",
"contract": "",
"calldata": "7uXV2gF3AZ2e2ZpGkknQkbhD2XJzDEsMzBWJEBM4iJBu3tF89cmRjeKudo6K4R2bB9321177Hxneuf6zznxphUwxSACYmA7D1AaNW9bpvV5X4khFdufcGrwLsxVHY1j9WFwHHBP6wEhnWT2H5Hdg3HV5cLEpeUtLHBo6y6YRepJ1Bf8L2zJAfTwiicxghTCNg7x7r8b5xSuE4oqVGRFaY11XSM6QykeevMkRBnTFYHqrcnKctiYJF2eQRCnoKMcqwT2frXbafRmj1MC4LKPdnJVjVjkDnqEbAnooBYwQ4AXywjp2h8Sk1BwkEowP4Zko4yUrpbLmq3mUvXoke9vgp52nv5udaYxo6G2w11W1k6Ha7fPBZCHKLyJvuiXcd6Zw5TRZ2KfFnY3ehFvSvedEw3XGUrAH98gGGVHQ1i7rUUb3o7LFFaSReXw2s12BSBHoSCub3emuQJVRACFC9z66sxmvWhrjC7r1vwg7hgKBTrannvkzyq3U9WMzxVBdiDLXcXpFiy2ePDKfzL81tnwaGRpA2x8db6P4UVzk11gvfWwhGi7YnAs8MS85U7ehELVQBJ3tKrjmRgfwx6uardEfmFb6fm86CnbfsZXzmARN2UhMBheUL8YTZAGr8nAUBn7wLkzTWLGbG8zmb8GkD7hAknSVyHy32FGyMsAcqDgW4ZKWNAWBQPmwC9KRfuTbr6YYg98pBLoJgphhJcnhv1jiRyCwyWcxDskAgBigeTKCNBNpJu85eve1V9vGKa8HUKerLZ52QvpCWoEavjFMaAk9x2yeFTVkGQxRWeR8VZxBq3BQTvCtzuZ3wXvDeoHYZKc4bUwxyzLs57cGYHMuhDHJjiXPgrx3CjMTnH2LpfqgQjHGKcHW3vLqBDdBUeLffshPmx5o23LT4h9e8CQVBGQgHzj4SHMoC6V3F5hiLLvM",
"deadline": 600,
"computeUnits": 650000
}
}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


