How to pay for an API with x402 in 3 steps
x402 is an open way to pay for an HTTP API in USDC, using status 402 Payment Required. On Highland API, settlement is on Base mainnet, in USDC. You do not need an API key or an account. Prices and payment terms for every paid route are published at https://api.highlnd-intel.group/.well-known/x402. The full flow is in the x402 docs.
1. Call the API and read the 402
POST to the endpoint with your JSON body and no Authorization header — for example https://api.highlnd-intel.group/v1/api/dns-lookup. The API answers 402 with an `accepts` list. That object is the price: network `base`, the USDC asset, `maxAmountRequired` in atomic units (6 decimals), the `payTo` address, and a short timeout.
You can also skip a first failed call and read the same requirements from the discovery file, which lists every paid resource.
2. Sign the payment
Sign an EIP-3009 `transferWithAuthorization` for the exact `maxAmountRequired` in the 402 (or use an x402 client that does this for you). The docs show `x402-fetch` with viem in JavaScript, and the `x402` Python client with `eth-account`. Base64-encode the payment payload. The signature only authorizes that exact amount to that exact address before a deadline; your wallet key never leaves your machine.
A small agent wallet with a few USDC is enough. Calls cost cents, and the spend limit is whatever is in the wallet. Sign for network `base` (Base mainnet, chain id 8453). A signature for another network comes back as `payment_invalid`.
3. Retry with the X-PAYMENT header
Send the same request again, with `X-PAYMENT` set to that base64 payload. If payment verifies, the API runs, settles on-chain only after a successful result, and returns 200 with the data plus an `X-PAYMENT-RESPONSE` receipt (base64 JSON, including the transaction hash). Bad input or an API error is never charged. If the facilitator is briefly down, you get a retryable 503 and nothing is settled.
For frequent server or MCP calls, a prepaid API key can still be the better fit. For an agent with its own wallet, x402 is the no-sign-up path. Start with the discovery file and the x402 docs.
A first-party Highland Labs post.