x402
Pay-per-request access via the x402 protocol
The x402 standard is an open, HTTP-based payment protocol developed by Coinbase. It uses the HTTP 402 status code (Payment Required) to enable instant, on-chain micropayments directly over the web.
No API keys. No registration. No OAuth. Just pay per request with your wallet. See x402.org.
Available Endpoints
Indigo Chat
POST /v1/agents/indigo
Chat with the Indigo AI agent for real-time market insights and narrative analysis.
{
"messages": [
{
"role": "user",
"content": "Which developing narrative has the most potential for growth?"
}
]
}This works like a standard LLM completions endpoint. Each request is stateless, so if you want the agent to have context from prior exchanges, include the conversation history in the messages array:
{
"messages": [
{
"role": "user",
"content": "Which developing narrative has the most potential for growth?"
},
{
"role": "assistant",
"content": "Based on current momentum, ..."
},
{
"role": "user",
"content": "What are the main risks with that narrative?"
}
]
}Surging Projects
GET /v1/projects
Retrieve the list of projects with surging momentum, updated in real time.
| Parameter | Description |
|---|---|
limit | Maximum results (default: 50, max: 50) |
name | Filter by project name (regex) |
ticker | Filter by exact ticker symbol |
xHandle | Filter by X handle |
sortBy | Sort by score (default) or popularityScore |
minScore | Minimum score threshold |
Already using the free tier? Unauthenticated API responses include a meta.upgrade object with direct URLs to the key purchase endpoints below. Your agent can follow those URLs programmatically to upgrade from delayed to real-time data.
API Key Generation
Purchase time-limited API keys via x402 — no account or registration needed. Pay with USDC on Base and receive an API key instantly. These keys are intended for personal use only.
| Endpoint | Period | Price |
|---|---|---|
POST /v2/api-keys/1d | 1 day | $10 |
POST /v2/api-keys/1w | 1 week | $50 |
POST /v2/api-keys/4w | 4 weeks | $100 |
Save your API key immediately. The key is returned only once in the response. It cannot be retrieved again. Make sure your agent or application stores it before proceeding.
Example response:
{
"status": 201,
"data": {
"apiKey": "a1b2c3d4e5f6...",
"expiresAt": "2026-03-27T08:00:00.000Z",
"period": "4w",
"type": "x402",
"scopes": ["mcp", "projects"],
"rateLimit": {
"requestsPerMinute": 30,
"requestsPerDay": 10000
},
"warning": "Save this API key now. It will not be shown again."
}
}Once you have a key, use it with the REST API endpoints (/v2/...) via the x-api-key header. The key is intended for personal use only, with rate limits of 30 req/min and 10k req/day.
To check your key's expiration and metadata at any time, call GET /v2/api-keys/info.
How It Works
- Make a request to an x402-enabled endpoint
- Receive a
402 Payment Requiredresponse with payment details - Authorize the payment on-chain with your wallet
- Retry the request with payment proof
- Receive the data
The x402 helper libraries handle steps 2-4 automatically. You make a single request and get the response—payment happens transparently.
Integration
Use the @x402/fetch or @x402/axios package to wrap your HTTP client with automatic payment handling:
npm install @x402/fetch @x402/evm viemimport { wrapFetchWithPayment, x402Client, x402HTTPClient } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
// Create a wallet signer (using your private key)
const signer = privateKeyToAccount(process.env.WALLET_PRIVATE_KEY);
// Create x402 client and register EVM scheme
const client = new x402Client();
registerExactEvmScheme(client, { signer });
// Wrap the fetch function with payment handling
const fetchWithPayment = wrapFetchWithPayment(fetch, client);
// Make a POST request to the agent
fetchWithPayment("https://api.aixbt.tech/x402/v1/agents/indigo", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
messages: [{ role: "user", content: "Hi" }],
}),
})
.then(async (response) => {
const data = await response.json();
console.log("Response:", data);
// Get payment receipt from response headers
if (response.ok) {
const httpClient = new x402HTTPClient(client);
const paymentResponse = httpClient.getPaymentSettleResponse((name) =>
response.headers.get(name)
);
console.log("Payment settled:", paymentResponse);
}
})
.catch((error) => {
console.log(error);
});For complete examples using both fetch and axios, see the AIXBT x402 Examples repository.
Payment Settlement
Payments are only settled when the server returns a successful response (2xx status). If a request fails, your payment is not charged:
- 404 errors — No information found for your query
- 500 errors — Server encountered an internal error
This means you only pay for successful requests that return meaningful data.
Example error response (no payment charged):
{
status: 404,
error: "No information found",
data: {
message: "The request was processed but no meaningful information was found."
}
}Try It
Explore available endpoints and test them directly on x402scan.
Resources
- x402 Protocol — Protocol specification
- AIXBT x402 Examples — Implementation examples
- x402 Quickstart for Buyers — Coinbase documentation