x402 pay-per-call
x402 is an open standard that brings back HTTP status 402 Payment Required. Your client calls an API, gets a price, signs a USDC payment and calls again. No key, no account, no top-up. It is built for autonomous agents that hold their own wallet.
| Version | x402 v1, scheme exact |
| Network | base (Base mainnet, chain id 8453) |
| Asset | USDC 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 (EIP-712 name USD Coin, version 2) |
| Pay to | 0xfdb6ea04e7e75d39d3bdb4ba21e6b6c8fec36048 |
| Price | the API's credit price in CAD cents × 0.75, in USDC, rounded up (2 credits = 0.015 USDC) |
| Discovery | GET https://api.highlnd-intel.group/.well-known/x402 lists every paid resource |
| Settlement | only after the API succeeded. Bad input or an API error is never charged. |
The flow
POST https://api.highlnd-intel.group/v1/api/<id>with your JSON input and no key.- The API answers
402with the exact requirements:
json
{
"error": "payment_required",
"x402Version": 1,
"accepts": [{
"scheme": "exact",
"network": "base",
"maxAmountRequired": "15000",
"resource": "https://api.highlnd-intel.group/v1/api/dns-lookup",
"description": "DNS records",
"mimeType": "application/json",
"payTo": "0xfdb6ea04e7e75d39d3bdb4ba21e6b6c8fec36048",
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"extra": { "name": "USD Coin", "version": "2" },
"maxTimeoutSeconds": 120
}]
}- Your client signs an EIP-3009
transferWithAuthorizationformaxAmountRequired(atomic units, 6 decimals:15000= 0.015 USDC), base64-encodes the payment payload and sends the same request again with headerX-PAYMENT: <base64>. - The API verifies the signature with the facilitator, runs, settles the payment on-chain and returns
200with the result and anX-PAYMENT-RESPONSEheader (base64 JSON receipt with the transaction hash).
The signature only authorizes that exact amount to that exact address before a deadline. Your wallet key never leaves your machine, and we never hold your funds.
With a client library
Use the open-source x402 clients. They do steps 2 to 4 for you.
javascript (x402-fetch + viem)
// npm i x402-fetch viem
import { wrapFetchWithPayment } from "x402-fetch";
import { privateKeyToAccount } from "viem/accounts";
const account = privateKeyToAccount(process.env.AGENT_WALLET_KEY); // a small hot wallet with a few USDC
const pay = wrapFetchWithPayment(fetch, account);
const res = await pay("https://api.highlnd-intel.group/v1/api/dns-lookup", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ domain: "example.com" }),
});
console.log(await res.json());
console.log("receipt:", res.headers.get("x-payment-response"));python (x402 + eth-account)
# pip install x402 eth-account
import os
from eth_account import Account
from x402.clients.requests import x402_requests
session = x402_requests(Account.from_key(os.environ["AGENT_WALLET_KEY"]))
r = session.post("https://api.highlnd-intel.group/v1/api/dns-lookup", json={"domain": "example.com"})
print(r.status_code, r.json())
print("receipt:", r.headers.get("x-payment-response"))By hand (curl)
bash
# 1. Get the price
curl -s -X POST https://api.highlnd-intel.group/v1/api/dns-lookup -H "content-type: application/json" -d '{"domain":"example.com"}'
# 2. Sign the payment with your x402 client, then retry with the header
curl -s -X POST https://api.highlnd-intel.group/v1/api/dns-lookup \
-H "content-type: application/json" \
-H "X-PAYMENT: $PAYMENT_B64" \
-d '{"domain":"example.com"}' -D - Errors
| Status | Error | Meaning |
|---|---|---|
| 402 | payment_required | No X-PAYMENT header. Pay what accepts[0] says. |
| 400 | invalid_x_payment | The header is not base64 JSON of an x402 v1 payload. |
| 402 | payment_invalid + reason: wrong_network | Signed for another network. Use base. |
| 402 | payment_invalid + a reason such as invalid_exact_evm_signature, insufficient_funds | The facilitator refused the signature. Read reason. |
| 503 | facilitator_unavailable (retryable: true) | Retry in a few seconds. Nothing was charged. |
Discovery for directories and agents
GET https://api.highlnd-intel.group/.well-known/x402 returns { "x402Version": 1, "enabled": true, "resources": [ ... ] } with the same requirements object for every API, so x402 directories and agents can list and price the whole catalog without a call.
When to use x402 or a key
| Use x402 when | Use an API key when |
|---|---|
| The caller is an agent with its own wallet | You call from a server, a script or MCP |
| You want zero sign-up | You want one balance, usage history and plans |
| Calls are occasional | Calls are frequent (one on-chain settlement per call costs time) |