Before settlement, the applicable contract needs permission to move your sell tokens. Call approve() on the ERC-20 token contract for the required amount.
This applies to both the RFQ API (router and settlement contracts) and Aggregation API (balance manager).
Which Contract to Approve
Every quote response includes an approvalTarget field - this is the address you approve. Always use this value rather than hardcoding.
Never hardcode the approval address. Always read approvalTarget from the quote response.RFQ API quotes may return the router contract, settlement contract, or Permit2, depending on the flow.The Aggregation API uses a separate balance manager contract for approvals - it is not the same as the settlement contract.For Aggregation API, approving the settlement contract will lead to loss of funds.
Check Existing Allowance
Before approving, check whether the token already has sufficient allowance. This avoids unnecessary gas spend on redundant approval transactions.
Approve if Needed
If the current allowance is less than the trade amount, submit an approval transaction. Most integrators approve the maximum amount (2^256 - 1) so they only need to do this once per token.
Using It with Quotes
After receiving a quote from either API, check and approve before signing and broadcasting:
Approval Strategies
Max approval (recommended for programmatic integrators): Approve 2^256 - 1 once per token. Saves gas on subsequent trades since you never need to re-approve. This is the standard approach for solvers and aggregators.
Exact approval: Approve only the exact trade amount each time. More conservative, but costs gas on every trade. Some compliance-sensitive integrations prefer this.
Approval type
The public RFQ and Aggregation APIs use approval_type=Standard.
For BebopRouter trades, see Permit2 for self-execution.
Always approve the approvalTarget from the current quote.