The request
Amounts are base units. USDC on Base has 6 decimals, so1000000000 is 1,000 USDC and 500000000 is 500 USDC.
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 is402 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.
- TypeScript
- Raw HTTP
Next
- Authentication and payments for the full 402 offer and receipt.
- Risk rules to understand why a market got less than you expected.
- API MCP to call the same thing as an MCP tool.