Skip to main content
This page rebalances 1,000 USDC on Base across seven lending markets. The request is identical for both auth methods; only the headers change.

The request

Amounts are base units. USDC on Base has 6 decimals, so 1000000000 is 1,000 USDC and 500000000 is 500 USDC.
Save it as request.json. The market names in protocols must come from the market list for the same chain and token.

With a partner key

1

Send the call

2

Read the plan

The response has three parts: optimization_result (the target allocation and APR before and after), action_plan (withdrawals first, then deposits), and calldata (one entry per transaction, in order). See Optimize for every field.
3

Execute with your own wallet

Check the plan, then sign and send each calldata entry in order from wallet_address. Ampli never signs or sends anything.

With x402

Leave out the partner headers. The first response is 402 Payment Required with a PAYMENT-REQUIRED header that carries the price in USDC base units on Base (eip155:8453). An x402 client signs an EIP-3009 authorization and retries with PAYMENT-SIGNATURE. It needs no gas and no prior approval, only USDC on Base in the paying wallet.
Mistakes are freeThe payment is verified before the work and settled only on a 2xx response. A 400 for a bad constraint or a 422 for an over-allocated book costs nothing.

Next