Skip to main content
Bebop supports three trading modes, all settled atomically in a single transaction: Multi-token trades (many-to-one and one-to-many) are useful when rebalancing portfolios, consolidating stablecoin positions, or distributing a single asset into multiple tokens - all without paying gas for separate swaps.

How It Differs from Single-Token Trades

The API interface is nearly identical. The differences are: Request: Pass comma-separated token addresses and amounts instead of single values. Response: The onchainOrderType is MultiOrder or AggregateOrder instead of SingleOrder. The API returns MultiOrder when a single maker fills the trade, or AggregateOrder when multiple makers are involved. EIP-712 signing: MultiOrder uses flat array types (address[], uint256[]), while AggregateOrder uses nested arrays (address[][], uint256[][]) with one entry per maker.

1. Request a Multi-Token Quote

Separate multiple token addresses and amounts with commas. The order of amounts must match the order of token addresses.

Many-to-one: sell USDC + DAI → buy USDT

One-to-many: sell WETH → buy USDT + USDC + PYUSD

For one-to-many, specify a single sell_tokens / sell_amounts and comma-separated buy_tokens. Use buy_amounts instead of sell_amounts to control how much of each output token you want:

2. Understand the Response

The response structure is the same as single-token quotes, but with multiple entries in sellTokens or buyTokens: When a single maker fills the trade, the API returns MultiOrder with flat arrays:
When multiple makers are involved, the API returns AggregateOrder with nested arrays - one entry per maker:
Note the key structural differences: MultiOrder uses singular maker_address / maker_nonce and flat token/amount arrays, while AggregateOrder uses plural maker_addresses / maker_nonces and nested arrays where each outer index corresponds to a maker.

3. Sign and Broadcast

The API returns MultiOrder or AggregateOrder depending on whether one or multiple makers fill the trade. For self-execution, this distinction doesn’t matter - you broadcast the tx object directly. For gasless (EIP-712 signing), use the onchainOrderType from the response as your primaryType.
The API selects the order type automatically - SingleOrder, MultiOrder, or AggregateOrder - based on the trade structure. Use the onchainOrderType from the quote response as your primaryType. See the EIP-712 order type schemas for the full type definitions.