Swap Allowance
Return a quote, routes and executable transaction in one Allowance request.
Return a quote, selected paths and a signed executePlan transaction in one request. SDK method: swapAllowance(). The payer must equal the executor; payer and recipient default to executor. Use by_amount_in=true for the documented exact-input flow. No separate quote request is required. This endpoint builds the transaction without broadcasting it.
Compatibility alias: /router/swap. Production deployment of the new endpoint has not been verified.
Input ERC20 token address. Use WBNB for native BNB routing.
0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095cPattern: ^0x[0-9a-fA-F]{40}$Output ERC20 token address; must differ from from. Use WBNB for native BNB routing.
0x55d398326f99059fF775485246999027B3197955Pattern: ^0x[0-9a-fA-F]{40}$Positive unsigned integer, at most 2^128 - 1, in input-token base units for the documented exact-input flow. Send decimal digits, never a human-readable fractional amount.
10000000000000000Pattern: ^[0-9]+$Use true for the documented exact-input v7 workflow. Omission defaults to true. A legacy false flag can be parsed by the server but does not establish supported exact-output behavior.
trueExample: truePossible values: Maximum route hops. Omission or 0 uses the service routing configuration; values above its maximum are rejected.
3Requested split count. Omission or 0 uses the configured maximum; the service can reduce it for trade size and metadata availability.
20Comma-separated provider identifiers from Get Status. Omit to use the enabled provider set; availability and version filters still apply.
PANCAKEV3,PANCAKEV2Accepted for routing compatibility; swap endpoints do not apply the find_routes minimum-version gate.
1001500Optional gas limit override. Prefer the service estimate unless you have measured the complete execution path.
Optional advanced path-calculation limit; behavior follows the service routing configuration.
Transaction sender signed into the plan. executor or its compatibility alias sender is required. Submit the returned transaction from this address. Must be nonzero and differ from the execution router.
0x1111111111111111111111111111111111111111Pattern: ^0x[0-9a-fA-F]{40}$Compatibility alias for executor. Prefer executor and send only one of the two fields. Must be nonzero and differ from the execution router.
^0x[0-9a-fA-F]{40}$Token owner. Omit to use executor; Direct Allowance requires payer=executor. Must be nonzero and differ from the execution router.
^0x[0-9a-fA-F]{40}$Output recipient; defaults to executor. Must be nonzero and differ from the execution router.
^0x[0-9a-fA-F]{40}$Custom fee deducted from gross output, in basis points (100 bps=1%). Omission/0 means no fee. Must not exceed peach_router.max_custom_fee_bps from Get Status. Fees require by_amount_in=true.
0Required when custom_fee_bps>0. Must be nonzero and differ from the execution router and recipient. For native BNB output use a recipient able to receive BNB; the service rejects contract fee receivers when its optional code check identifies one.
^0x[0-9a-fA-F]{40}$Slippage applied to expected net output after the custom fee: floor(expect_amount_out*(10000-slippage_bps)/10000). Omission uses service configuration (code fallback 50 bps=0.5%).
50Expiry offset in seconds. Omission uses service configuration (code fallback 120). Supply a positive value so the plan remains usable.
120Set true only for native BNB input and pass WBNB as from. Returned tx.value is the BNB input amount in wei.
falseExample: falseSet true for native BNB output and pass WBNB as target. Cannot be combined with native_in=true.
falseExample: falseOptional pool-visibility key. Only a server-whitelisted key includes paths[].pool. Missing or invalid keys omit pool without blocking transaction construction. Not forwarded to the routing engine.
Application success (code=200) or application error (code!=200). Business errors may still have HTTP status 200; inspect the JSON code.
Malformed query or request rejected by HTTP extraction. Body may be plain text rather than an application envelope.
Unhandled service failure.
Service-wide rate limit / circuit breaking. Retry with backoff.
# Set EXECUTOR to the wallet address that will send the transaction.
: "${EXECUTOR:?Set EXECUTOR to your BSC wallet address}"
curl --fail-with-body --silent --show-error --get \
'https://api.peach.ag/router/swap/allowance' \
--data-urlencode 'from=0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c' \
--data-urlencode 'target=0x55d398326f99059fF775485246999027B3197955' \
--data-urlencode 'amount=1000000000000000' \
--data-urlencode "executor=$EXECUTOR" \
--data-urlencode 'by_amount_in=true' \
--data-urlencode 'v=1001500' \
--data-urlencode 'slippage_bps=50' \
--data-urlencode 'deadline_secs=300' \
--data-urlencode 'native_in=false' \
--data-urlencode 'native_out=false'
# Check HTTP status and JSON code; this request does not broadcast.
{
"code": 200,
"msg": "Success",
"data": {
"request_id": "text",
"quote_id": "text",
"quote_ts": 1,
"amount_in": "text",
"amount_out": "text",
"expect_amount_out": "text",
"custom_fee_bps": 1,
"custom_fee_amount": "text",
"integrator_fee_amount": "text",
"protocol_fee_amount": "text",
"custom_fee_receiver": "text",
"protocol_cut_bps": 1,
"deviation_ratio": "text",
"deviation_skip_reason": "text",
"contracts": {
"router": "text",
"execution_router": "text"
},
"gas": 1,
"execution_mode": "DIRECT_ALLOWANCE",
"execution_status": "TRANSACTION_READY",
"plan_hash": "text",
"aggregator_signature": "text",
"aggregator_signer": "text",
"payer": "text",
"executor": "text",
"recipient": "text",
"tx": {
"to": "text",
"data": "text",
"value": "text",
"entrypoint": "executePlan",
"amount_out_min": "text"
},
"paths": [
{
"pool": "text",
"provider": "text",
"adapter": "text",
"token_in": "text",
"token_out": "text",
"direction": true,
"fee_rate": "text",
"amount_in": "text",
"amount_out": "text",
"extra_data": "text"
}
]
}
}Integration notes
payer must equal executor; payer and recipient default to executor. ERC20 input requires allowance to returned tx.to. Native BNB input uses WBNB in from, native_in=true and returned tx.value.
Review roles, chain, token addresses, expect_amount_out (net), tx.amount_out_min, fees and deadline, then submit the unchanged transaction as executor. This endpoint does not broadcast. Use by_amount_in=true for exact input.
Check both the HTTP status and JSON code; a business error may use HTTP 200. See Error Codes for recovery guidance. Invalid query or body extraction may return plain text instead of the JSON envelope.
Last updated
Was this helpful?