> For the complete documentation index, see [llms.txt](https://docs.peach.ag/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.peach.ag/api-reference/readme.md).

# BSC Aggregator HTTP API

Get a quote and transaction in one Allowance request or two Permit2 requests.

Use `https://api.peach.ag` on **BSC Mainnet (chain ID 56)**. The HTTP API queries prices and builds transaction data; your wallet or executor submits the transaction.

| Method | Endpoint                     | Purpose                                                             |
| ------ | ---------------------------- | ------------------------------------------------------------------- |
| GET    | `/router/status`             | Get Status: providers, sync state and current router configuration  |
| GET    | `/router/swap/allowance`     | Swap Allowance: Direct Allowance, with `payer = executor`           |
| GET    | `/router/swap/permit2`       | Swap Permit2: freeze a plan and return payer signing data           |
| POST   | `/router/swap/permit2/build` | Swap Permit2 Build: attach the payer signature to the prepared plan |

New endpoint deployment has not been verified for the production URL.

### Recommended integration

* **Allowance:** one `GET /router/swap/allowance` request returns the quote, selected paths and executable transaction. Review the terms, approve if needed and submit that same transaction.
* **Permit2:** `GET /router/swap/permit2` returns the quote, frozen plan and payer signing material. After payer signing, `POST /router/swap/permit2/build` returns the executable transaction. Build does not search routes again.

These counts include Aggregator requests only; approvals, signing, simulation and submission are separate. The matching SDK methods are `swapAllowance()`, `swapPermit2()` and `swapPermit2Build()`.

### Request and response conventions

Token inputs use `from` and `target`; HTTP amounts use `amount`. Send amounts as unsigned decimal integers in token base units, such as `1000000000000000` for 0.001 BNB. Response amounts are decimal strings. Use integer arithmetic when converting or comparing them.

Successful responses contain `code: 200`, `msg` and `data`. Check both the HTTP status and the JSON `code`: business errors can arrive with HTTP status 200 and omit `data`. See [Error Codes](https://docs.peach.ag/api-reference/readme/error-codes).

Use `by_amount_in=true` for exact-input swaps. See [Swap Allowance](https://docs.peach.ag/api-reference/readme/build-swap-calldata) for a runnable request and its response schema.

### Confirm and execute

Review roles, amounts, fees and deadline before submitting the returned `tx.to`, `tx.data` and `tx.value` unchanged from the executor address. ERC20 approval targets differ: the Execution Router (`tx.to`) for Allowance, canonical Permit2 for delegated funding.

See [Swap Allowance](https://docs.peach.ag/api-reference/readme/build-swap-calldata) for Allowance roles and paths, or [Swap Permit2](https://docs.peach.ag/api-reference/readme/prepare-delegated-swap) and [Swap Permit2 Build](https://docs.peach.ag/api-reference/readme/build-delegated-swap) for the payer-signing flow.

Supply `slippage_bps` and `deadline_secs` explicitly when the application has fixed requirements. Slippage applies to net output after custom fees:

`amount_out_min = floor(expect_amount_out × (10000 − slippage_bps) / 10000)`

`amount_out` is gross output, and `expect_amount_out` is expected net output before slippage. Custom fees require `custom_fee_receiver` and must stay within the current fee cap returned by `/router/status`.

### Native BNB

Use WBNB (`0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c`) in the HTTP token fields. For native input, set `native_in=true` and attach the returned `tx.value` in wei. For native output, set `native_out=true` with WBNB as `target`. Enable only one native direction. Delegated swaps support native output and require ERC20 input.

The SDK native-token sentinel is handled by the SDK; do not send it as an HTTP token address.

### Service configuration

Read `/router/status` for current provider availability, execution-router address and any advertised builder defaults. On October 10, 2026, the BSC response reported `default_slippage_bps: 50`, `default_deadline_secs: 120`, `delegated_max_deadline_secs: 300` and `build_max_attempts_per_quote: 8`. These settings can change; they are service snapshots and do not replace on-chain validation.

### Existing integrations

The old `/router/swap`, `/router/swap/prepare` and `/router/swap/build` addresses remain compatible aliases for the three swap endpoints above. `/router/quote` also remains a legacy compatibility endpoint.

`find_routes` remains available and is planned for future deprecation; no removal date is announced. The swap endpoints include quoting and do not require it first. Keep the [Find Routes (Legacy)](https://docs.peach.ag/api-reference/readme/find-routes) reference for existing callers, and use the [Migration Guide](https://docs.peach.ag/documentation/bsc/aggregator/editor/migration-guide) for method and field mappings.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.peach.ag/api-reference/readme.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
