POST /api/onramp-linkGenerate a single-use Coinbase Onramp URL that lets a human fund any wallet with a card or Apple Pay — the fastest way to put real USDC into an agent's wallet. Returns the ready-to-open URL plus a fee-inclusive quote. Networks: base, ethereum, polygon, arbitrum, optimism, solana.
| Field | Type | Description |
|---|---|---|
address * | string | Destination wallet address (EVM 0x… or Solana base58, matching the network) |
network | string | base (default) | ethereum | polygon | arbitrum | optimism | solana |
asset | string | Ticker to purchase (default USDC) |
amount | string | Crypto amount the wallet should receive (default 10) |
country | string | Buyer's ISO 3166-1 country code (default US) |
subdivision | string | US state code (e.g. NY) — required for US buyers by some payment methods |
redirectUrl | string | Optional URL to send the buyer to after checkout |
{
"onrampUrl": "https://pay.coinbase.com/…single-use…",
"singleUse": true,
"quote": {
"paymentTotal": "10.42",
"paymentCurrency": "USD",
"purchaseAmount": "10",
"purchaseCurrency": "USDC",
"destinationNetwork": "base"
}
}
curl -i -X POST https://agent402.tools/api/onramp-link \
-H "Content-Type: application/json" \
-d '{"address":"0xaBF4FAbd7c416fB67202E5f9002389Fc75e2a9D0","network":"base","amount":"10"}'
The response is HTTP 402 Payment Required with exact payment requirements. Any x402 v2 client pays automatically and retries:
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/onramp-link", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"address": "0xaBF4FAbd7c416fB67202E5f9002389Fc75e2a9D0",
"network": "base",
"amount": "10"
}),
});
GET /api/wallet-balancesAll ERC-20 + native token balances for any EVM address in one call, from Coinbase's indexed data API — no per-token cont…
POST /api/testnet-fundFund any address with testnet USDC (1 USDC) or ETH (0.0001) on Base Sepolia via the Coinbase faucet — everything an agen…