How It Works
Technical flow of the x402 payment protocol
The Query Flow
Step 1: Agent Discovers Endpoint
An AI agent (or any client) discovers an ATLAS x402 endpoint through:
API marketplace listings
Direct URL knowledge
Federation discovery (future)
Step 2: Initial Request
GET /x402/query?q=prediction+markets+mana HTTP/1.1
Host: your-atlas.example.comStep 3: Payment Required Response
If payment is needed, ATLAS returns:
HTTP/1.1 402 Payment Required
X-Payment-Amount: 0.01
X-Payment-Currency: USDC
X-Payment-Network: solana
X-Payment-Address: <solana-wallet-address>
X-Payment-Memo: query-<unique-id>
Content-Type: application/json
{
"status": "payment_required",
"amount": "0.01",
"currency": "USDC",
"network": "solana",
"payment_address": "<address>",
"memo": "query-abc123",
"preview": "Found 15 concepts related to prediction markets...",
"expires": "2024-01-15T12:00:00Z"
}Step 4: Payment Submission
The agent submits payment on Solana with the memo field:
Step 5: Payment Verification
ATLAS monitors for the transaction:
Checks payment amount matches
Verifies memo field
Confirms transaction finality
Step 6: Knowledge Delivery
Once payment confirms:
Payment Flow Diagram
Technical Components
Payment Verification Module
ATLAS includes a Solana-integrated billing module:
Pricing Engine
Dynamic pricing based on query complexity:
Concept count
More concepts = higher price
Query depth
Deeper analysis = higher price
Freshness
Recent data = premium
Exclusivity
Rare knowledge = premium
Caching Layer
Paid queries are cached:
Same query from same payer = free replay (24h)
Prevents double-charging for retries
Optimizes ATLAS compute resources
Security Considerations
For Knowledge Providers
Wallet security — Use dedicated payment-receiving wallet
Rate limiting — Prevent query spam
Access control — Choose what to expose via x402
Audit logging — Track all paid queries
For Knowledge Consumers
Payment limits — Set per-query and daily caps
Preview validation — Verify preview before paying
Receipt tracking — Keep transaction records
Retry handling — Protocol handles network issues
API Reference
Query Endpoint
Payment Status
Knowledge Domains
Integration Examples
Python Client
Agent Integration
AI agents using ATLAS can include x402 handling in their tool definitions:
Last updated
