x402 Protocol Payments
Conto integrates with the x402 protocol to let AI agents pay for HTTP APIs that return402 Payment Required. Conto acts as a policy layer between your agent and the x402 facilitator.
x402 endpoints enforce explicit API-key scopes. Pre-authorization requires
payments:request,
recording execution requires payments:execute, and budget or service analytics require
analytics:read.How It Works
- Agent sends a request to an x402-enabled API
- API returns HTTP 402 with payment details (amount, recipient, facilitator)
- Agent calls Conto to pre-authorize the payment against policies
- If approved, agent signs the payment and retries the API call
- Agent records the transaction in Conto for tracking
Pre-Authorization
Before making an x402 payment, check it against your policies and budget limits:serviceDomain from resourceUrl, so you do not need to send it separately. Send
the facilitator, scheme, payment ID, and session ID when they are available so matching policy
controls evaluate the actual x402 challenge instead of missing context.
Send payerAddress and network together. Use the exact signing address and the CAIP-2 network
from the selected x402 requirement. This binds policy evaluation to the wallet that will pay. The
binding is required when an agent has more than one active wallet.
Response (Approved):
Recording Transactions
After the x402 payment is executed onchain, record it in Conto:txHash is required. Before recording spend, Conto verifies a successful settlement on the
wallet’s configured chain with the exact sender, recipient, asset, and amount. A pending receipt
returns SETTLEMENT_PENDING; a mismatched transfer returns SETTLEMENT_MISMATCH; and an unavailable
RPC returns a temporary service error. Only verified settlements are stored as confirmed.
Repeat the same payerAddress and network used for pre-authorization. Conto resolves the pair to
one active wallet and uses that wallet for settlement verification and spend tracking.
Batch Recording
For high-frequency micropayments, batch multiple records:batchItems; the record endpoint does not accept a top-level payments array. The sum
of all batchItems must equal the top-level settlement amount.
Use optional context.department and context.project values during pre-authorization and
recording to apply scoped budgets and persist those dimensions on the transaction.
Querying Services
View which x402 services your agent has used:Budget Tracking
Check remaining budget and burn rate:sessionId is supplied,
spend.session also reports the call count and amount recorded with that customer-defined ID.
Unified Machine Spend View
If this agent also uses MPP or multiple paid services, use the shared machine-spend endpoints for a combined view:x402 Policy Rules
Configure x402-specific policies to control micropayment behavior. The complete list of x402 rule types, value formats, and operators lives in Advanced Policies > x402 Protocol Rules.Anomaly Detection
Conto automatically monitors x402 spending patterns and creates alerts for:
Configure alert thresholds in Alerts in the dashboard.
Next Steps
Advanced Policies
Configure x402-specific policy rules
Machine Spend
View unified x402 and MPP service spend
Error Handling
Handle x402 authorization errors