Make your first API call in minutes
PicoPayd APIs use the x402 protocol — pay per call with USDC on Base. No subscriptions, no API keys to manage. This guide walks through a complete integration using the Email Validator API.
Set up a wallet
PicoPayd uses the x402 protocol — each API call deducts a small amount of USDC directly from your wallet on Base (an Ethereum L2). You need a wallet funded with USDC to make calls.
Option A — Coinbase Wallet
Download Coinbase Wallet, create a wallet, and bridge or buy USDC on Base. Easiest for beginners.
Option B — Programmatic wallet
Use Coinbase CDP or viem/ethers.js to create a wallet in code. Best for AI agents and automated pipelines.
from cdp import Cdp, Wallet # Initialize Coinbase Developer Platform SDK Cdp.configure_from_json("cdp_api_key.json") # Create a new wallet on Base wallet = Wallet.create(network_id="base-mainnet") address = wallet.default_address print("Wallet address: {address.address_id}") # Fund with USDC — send USDC to the address above # Minimum recommended: $1 USDC for testing
Base network only. PicoPayd currently accepts USDC on Base mainnet and Base Sepolia (testnet). Make sure you're on the right network before funding.
Install the x402 client library
The x402 client handles the payment handshake automatically. When your request returns an HTTP 402, the client pays with your wallet and retries — you don't need to think about it.
# Install the x402 client for Python pip install x402 # Also install the Coinbase CDP SDK if using programmatic wallets pip install cdp-sdk
Make your first API call
We'll use the Email Validator API as an example. It checks syntax, performs an MX record lookup, detects disposable addresses, and returns a confidence score — all for $0.001 per call.
https://email.picopayd.codefission.co.uk/api/validate $0.001 / call import x402 from cdp import Cdp, Wallet # Load your wallet Cdp.configure_from_json("cdp_api_key.json") wallet = Wallet.fetch("YOUR_WALLET_ID") # Create an x402-enabled HTTP client client = x402.Client(wallet) # Call the Email Validator API response = client.post( "https://email.picopayd.codefission.co.uk/api/validate", json={"email": "hello@example.com"} ) result = response.json() print(f"Valid: {result['valid']}") print(f"Confidence: {result['confidence']}")
Handle the response
A successful call returns a JSON object with a valid boolean, detailed check results, and a confidence score from 0.0 to 1.0.
{
"valid": true,
"email": "hello@example.com",
"checks": {
"syntaxOk": true,
"mxExists": true,
"isDisposable": false
},
"confidence": 1.0
} | Field | Type | Description |
|---|---|---|
valid | boolean | Whether the email address is considered deliverable |
checks.syntaxOk | boolean | Email format passes RFC 5322 syntax validation |
checks.mxExists | boolean | Domain has valid MX records — mail can be delivered |
checks.isDisposable | boolean | Address is from a known disposable email provider |
confidence | number | Score from 0.0–1.0. Penalised for missing MX (−0.6) or disposable (−0.3) |
Handle errors
The API uses standard HTTP status codes. The most common non-2xx response you'll encounter is 402 Payment Required — this is handled automatically by the x402 client. You only need to catch it manually if you're making raw HTTP calls.
| Status | Meaning | Action |
|---|---|---|
| 200 | Success | Parse the JSON response |
| 400 | Invalid request body | Check your JSON — likely a missing or malformed field |
| 402 | Payment required | Handled automatically by the x402 client. If manual: sign and retry with X-Payment header |
| 429 | Rate limited | Back off and retry after the Retry-After header duration |
| 500 | Server error | Retry with exponential backoff. Check status page if persistent |
import x402 client = x402.Client(wallet) try: response = client.post( "https://email.picopayd.codefission.co.uk/api/validate", json={"email": "hello@example.com"} ) response.raise_for_status() result = response.json() except x402.InsufficientFundsError: print("Wallet balance too low — top up with USDC on Base") except x402.PaymentError as e: print(f"Payment failed: {e}") except Exception as e: print(f"Request failed: {e}")