x402 Overview
x402 is a new open payment protocol developed by Coinbase that revives the HTTP 402 Payment Required status code to enable instant, programmatic stablecoin payments. Think of it as bringing native payments to the internet - no accounts, no API keys, just pay and access. Key capabilities:- Instant Micropayments: Pay-per-request APIs with USDC on Base (fee-free!)
- Agent-Native Payments: AI agents can autonomously discover and pay for services
- No Authentication Required: No API keys, accounts, or complex auth flows
- Simple Integration: Add payments to any HTTP endpoint with minimal code
- 🆕 Discovery Layer (x402 Bazaar): Agents can find and use services programmatically - learn more
Getting Started
Quick Start Options
-
For Sellers (Monetize Your API)
- Follow our Quickstart for Sellers to add x402 payments to your API
- Check out the express server example for a complete implementation
- Use our middleware for popular frameworks (Express, Next.js, FastAPI, Flask, etc.)
-
For Buyers (Build Payment-Enabled Agents)
- Start with the Quickstart for Buyers
- Use the x402-axios client for automatic payment handling
- Integrate with AgentKit for powerful AI agent capabilities
-
MCP Server Integration
- Build Model Context Protocol servers that can pay for services
- See our MCP Server guide for Claude Desktop integration
- Check the MCP example in our repo
-
Discover Services with x402 Bazaar
- Use the new x402 Bazaar to programmatically discover available x402 services
- Perfect for building agents that can autonomously find and use new capabilities
- No need to hardcode endpoints - let your agents discover services dynamically!
-
Miniapps with Payments
- Use our Farcaster miniapp template
- See the Miniapps guide for building payment-enabled experiences in TBA
Development Tools
- GitHub Repository: github.com/coinbase/x402
- Network Support: Currently supporting USDC on Base (mainnet) and Base Sepolia (testnet). To use x402 on mainnet, you’ll need to use the CDP facilitator
- Discord Support: Join us in the CDP Discord
Integration with CDP Products
x402 works seamlessly with other Coinbase Developer Platform products:- CDP Wallets: Use Server Wallets for agent payments or Embedded Wallets for user-facing apps
- AgentKit: Create AI agents that can autonomously pay for services
- Onramp: Enable users to fund their wallets to pay for x402 services
Project Ideas
AI Agent Projects
Financially Autonomous Agent Build an agent that becomes truly financially independent. Give it the ability to:- Access the x402 Bazaar to dynamically discover and use new services
- Post on social platforms to build its reputation
- Create and post bounties for tasks it needs completed
- Self-improve by purchasing new tools and capabilities via x402
- Bonus: Allow the agent to restart itself with expanded capabilities learned from the Bazaar
- Starts with basic capabilities
- Discovers new tools available via the x402 Bazaar
- Purchases and integrates new tools autonomously
- Builds its own website showcasing learned capabilities
- Restarts with more tools and improved functionality from the Bazaar ecosystem
- Uses a local model for routine decisions
- Automatically outsources to Hyperbolic’s x402 API for complex reasoning
- Optimizes cost vs. performance dynamically
- Tracks spending and adjusts strategy based on results
- Accessible via x402 for a set price per review
- Performs code reviews, bug fixes, or PR analysis
- No subscription or API key required - pure pay-per-use
- Could integrate with GitHub webhooks for automatic reviews
- Posts bounties for various tasks using x402 payments
- Verifies completed work and releases payments
- Learns from completed tasks to post better bounties
- Could manage entire projects autonomously
Infrastructure & Tools
Endpoint Wrapping Take existing APIs and make them x402-compatible:- Wrap non-x402 endpoints to enable pay-per-use access
- Priority targets:
- Browser/Computer Use APIs
- GPU Compute services
- Data storage/retrieval endpoints
- LLM inference APIs
- Create a marketplace of wrapped endpoints
- Note: Some of these services already exist (https://mcpay.fun , https://www.monetizedmcp.org/), and you can use them to build wrapped endpoints.
- Split payments between creators and publishers
- Revenue sharing for agent-tool ecosystems
- Integration with @0xSplits or similar protocols
- Transparent, onchain payment distribution
- Break complex jobs into microtasks
- Any agent can claim and complete tasks for x402 bounties
- Automatic task verification and payment release
- Reputation system for reliable agents
Commerce & Consumer Apps
Monetized Miniapps Use x402 to build frictionless payment experiences:- No signup or authentication required
- Users pay-as-they-go for features
- Deploy in Farcaster/TBA for distribution
- See remixme.xyz for inspiration
- Uses x402 to pay for external services
- Exposes capabilities to end users
- Natural language interface for complex tasks
- Could be a personal assistant, researcher, or trader
- Integration with AEON or Crossmint for physical goods
- x402 for instant payment processing
- Agent negotiation and price discovery
- Autonomous supply chain management
- Use x402 for monetization without complex billing
- Distribute through Telegram’s massive user base
- Bonus: Make it work across Telegram, MCP, and other platforms
- Could be games, tools, or content generators
Protocol Improvements
x402 Spec Enhancements Work with our engineering team to extend the protocol:- Support for arbitrary tokens beyond USDC
- Multi-network payment routing
- New payment schemes (subscriptions, auctions, etc.)
- Credit-based billing systems
- Enhanced discovery mechanisms
Getting Help
We’re here to help you succeed with x402:- Get started with x402 implementation
- Review your architecture and approach
- Provide test USDC for Base Sepolia
- Answer any technical questions
- Get your feedback on the protocol
Tips for Success
- Start Simple: Begin with a basic x402 integration, then add complexity
- Use Our Examples: The x402 repo has complete examples for common use cases
- Think Agent-First: Design your services to be discoverable and usable by AI agents
- Leverage Existing Tools: Combine x402 with AgentKit or embedded wallets for powerful experiences
- Test on Sepolia First: Use Base Sepolia for development, then deploy to mainnet
- Document Your API: Make it easy for agents and developers to understand your endpoints
Building with x402
Let’s bring programmatic payments to the internet and enable the next generation of autonomous agents. We can’t wait to see what you build!- Join our developer community on Discord
- Contribute to the x402 protocol development
- Apply for CDP’s monthly grants program
- Launch your project on mainnet
- Share your learnings with the community