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 |
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 packages to wrap your HTTP client with automatic payment handling:
npm install x402-fetch viemimport { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'
const account = privateKeyToAccount(process.env.WALLET_PRIVATE_KEY)
const fetchWithPayment = wrapFetchWithPayment(fetch, account)
const response = await fetchWithPayment(
'https://api.aixbt.tech/x402/v1/agents/indigo',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
messages: [
{ role: 'user', content: 'What narratives are gaining traction?' },
],
}),
},
)For complete examples using both fetch and axios, see the AIXBT x402 Examples repository.
Automatic Refunds
If a request fails to return meaningful results, you receive an automatic on-chain refund. This applies to:
- 404 errors — No information found for your query
- 500 errors — Server encountered an internal error
The refund response includes a transaction hash you can verify on-chain:
{
status: 404,
error: "No information found",
data: {
message: "The request was processed but no meaningful information was found.",
refund: {
attempted: true,
successful: true,
transactionHash: "0x...",
reason: "No information 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