The First x402 Payment API
Pay per request with USDC. No subscriptions, no credit cards. Just instant micropayments for AI agents and developers.
Why x402?
⚡ Instant Payments
Pay per request, no subscriptions. Perfect for AI agents making autonomous payments.
💰 Micropayments
Pay as little as $0.004 per request. QR code endpoint free. No minimums, no commitments.
🤖 AI Agent Ready
Native x402 support means AI agents can pay automatically without human intervention.
🌐 No Account Required
Just pay and use. No registration, no credit cards, no KYC.
API Endpoints
Market Data
GET
/v1/market/price/:symbol
$0.005
GET
/v1/market/ohlcv/:symbol
$0.005
GET
/v1/market/trending
$0.002
AI Tools
POST
/v1/ai/summarize
$0.01
POST
/v1/ai/sentiment
$0.01
POST
/v1/ai/translate
$0.02
POST
/v1/ai/code-review
$0.05
Crypto Analytics
GET
/v1/crypto/wallet-score/:address
$0.05
GET
/v1/crypto/token-analysis/:address
$0.10
GET
/v1/crypto/whale-alerts
$0.02
Utilities
POST
/v1/util/qr-code
$0.005
POST
/v1/util/screenshot
$0.02
POST
/v1/util/pdf-generate
$0.03
Example Usage
// 1. Make request (receives 402)
const response = await fetch('https://api.asterpay.io/v1/market/price/BTC');
// Note: Replace with your actual API URL when deployed
// 2. Parse 402 response
const payment = await response.json();
// {
// "x402Version": 1,
// "scheme": "exact",
// "network": "base-sepolia",
// "payTo": "0x...",
// "maxAmountRequired": "5000", // $0.005 in USDC (6 decimals)
// ...
// }
// 3. Create payment transaction
const tx = await wallet.sendTransaction({
to: payment.payTo,
value: payment.maxAmountRequired,
// ... transaction details
});
// 4. Retry with payment proof
const paidResponse = await fetch('https://api.asterpay.io/v1/market/price/BTC', {
headers: {
'X-PAYMENT': JSON.stringify({
scheme: 'exact',
network: 'base-sepolia',
payload: Buffer.from(JSON.stringify({
txHash: tx.hash,
amount: payment.maxAmountRequired,
timestamp: new Date().toISOString()
})).toString('base64')
})
}
});
// 5. Get data
const data = await paidResponse.json();