x402 quickstart: from zero to a paid call in 5 minutes

This quickstart takes you from nothing to a real paid x402 call. The only prerequisite is a crypto wallet with a small amount of USDC on Base.

Step 1 — Try it free first

Before funding anything, confirm the endpoint works with a free trial call:

cURL — free trialbash
# Free trial call — real data, no payment, no signup (1/endpoint/hour):
curl "https://2s.io/api/weather/zip?zip=94103&trial=1"

Step 2 — Fund a wallet

Get a little USDC into an EVM wallet on Base (a few cents covers thousands of calls). You only need the wallet private key in your environment — there is no 2s account to create. Keep the key in an env var like EVM_PRIVATE_KEY.

Step 3 — Install an SDK and call

The SDK handles probe, signing, and retry. TypeScript:

TypeScript — @2sio/sdktypescript
// npm i @2sio/sdk
import { TwoS } from '@2sio/sdk'

// Fund any EVM wallet with a little USDC on Base. No signup, no API key.
const client = new TwoS({ privateKey: process.env.EVM_PRIVATE_KEY as `0x${string}` })

const res = await client.weather.zip({ zip: '94103' })
console.log(res.data)          // real National Weather Service forecast
console.log(res.costUsd)       // what this call cost, in USDC
console.log(res.settlement?.txHash)  // on-chain settlement tx

Or Python:

Python — 2siopython
# pip install 2sio
import os
from twosio import TwoS

client = TwoS(private_key=os.environ["EVM_PRIVATE_KEY"])

res = client.weather.zip(zip="94103")
print(res.data)        # real forecast
print(res.cost_usd)    # USDC charged
print((res.settlement or {}).get("tx_hash"))

Step 4 — Go wider

The exact same client works across the whole catalog — swap weather.zip for any endpoint. Browse them in the API list, or point an MCP host at the catalog so your agent can call any endpoint on demand.

Call a live x402 API right now — no signup.

Browse the full endpoint directory, grab the quickstart, or read the llms.txt manifest. Every endpoint is keyless and pay-per-call.

FAQ

What do I need to start with x402?
A crypto wallet with a small amount of USDC (on Base or Solana). No account signup and no API key. Put the wallet key in an environment variable and the SDK does the rest.
How much USDC should I fund?
A few cents goes a long way — most 2s calls cost a fraction of a cent, and you pay only per call. Top up whenever you like.
Do I have to use an SDK?
No, but it is the easiest path because it builds the payment signature for you. You can implement the probe → sign → retry flow directly with a wallet library if you prefer.

Related

Topics: x402 tutorial · x402 quickstart · how to use x402 · getting started with x402 · x402 guide