402 response. Think of it as an alternative access model alongside API keys, ideal for agents and integrations that need to pay as they go.
Prerequisites
Before you begin, ensure you have:- A Base-compatible wallet funded with USDC to cover the payment
- The ability to sign an on-chain payment (directly or through an x402 client library)
How It Works
1
Call a supported endpoint without an API key
Send your request as usual, but omit the
x-api-key header.2
Receive a 402 Payment Required
The response includes a
PAYMENT-REQUIRED header — base64-encoded JSON containing the USDC deposit address and the amount to pay.3
Pay on-chain
Send the requested amount of USDC on Base to the deposit address.
4
Retry the same request with your payment proof
Resend the identical request, this time with a
payment-signature header containing your signed payment proof.5
Get your response
You receive the endpoint’s normal response, plus
x-credit-token and x-credit-balance-cu headers.Credit Tokens
After you pay, Webacy returns a credit token in thex-credit-token header. This token holds prepaid Compute Units left over from your payment.
Keep it. On subsequent requests, send it back as an x-credit-token header to spend your prepaid balance instead of paying again. The x-credit-balance-cu header in each response tells you how many Compute Units remain. When the balance runs out, the next request returns another 402 and you pay again.
Store your credit token securely and reuse it across requests. It represents prepaid balance — treat it like a bearer token.
Headers
Pricing
x402 uses the same Compute Unit costs as API-key pricing — each endpoint consumes the same number of CUs whether you authenticate with a key or pay with x402. There is a $0.50 minimum per payment. If your payment covers more CUs than a single request needs, the surplus becomes extra prepaid balance on your credit token, which you can spend on later requests.Supported Chains
Today, x402 payments are supported on Base using USDC. Support for additional chains is coming.Example
The following walks through the full challenge-pay-retry loop against the address risk endpoint.Producing the
payment-signature means signing the payment with your Base wallet. x402 client libraries can automate the full challenge-pay-retry loop for you.402 response schema on any endpoint that supports x402, see the API Reference.
What’s Next
Compute Units (CUs)
Learn how Compute Units measure the processing and intelligence required for each Webacy API request — the same costs that determine your x402 pricing.
