Getting started with x402
This guide takes you from an empty account to your first paid x402 request. Every paid call is a two-request flow: the server challenges with 402 Payment Required, then you retry with a signed payment.
1. Set up your account
- Sign in or register at business.1inch.com/portal/login.
- Create an application (you need at least one to link a wallet).
2. Connect and link your wallet
- Open Applications and select your application.
- Go to Linked wallets and click Link wallet.
- In the dialog, click Connect wallet, choose your wallet provider (e.g. MetaMask) and approve the connection.
- Sign the verification message to confirm ownership. This is gas-free and does not send a transaction.
- When linking succeeds, the wallet appears on the application detail page.
3. Fund your wallet
- On your application detail page, copy your linked wallet address.
- In your wallet, switch network to Base (mainnet) and fund it with real USDC on Base: deposit at least $2.00 USDC (the minimum to open your prepaid balance).
You do not need ETH for gas to start. The deposit is gasless (EIP-3009 receiveWithAuthorization, broadcast for you), paying per request is off-chain, and 1inch pays the gas for automatic and cooperative refunds. The only path that needs a little ETH on Base for gas is the optional on-chain self-withdraw fallback, which you broadcast yourself.
What each call costs
Per-call list prices, settled in USDC on Base. Use this to size your deposit above the $2.00 minimum: the more you prepay, the more calls you cover before the next automatic top-up.
| API | Price per call | Calls per $1 | Calls per $2 (min. deposit) |
|---|---|---|---|
| Web3 RPC | $0.00018 | ~5,560 | ~11,110 |
| Domains | $0.00018 | ~5,560 | ~11,110 |
| Swap | $0.00024 | ~4,170 | ~8,330 |
| Orderbook | $0.00024 | ~4,170 | ~8,330 |
| Spot Price | $0.00024 | ~4,170 | ~8,330 |
| Token | $0.00024 | ~4,170 | ~8,330 |
| Transaction Gateway | $0.00024 | ~4,170 | ~8,330 |
| Gas Price | $0.00024 | ~4,170 | ~8,330 |
| NFT | $0.00024 | ~4,170 | ~8,330 |
| Traces | $0.0003 | ~3,330 | ~6,670 |
| History | $0.0003 | ~3,330 | ~6,670 |
| Charts | $0.0003 | ~3,330 | ~6,670 |
| Balance | $0.00048 | ~2,080 | ~4,170 |
| Portfolio | $0.00048 | ~2,080 | ~4,170 |
| Token Details | $0.00048 | ~2,080 | ~4,170 |
$0 Swap fees for the time being. During the launch, 1inch is waiving its Swap infrastructure fee. For the Swap API you pay only the x402 per-call price shown above, with no additional 1inch swap fee.
The same list is on the x402 overview.
4. Make your first API request
Every paid call is a two-request flow: the server challenges with 402 Payment Required, then you retry with a signed payment.
4a. Send a request without an API key or payment
x402 is triggered by calling the API without an API key (sending a key uses the subscription path instead). With no API key and no payment, the gateway answers with a 402 challenge:
curl -i "https://api.1inch.com/swap/v6.0/1/quote?amount=1000000000000000000&src=0xEeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&dst=0xdAC17F958D2ee523a2206206994597C13D831ec7"
4b. Receive 402 Payment Required, then retry with a signed payment
The 402 response includes the payment requirements: per-request price (product-specific), payment scheme (batch-settlement), network and token (USDC on Base), and the minimum prepaid deposit ($2.00). Retry the same request with the signed payment header:
curl -i "https://api.1inch.com/swap/v6.0/1/quote?amount=1000000000000000000&src=0xEeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&dst=0xdAC17F958D2ee523a2206206994597C13D831ec7" \
-H "PAYMENT-SIGNATURE: <signed-payload-from-wallet>"
You receive 200 OK with the API response. Each call is charged per request from your prepaid balance, with no monthly subscription on the x402 path.
Signing the payment header by hand is only practical for a few test calls. For real usage, use the x402 client library: it runs the whole 402 → deposit → voucher → retry flow for you.