The Financial Layer of the Internet for AI Agents
402gate is an open payment infrastructure that enables instant, frictionless value exchange between data providers and autonomous AI agents.
With the explosion of LLMs (Large Language Models), the internet is shifting from a web read by humans to a web read by machines. Traditional business models—based on ads (which bots don't see) and credit card subscriptions (which bots don't have)—are becoming obsolete.
402gate solves this problem by
implementing the x402 standard. We utilize the long-forgotten HTTP status code
402 Payment Required to create a native "language of money" that both servers and bots
understand.
Why 402gate?
We are building infrastructure that turns the problem of uncontrolled scraping into a new revenue source.
Zero-Friction & Permissionless
In the traditional B2B model, API integration requires contracts, invoices, and API key exchanges. In 402gate, there is no registration, login, or forms.
- > For You: Install the plugin/SDK and accept payments immediately.
- > For the Bot: Payment is a single signed transaction. No clicking, no waiting.
From Scraping to Monetization
AI companies train their models on your data for free, burdening your servers. Blocking them (robots.txt, Cloudflare) is fighting a losing battle. 402gate allows you to set a gate: "Want my data? Pay 0.01 USDC". This turns a parasitic relationship into a business symbiosis.
Stable Settlements in USDC (Base)
You don't have to worry about crypto volatility. All transactions are settled in USDC (digital dollar) on the Base L2 network.
- > Speed: Transaction finality in < 1 second.
- > Cost: Network fees (Gas) are negligible (<$0.001) and covered by the buyer (Bot).
- > Security: Non-Custodial Model. Funds go directly to your wallet (Self-Custody). We don't touch them.
Loyalty Program (Gate Points)
We believe in a co-creation economy. Every data provider processing transactions on the 402gate network receives Gate Points. This is an on-chain reputation system that will allow the community to decide the protocol's direction in the future.
Architecture: How it Works?
402gate acts as Middleware between your server and the end client. The entire process is automated and invisible to the user.
The diagram below shows the flow of a single request:
Bot asks for a resource.
Server blocks access and sends an "invoice" in JSON format (compliant with x402 spec).
Bot pays the invoice directly on the blockchain.
Bot retries the request with proof of payment (transaction hash).
402gate verifies the payment in milliseconds and releases clean data.
Use Cases
Who is 402gate for?
Content Publishers / Bloggers
Charge micro-fees to AI bots (e.g., Perplexity, ChatGPT) for real-time access to your articles.
Market Data Providers
Sell crypto prices, stock quotes, or sports scores per request (Pay-per-request), instead of expensive monthly subscriptions.
AI Tools and APIs
Share your ML models or algorithms without building a user account system and Stripe integration.
Getting Started
Start Monetizing AI Agents in Minutes
Welcome to the 402gate documentation. Our platform offers a suite of tools (SDKs and plugins) that
allow you to integrate native crypto payments into your existing infrastructure – whether you run a
blog or are building an advanced API.
Choose the integration path that best fits your tech stack.
Choose Your Path
For Content Publishers (No-Code)
If you have a CMS-based site (WordPress) and want to protect your articles from free AI scraping.
For Data Scientists (Python)
If you create APIs, ML models, or data services in Python (FastAPI, Flask, Django). Decorator-based.
For Web Developers (Node.js)
If you build modern web apps or APIs in JS/TS. Middleware for Express.js.
What You Will Need
Address to receive payments (e.g., Metamask, Coinbase Wallet, Phantom). We support Base Mainnet. You don't need any funds to start. The wallet is only for receiving payments.
Admin access to WordPress OR Source code access to your API.
During configuration, you will be asked for our verifier node address:
https://api.402gate.xyz
Getting Started FAQ
curl or Postman to simulate AI bot behavior. Detailed
instructions can be found in the specific SDK sections.
WordPress Plugin
Turn Your Content into Paid Data for AI
The official 402gate plugin allows you to instantly protect your WordPress posts and pages from free scraping by AI. It works in a "Plug & Play" model – requiring not a single line of code.
Prerequisites
Before you start, ensure you have:
- > WordPress version 5.0 or newer.
- > PHP version 7.4 or newer (standard on most hostings).
- > EVM Wallet Address (e.g., from Metamask) to receive USDC payments on Base network.
Installation
Currently, the plugin is available via "Direct Download" (outside the official WordPress repository).
Step 2: Upload to Server
- Log in to your WordPress admin panel (yoursite.com/wp-admin).
- In the left menu, select Plugins → Add New.
- Click the Upload Plugin button at the top of the screen.
- Select the previously downloaded
402gate.zipfile from your computer. - Click Install Now.
Step 3: Activation
After successful installation, click Activate Plugin.
Configuration
This is the most important stage. Without proper configuration,
the plugin won't know where to send the money.
Go to menu: Settings →
402gate.
1. Merchant Wallet Address
Paste your public wallet address here (starting with 0x...).
- Payments in USDC from bots will be sent to this address.
- Ensure you have access to this wallet on the Base network.
2. Price (USDC)
Set the price for one request (access to one article).
- Recommended starting value: 0.01 (one cent).
- You can enter any amount, e.g., 0.05 or 0.005.
3. Backend API URL
This field connects your site with the payment verification network. Enter exactly this address:
https://api.402gate.xyz
After filling, click Save Changes.
How it Works? (Blocking Logic)
The plugin works in the background and intelligently filters incoming traffic to your site.
| Who enters? | Plugin Reaction | Effect |
|---|---|---|
| Human (Browser) | Ignore | Free Access (sees page normally) |
| Googlebot (SEO) | Ignore (Whitelist) | Free Access (page is indexed in Google) |
| AI Bot (GPTBot, Claude, curl) | BLOCK | Error 402 + Payment Request |
| Paying Bot | Verification | Payment Accepted + Clean Data Release (JSON) |
Info: The plugin automatically detects popular Bot User-Agents (OpenAI, Anthropic, Google-Extended, Common Crawl) and developer tools (Python Requests, Axios, Postman).
Testing
Want to check if the plugin works without being a bot? We prepared a debug mode.
- Log out of WordPress (or open an Incognito tab).
- Go to any post on your blog.
- Append the suffix to the URL:
?bot=trueExample: https://yoursite.com/my-article/?bot=true - Press Enter.
Expected Result:
Instead of the article content, you should see a white screen with JSON code containing information:
"maxAmountRequired": "0.01"
...and your wallet address. This means 402gate is working correctly and protecting your content.
Python SDK
Monetize APIs and AI Models (FastAPI)
The official x402gate library for Python allows you to protect any API endpoint with a single decorator. It was designed with asynchronous frameworks like FastAPI (AI industry standard) in mind, but the architecture is open for adaptation.
Requirements
- > Python 3.8+
- > FastAPI (recommended) or Starlette
- > EVM Wallet Address (Base Network)
Installation
The package is available in the official PyPI registry.
Quick Start (FastAPI)
The simplest way to integrate is using the @protect decorator. It acts as a "gatekeeper" (middleware) that
intercepts the request before it reaches your logic function.
1. Import and Configuration
from fastapi import FastAPI, Request
# Import the decorator from our library
from x402gate.core import protect
app = FastAPI()
2. Protecting the Endpoint
Simply add the @protect decorator above the route handler function. You
must provide the price and recipient wallet.
@app.get("/premium-forecast")
@protect(
price="0.05",
wallet="0x1234567890123456789012345678901234567890" # Your public address
)
async def get_forecast(request: Request):
# This code will execute ONLY if payment is verified.
# Otherwise, x402gate returns HTTP 402 error.
return {
"status": "paid",
"prediction": "BTC to 100k",
"confidence": 0.98
}
Note: Remember to include the
request: Request argument in your function, as
the decorator needs access to HTTP headers to verify the payment hash.
Configuration Parameters
The protect decorator
accepts the following arguments:
| Parameter | Type | Description | Example |
|---|---|---|---|
| price | str | Price per request in USDC. | "0.01" |
| wallet | str | Your Base (EVM) wallet address to receive funds. | "0xAbC..." |
How it Works Under the Hood?
When a user (or bot) sends a request to a protected endpoint:
Inspection
SDK checks for the presence of the X-Payment-Hash header.
Block (402)
If the header is missing, SDK interrupts
processing and returns a JSON response with code 402, containing payTo (Your wallet) and maxAmountRequired (Price).
Verification
If the header is present, SDK connects to the
verification node api.402gate.xyz to check the
transaction status on Base blockchain.
Access
If verification is successful, your get_forecast function is executed, and data is
returned to the client.
Client Example (How to Test?)
To test your API as a client (bot), you can use curl:
Step 1: Check Price (Hit the Wall)
Step 2: Access with Payment (Simulation)
After making a payment on the blockchain, the bot sends the request again with the transaction hash:
Node.js SDK
Monetize APIs and Microservices (Express.js)
For the JavaScript/TypeScript environment, we prepared a lightweight middleware that integrates with popular server frameworks (like Express.js). This allows you to "cut off" access to any route and require payment before executing business logic.
Requirements
- > Node.js v16+
- > Express.js (or connect-style middleware compatible framework)
- > EVM Wallet Address (Base Network)
Installation
The package is available in the NPM registry.
Quick Start (Express.js)
The SDK works as a middleware function. It intercepts the
request object, checks payment status, and decides whether to pass traffic through (next()) or return a 402 error.
1. Import and Configuration
const express = require('express');
const x402gate = require('x402gate');
const app = express();
// Payment gateway configuration
const paywall = x402gate({
wallet: "0x1234567890123456789012345678901234567890", // Your wallet address
price: "0.05" // Price in USDC
});
2. Protecting Routes
You can use the paywall constant as the second argument in the route
definition.
// This route is free
app.get('/', (req, res) => {
res.send('Hello World!');
});
// This route requires 0.05 USDC payment
// Middleware 'paywall' checks payment BEFORE this code runs
app.get('/api/secret-data', paywall, (req, res) => {
res.json({
status: "success",
data: "Here is premium data your bot paid for.",
timestamp: new Date()
});
});
app.listen(3000, () => {
console.log('Server running on port 3000');
});
Configuration Options
Function x402gate(options)
accepts an object with the following parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| wallet | string | Yes | Your public address on Base network (0x...) to receive funds. |
| price | string | Yes | Amount in USDC (e.g. "0.01"). Remember to pass it as a string. |
Error Handling
Middleware automatically handles typical error scenarios, returning appropriate HTTP codes, so you don't need to write try/catch in your controller.
Payment Required
When payment header is missing (returns JSON with payment instructions).
Payment Invalid
When submitted transaction hash is invalid or funds didn't reach your wallet.
Internal Server Error
When there is a problem connecting to the verification node.
Testing (Client-Side)
To test a protected endpoint, you can use curl or create a simple JS client.
Step 1: Request without payment
Step 2: Request with payment
After executing transaction on blockchain,
client must add x-payment-hash header.
Gate Points & Economics
Economic Model & Loyalty Program
402gate is not just technology, it's a new economic model for the internet. In this section, we explain how money (USDC) flows and how our incentive system (Gate Points) works.
Payment Model (Peer-to-Peer)
Our architecture is based on Zero-Trust and Non-Custodial principles. This means that as a platform, we never touch your money.
Fund Flow
Buyer (AI Bot)
Signs the transaction with its private key.
Network (Base Blockchain)
Transfers funds directly from the bot's wallet to your wallet.
Seller (You)
You receive 100% of the transaction amount in USDC.
Transaction Costs (Gas Fees)
A common question is: "Will network fees eat up my profit?"
Answer: No.
- * Network: We use Base L2 (Ethereum Layer 2), where costs are minimal.
- * Sender Principle: In the crypto world, the gas fee is always paid by the sender (Bot).
- * Your Margin: If you set the price to 0.01 USDC, you receive exactly 0.010000 USDC.
Gate Points
Gate Points is an internal reputation and loyalty system designed to reward Data Providers who actively co-create the 402gate network during the Beta phase.
How to earn points?
Points are accrued automatically by our verification node (Oracle) after every successful on-chain transaction.
| Action | Reward |
|---|---|
| Handling a paid request | 10 Points |
| Payment verification | Automatic |
Example: If your site handles 100 requests from AI bots in a day, your wallet receives 1.00 USDC (earnings) and 1000 Gate Points (reputation).
Purpose of Points
Gate Points serve to:
- Contribution Measurement: We identify the most valuable nodes in the network (e.g., those with high uptime and unique data).
- Reputation: In the future, points may unlock premium features (e.g., lower fees in SaaS model) or influence voting weight in protocol governance.
Checking Points Balance
Since points are stored off-chain (in our Supabase database), you won't see them in MetaMask. You can check your balance via our public API:
{
"wallet": "0x123...",
"points": 4500,
"last_updated": "2025-10-24T12:00:00Z"
}