Swap
Get quote amounts and transaction data in one request. See the direct HTTP integration example below.
Returns a fresh quote and signed swap calldata for Direct Allowance. The payer must be the executor; this endpoint does not broadcast the transaction.
Input ERC-20 address. For USDC use its ERC-20 interface, 0x3600000000000000000000000000000000000000; native-token sentinels are unsupported.
^0x[0-9a-fA-F]{40}$Output ERC-20 address; must differ from from.
^0x[0-9a-fA-F]{40}$Positive base-unit integer string, at most 340282366920938463463374607431768211455 (u128).
1000000Pattern: ^[0-9]+$Final transaction sender. HTTP also accepts sender as an alias; send one name only. Must be non-zero and different from the Execution Router.
^0x[0-9a-fA-F]{40}$Input token owner. Defaults to executor and must equal executor.
^0x[0-9a-fA-F]{40}$Output receiver. Defaults to executor; must be non-zero and different from the Execution Router.
^0x[0-9a-fA-F]{40}$If true, amount is the input; if false, amount is the desired quote output. Execution still uses a fixed input with a minimum output, not an exact-output guarantee. Custom fees require true.
trueClient version identifier; send 1001500, matching route-preview requests.
1001500Route depth, subject to deployment limits. Omitted or zero uses server configuration.
3Requested split count, adjusted by server limits and trade size. Does not equal final execution-step count.
20Comma-separated provider IDs from /router/status. Omit for server selection; availability varies by network.
UNISWAPV3,UNISWAPV4Basis points applied to net expect_amount_out after custom fees. Minimum output is floor(expect_amount_out * (10000 - slippage_bps) / 10000). Omitted uses the server default; send explicitly.
50Validity in seconds from construction, not an absolute timestamp. Send a positive value; omitted uses the server default. Delegated plans also enforce the server lifetime cap.
120Output-token custom fee in basis points, subject to /router/status arc_router.max_custom_fee_bps and on-chain policy. Positive values require by_amount_in=true and custom_fee_receiver.
0Required for a positive custom fee; non-zero and different from recipient and the Execution Router.
^0x[0-9a-fA-F]{40}$Advanced gas-unit override. Omit for the server's buffered execution estimate; this is not a gas price or a transaction simulation.
Advanced route-search bound. Omit to use server configuration.
Arc supports ERC-20 input only. Omit or send false; true is rejected.
falsePossible values: Arc supports ERC-20 output only. Omit or send false; true is rejected.
falsePossible values: Signed swap plan and transaction calldata.
Request parsing failed: malformed/missing query parameters or invalid JSON syntax. The body may be plain text; this is HTTP 400, not application code 400.
Rate limit exceeded. Retry with backoff and honor Retry-After when present.
Internal server error.
Service rate limit exceeded. Retry with backoff.
# Set these to the selected ERC-20 pair, raw amount and actual executor.
: "${FROM_TOKEN:?Set FROM_TOKEN}" "${TARGET_TOKEN:?Set TARGET_TOKEN}"
: "${AMOUNT:?Set AMOUNT in base units}" "${EXECUTOR:?Set EXECUTOR}"
curl --fail-with-body --get 'https://api.peach.ag/arc/router/swap' \
--data-urlencode "from=$FROM_TOKEN" \
--data-urlencode "target=$TARGET_TOKEN" \
--data-urlencode "amount=$AMOUNT" \
--data-urlencode "executor=$EXECUTOR" \
--data-urlencode 'by_amount_in=true' \
--data-urlencode 'v=1001500' \
--data-urlencode 'slippage_bps=50' \
--data-urlencode 'deadline_secs=120'
# Also check JSON code == 200. This command does not send a transaction.
{
"code": 200,
"msg": "Success",
"data": {
"request_id": "0x89c40b150d4b4fdfbf85168688b62211b5ac5c095b3244ea8976e816dbefee6a",
"quote_id": "0x89c40b150d4b4fdfbf85168688b62211b5ac5c095b3244ea8976e816dbefee6a",
"quote_ts": 1788749445612,
"amount_in": "100000",
"amount_out": "39567089183407155485803",
"expect_amount_out": "39567089183407155485803",
"custom_fee_bps": 0,
"custom_fee_amount": "0",
"integrator_fee_amount": "0",
"protocol_fee_amount": "0",
"custom_fee_receiver": "",
"protocol_cut_bps": 0,
"deviation_ratio": "",
"deviation_skip_reason": "missing_oracle_price",
"contracts": {
"execution_router": "0x5ff56925140d6f5912c8ca6593f2c3bc28190607"
},
"gas": 720000,
"execution_mode": "DIRECT_ALLOWANCE",
"execution_status": "TRANSACTION_READY",
"plan_hash": "0x7281e09db596d95ec4f699c517620a24bd4e4e9f1cbe5d49849b8d218b128ed8",
"aggregator_signature": "0xbcf405cf2bbff878a2e2f98a0d9da5a386bee7938f94d4a47921c9ab817b02cb621d7eac219fce6e8389928b7aac11776e9a8940eb8122f006cc2a2e938addc61c",
"aggregator_signer": "0x8a283840b4219a05cebdfc09fe33b58a7f52a562",
"payer": "0x036ede62f99ab5061ca89d0cec5acecc641f6474",
"executor": "0x036ede62f99ab5061ca89d0cec5acecc641f6474",
"recipient": "0x036ede62f99ab5061ca89d0cec5acecc641f6474",
"tx": {
"to": "0x5ff56925140d6f5912c8ca6593f2c3bc28190607",
"data": "0x02fcde220000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000004cef520000000000000000000000005ff56925140d6f5912c8ca6593f2c3bc28190607000000000000000000000000036ede62f99ab5061ca89d0cec5acecc641f6474000000000000000000000000036ede62f99ab5061ca89d0cec5acecc641f6474000000000000000000000000036ede62f99ab5061ca89d0cec5acecc641f64740000000000000000000000004608e7fc3163f11c241a7cdd1c8a7d46f150e37a000000000000000000000000ff551f980ea5128c5b14114604d33e5adae981500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000186a000000000000000000000000000000000000000000000085636264700564cced5000000000000000000000000000000000000000000000860efaaf8e2c0389c6b89c40b150d4b4fdfbf85168688b62211b5ac5c095b3244ea8976e816dbefee6adecb42eb2eb596fb3f06e6a4f45f0a8961f428f006cee054d2f98db6630411f056357fcbc3b1d045eee9e481f3308a1af340ab6b13b7efb19733c294529f722700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006a9e26fd89c40b150d4b4fdfbf85168688b62211b5ac5c095b3244ea8976e816dbefee6a000000000000000000000000000000000000000000000000000000000000034000000000000000000000000000000000000000000000000000000000000005e00000000000000000000000000000000000000000000000000000000000000620000000000000000000000000000000000000000000000000000000000000066000000000000000000000000000000000000000000000000000000000000006800000000000000000000000004608e7fc3163f11c241a7cdd1c8a7d46f150e37a000000000000000000000000ff551f980ea5128c5b14114604d33e5adae9815000000000000000000000000000000000000000000000000000000000000186a000000000000000000000000000000000000000000000085636264700564cced500000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000280000000000000000000000000000000000000000000000000000000006a9e26fd89c40b150d4b4fdfbf85168688b62211b5ac5c095b3244ea8976e816dbefee6a000000000000000000000000000000000000000000000860efaaf8e2c0389c6b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000006e9d4fa65ea3396d80345f37bae1c4e4ac443689000000000000000000000000d60804941f49270c74f4c7e8686e288723360a750000000000000000000000004608e7fc3163f11c241a7cdd1c8a7d46f150e37a000000000000000000000000ff551f980ea5128c5b14114604d33e5adae9815000000000000000000000000000000000000000000000000000000000000186a000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000ff551f980ea5128c5b14114604d33e5adae981500000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041bcf405cf2bbff878a2e2f98a0d9da5a386bee7938f94d4a47921c9ab817b02cb621d7eac219fce6e8389928b7aac11776e9a8940eb8122f006cc2a2e938addc61c00000000000000000000000000000000000000000000000000000000000000",
"value": "0",
"entrypoint": "executePlan",
"amount_out_min": "39369253737490119708373"
}
}
}Call GET https://api.peach.ag/arc/router/swap once with the order and executor. The response includes quote amounts and tx; no separate quote call is needed. Direct swaps require payer = executor. For a different payer, use prepare → payer signature → build.
Use ERC-20 token addresses. Arc USDC uses its 6-decimal ERC-20 interface, 0x3600000000000000000000000000000000000000; native-token sentinels and native input/output are unsupported.
Call the API directly
Use values from the user's order and connected wallet. amount is a positive decimal integer in input-token base units. This example makes one Aggregator request and does not broadcast.
For authenticated integrations, add your apikey using the integration's credential handling.
Review and submit the same result
Display result.expect_amount_out, result.tx.amount_out_min, recipient and fees, then wait for the user's confirmation. Before approval or sending, decode and validate the signed execution plan/calldata against your intended chain 5042, trusted router, tokens, amount, payer/executor/recipient, minimum, fees and deadline. Checking the JSON envelope alone does not perform these validations.
For ERC-20 input, approve the validated Execution Router when allowance is insufficient and wait for the approval receipt. Recheck the wallet account, network and signed expiry, then simulate the exact returned transaction.
After those checks and user confirmation, submit { from: executor, to: result.tx.to, data: result.tx.data, value } using the wallet's transaction API. With eth_sendTransaction, encode value as '0x' + BigInt(result.tx.value).toString(16). Preserve the returned transaction target, calldata and numeric value; gas/nonce are wallet or RPC concerns. Save the transaction hash before waiting for the receipt, and verify receipt success.
Do not request swap again when the user confirms. If the result expires, the order changes, or you refresh the quote, obtain and confirm a new complete result. A wallet timeout is not proof that sending failed; inspect the hash/wallet before retrying.
HTTP endpoint reference
The schema and cURL example above describe the same single request. Historical sample responses are illustrative; never submit their expired calldata.
Last updated
Was this helpful?