Micropay Bazaar Documentation
A micropayment gateway for AI agents. Pay per call in SOL, discover data services, and settle on-chain โ all with one API.
Add Micropay to your payment gateway
Monetize your API. Register it in the Bazaar, set a price, and get paid in SOL every time an AI agent calls it.
Start integratingUse Micropay API to access other APIs
Pay for 26 data services โ stocks, weather, NLP, search โ with micro SOL payments. No subscriptions, no rate limits.
Start integrating26 data services across 11 categories โ weather, finance, crypto, NLP, news, sports, travel, and more. Each costs fractions of a cent in SOL. View full catalog ↓
Authentication
Pass your API key as a Bearer token in the Authorization header.
HeaderAuthorization: Bearer mp_live_demo_key
mp_live_demo_key โ use this for all hackathon testing.Auth requirements by endpoint
POST /api/v1/registry/registerGET /api/v1/registry/discoverGET /api/v1/registry/services/:idPOST /api/v1/chargesGET /api/v1/chargesGET /api/v1/charges/:idPOST /api/v1/chat/completionsPOST /api/v1/chat/tool-resultPOST /api/ai/chatGET /api/v1/balance/:walletGET /api/v1/transactions/:walletGET /api/v1/network/statusGET /api/v1/health401 โ Missing header{ "error": "Unauthorized: Missing or invalid Authorization header format" }
401 โ Invalid key{ "error": "Unauthorized: Invalid API Key" }
Charges
Charges represent a payment for a registry service. Create one to get an unsigned Solana transaction, then sign and broadcast it.
Create a charge
Returns an unsigned Solana transaction. The backend fetches live SOL/USD price, calculates SOL amount, looks up the developer's wallet, and builds the transaction.
feePayer.curl -X POST https://micropay.up.railway.app/api/v1/charges \ -H "Authorization: Bearer mp_live_demo_key" \ -H "Content-Type: application/json" \ -d '{ "service_id": "finance_stocks", "source_wallet": "YOUR_PHANTOM_WALLET_ADDRESS" }'
const res = await fetch('https://micropay.up.railway.app/api/v1/charges', { method: 'POST', headers: { 'Authorization': 'Bearer mp_live_demo_key', 'Content-Type': 'application/json', }, body: JSON.stringify({ service_id: 'finance_stocks', source_wallet: 'YOUR_PHANTOM_WALLET_ADDRESS', }), }); const charge = await res.json();
import requests res = requests.post( "https://micropay.up.railway.app/api/v1/charges", headers={ "Authorization": "Bearer mp_live_demo_key", "Content-Type": "application/json", }, json={ "service_id": "finance_stocks", "source_wallet": "YOUR_PHANTOM_WALLET_ADDRESS", }, ) charge = res.json()
List charges
Paginated list of all charges. Filter by wallet or status.
10, max: 100.0.curl https://micropay.up.railway.app/api/v1/charges?limit=5 \ -H "Authorization: Bearer mp_live_demo_key"
const res = await fetch('https://micropay.up.railway.app/api/v1/charges?limit=5', { headers: { 'Authorization': 'Bearer mp_live_demo_key' }, }); const data = await res.json();
import requests res = requests.get( "https://micropay.up.railway.app/api/v1/charges", headers={"Authorization": "Bearer mp_live_demo_key"}, params={"limit": 5}, ) data = res.json()
Get a charge
Retrieve full details of a single charge.
POST /api/v1/charges. Prefix: ch_.curl https://micropay.up.railway.app/api/v1/charges/ch_wb4bedrhxh1q \ -H "Authorization: Bearer mp_live_demo_key"
const res = await fetch('https://micropay.up.railway.app/api/v1/charges/ch_wb4bedrhxh1q', { headers: { 'Authorization': 'Bearer mp_live_demo_key' }, }); const charge = await res.json();
import requests res = requests.get( "https://micropay.up.railway.app/api/v1/charges/ch_wb4bedrhxh1q", headers={"Authorization": "Bearer mp_live_demo_key"}, ) charge = res.json()
Registry
The registry is the discovery index for all paid services in the Bazaar.
Register a service
See the Accept Payments guide for complete instructions and all 5 required parameters with error details.
curl -X POST https://micropay.up.railway.app/api/v1/registry/register \ -H "Authorization: Bearer mp_live_demo_key" \ -H "Content-Type: application/json" \ -d '{ "name": "My Weather API", "description": "Real-time weather data", "endpoint": "https://myapi.com/weather", "developer_wallet": "YOUR_WALLET_ADDRESS", "tags": ["weather", "forecast"] }'
const res = await fetch('https://micropay.up.railway.app/api/v1/registry/register', { method: 'POST', headers: { 'Authorization': 'Bearer mp_live_demo_key', 'Content-Type': 'application/json', }, body: JSON.stringify({ name: 'My Weather API', description: 'Real-time weather data', endpoint: 'https://myapi.com/weather', developer_wallet: 'YOUR_WALLET_ADDRESS', tags: ['weather', 'forecast'], }), }); const service = await res.json();
import requests res = requests.post( "https://micropay.up.railway.app/api/v1/registry/register", headers={ "Authorization": "Bearer mp_live_demo_key", "Content-Type": "application/json", }, json={ "name": "My Weather API", "description": "Real-time weather data", "endpoint": "https://myapi.com/weather", "developer_wallet": "YOUR_WALLET_ADDRESS", "tags": ["weather", "forecast"], }, ) service = res.json()
Discover services
Search all registered services. 26 preloaded. No auth required.
# Get all services curl https://micropay.up.railway.app/api/v1/registry/discover # Search for weather services curl "https://micropay.up.railway.app/api/v1/registry/discover?query=weather"
// Get all services const res = await fetch('https://micropay.up.railway.app/api/v1/registry/discover'); const all = await res.json(); // Search for weather services const weather = await fetch( 'https://micropay.up.railway.app/api/v1/registry/discover?query=weather' ).then(r => r.json());
import requests # Get all services all_svc = requests.get("https://micropay.up.railway.app/api/v1/registry/discover").json() # Search for weather services weather = requests.get( "https://micropay.up.railway.app/api/v1/registry/discover", params={"query": "weather"}, ).json()
Get a service
Retrieve a single service by exact ID. Returns 404 if not found.
curl https://micropay.up.railway.app/api/v1/registry/services/finance_stocksconst res = await fetch( 'https://micropay.up.railway.app/api/v1/registry/services/finance_stocks' ); const service = await res.json();
import requests service = requests.get( "https://micropay.up.railway.app/api/v1/registry/services/finance_stocks" ).json()
AI Gateway
Natural language interface to the Bazaar. The AI decides whether to answer directly or request a paid tool call. See the Access APIs guide Step 5 for the full agentic flow with code.
Chat completions
Send a natural language message. The AI decides whether to answer directly or request a paid tool call from the Bazaar.
curl -X POST https://micropay.up.railway.app/api/v1/chat/completions \ -H "Authorization: Bearer mp_live_demo_key" \ -H "Content-Type: application/json" \ -d '{ "message": "What is the current price of AAPL?", "source_wallet": "YOUR_WALLET_ADDRESS" }'
const res = await fetch('https://micropay.up.railway.app/api/v1/chat/completions', { method: 'POST', headers: { 'Authorization': 'Bearer mp_live_demo_key', 'Content-Type': 'application/json', }, body: JSON.stringify({ message: 'What is the current price of AAPL?', source_wallet: 'YOUR_WALLET_ADDRESS', }), }); const data = await res.json();
import requests res = requests.post( "https://micropay.up.railway.app/api/v1/chat/completions", headers={ "Authorization": "Bearer mp_live_demo_key", "Content-Type": "application/json", }, json={ "message": "What is the current price of AAPL?", "source_wallet": "YOUR_WALLET_ADDRESS", }, ) data = res.json()
Submit tool result
After paying for a tool call, send the real data back. AI generates a natural language answer.
conversation_id from the tool_call response.curl -X POST https://micropay.up.railway.app/api/v1/chat/tool-result \ -H "Authorization: Bearer mp_live_demo_key" \ -H "Content-Type: application/json" \ -d '{ "conversation_id": "conv_a8f2k9x1b3", "tool_result": "{\"AAPL\":{\"price\":189.42,\"change\":\"+1.2%\"}}", "service_id": "finance_stocks" }'
const res = await fetch('https://micropay.up.railway.app/api/v1/chat/tool-result', { method: 'POST', headers: { 'Authorization': 'Bearer mp_live_demo_key', 'Content-Type': 'application/json', }, body: JSON.stringify({ conversation_id: 'conv_a8f2k9x1b3', tool_result: JSON.stringify({ AAPL: { price: 189.42, change: '+1.2%' } }), service_id: 'finance_stocks', }), }); const answer = await res.json();
import requests, json res = requests.post( "https://micropay.up.railway.app/api/v1/chat/tool-result", headers={ "Authorization": "Bearer mp_live_demo_key", "Content-Type": "application/json", }, json={ "conversation_id": "conv_a8f2k9x1b3", "tool_result": json.dumps({"AAPL": {"price": 189.42, "change": "+1.2%"}}), "service_id": "finance_stocks", }, ) answer = res.json()
Direct AI chat
One-shot pass-through to OpenAI. No tools, no registry, no conversation state.
gpt-4o-mini.curl -X POST https://micropay.up.railway.app/api/ai/chat \ -H "Content-Type: application/json" \ -d '{ "message": "Explain quantum computing in one sentence", "model": "gpt-4o-mini" }'
const res = await fetch('https://micropay.up.railway.app/api/ai/chat', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ message: 'Explain quantum computing in one sentence', model: 'gpt-4o-mini', }), }); const data = await res.json();
import requests res = requests.post( "https://micropay.up.railway.app/api/ai/chat", json={ "message": "Explain quantum computing in one sentence", "model": "gpt-4o-mini", }, ) data = res.json()
Network
Public endpoints for wallet balances, transaction history, and Devnet health.
Get balance
Real-time SOL balance for any Solana wallet on Devnet.
curl https://micropay.up.railway.app/api/v1/balance/AuofYo21iiX8NQtgWBXLRFMiWfv83z2CbnhPNen6WNt5const wallet = 'AuofYo21iiX8NQtgWBXLRFMiWfv83z2CbnhPNen6WNt5'; const res = await fetch( `https://micropay.up.railway.app/api/v1/balance/${wallet}` ); const data = await res.json();
import requests wallet = "AuofYo21iiX8NQtgWBXLRFMiWfv83z2CbnhPNen6WNt5" data = requests.get(f"https://micropay.up.railway.app/api/v1/balance/{wallet}").json()
Get transactions
Last 5 Solana transactions for a wallet. Each has a signature verifiable on Solana Explorer.
curl https://micropay.up.railway.app/api/v1/transactions/AuofYo21iiX8NQtgWBXLRFMiWfv83z2CbnhPNen6WNt5const wallet = 'AuofYo21iiX8NQtgWBXLRFMiWfv83z2CbnhPNen6WNt5'; const res = await fetch( `https://micropay.up.railway.app/api/v1/transactions/${wallet}` ); const txns = await res.json();
import requests wallet = "AuofYo21iiX8NQtgWBXLRFMiWfv83z2CbnhPNen6WNt5" txns = requests.get(f"https://micropay.up.railway.app/api/v1/transactions/{wallet}").json()
Network status
Devnet status โ slot height, block height, SOL price, RPC health.
curl https://micropay.up.railway.app/api/v1/network/statusconst res = await fetch('https://micropay.up.railway.app/api/v1/network/status'); const status = await res.json();
import requests status = requests.get("https://micropay.up.railway.app/api/v1/network/status").json()
Health check
Returns 200 if the server is up.
curl https://micropay.up.railway.app/api/v1/healthconst res = await fetch('https://micropay.up.railway.app/api/v1/health'); const data = await res.json(); // { status: "ok", version: "1.0.0" }
import requests data = requests.get("https://micropay.up.railway.app/api/v1/health").json() # {"status": "ok", "version": "1.0.0"}
Service catalog
26 preloaded services. Click any to see details. Pricing is by category โ the backend auto-resolves the price when you create a charge.
Description: Real-time temperature, humidity, and precipitation data from Open-Meteo for any city worldwide.
Endpoint: GET /tools/weather/openmeteo
Description: Real-time weather including wind speed, visibility, and UV index via OpenWeather API.
Endpoint: GET /tools/weather/openweather
Description: Extended 7-day forecast with daily highs, lows, and precipitation probability.
Endpoint: GET /tools/weather/forecast
Description: Live equity prices, volume, and market cap from NYSE and NASDAQ.
Endpoint: GET /tools/finance/stocks
Description: Live SOL/USD, BTC/USD, ETH/USD price feeds with 1-minute granularity.
Endpoint: GET /tools/finance/crypto
Description: Real-time foreign exchange rates for 170+ currency pairs.
Endpoint: GET /tools/finance/forex
Description: Analyze sentiment of any text. Returns positive, negative, or neutral with confidence.
Endpoint: GET /tools/nlp/sentiment
Description: Summarize long articles into concise key points.
Endpoint: GET /tools/nlp/summarize
Description: Translate between 100+ languages with auto-detection.
Endpoint: GET /tools/nlp/translate
Description: Extract named entities (people, places, orgs, dates) from text.
Endpoint: GET /tools/nlp/extract
Description: Search recipes by ingredient, cuisine, or dietary restriction.
Endpoint: GET /tools/food/recipes
Description: Nutritional info including macros, vitamins, and minerals.
Endpoint: GET /tools/food/nutrition
Description: Check SOL, ETH, and major token balances across chains.
Endpoint: GET /tools/blockchain/wallet
Description: Metadata, ownership history, and floor price for any NFT.
Endpoint: GET /tools/blockchain/nft
Description: TVL, APY, and pool data for DeFi protocols on Solana and Ethereum.
Endpoint: GET /tools/blockchain/defi
Description: Breaking news across 50+ categories and 30+ countries.
Endpoint: GET /tools/news/breaking
Description: Search millions of articles by keyword, date range, and source.
Endpoint: GET /tools/news/search
Description: Live scores for NFL, NBA, MLB, NHL, Premier League.
Endpoint: GET /tools/sports/scores
Description: Historical and season statistics for players and teams.
Endpoint: GET /tools/sports/stats
Description: Population, income, education data for any US zip code.
Endpoint: GET /tools/data/demographics
Description: Stars, forks, contributors, and language breakdown for any repo.
Endpoint: GET /tools/data/github
Description: Top 10 search results with titles, URLs, and snippets.
Endpoint: GET /tools/search/web
Description: Image search with size, color, and license filters.
Endpoint: GET /tools/search/images
Description: Flight search with real-time pricing and availability.
Endpoint: GET /tools/travel/flights
Description: Hotel search by city, dates, and guest count.
Endpoint: GET /tools/travel/hotels
Description: GPT-4o chat completions. Pay per request, no subscription.
Endpoint: POST /tools/openai-chat
Tech Stack
How Micropay Bazaar is built under the hood.
| Component | Technology | Why |
|---|---|---|
| Runtime | Node.js + Express.js | Lightweight, fast JSON API server with middleware ecosystem |
| Blockchain | @solana/web3.js (Devnet) | Build unsigned transactions, query balances, parse on-chain data |
| Price Oracle | CoinGecko API | Live SOL/USD conversion with 60-second cache and hardcoded fallback |
| AI Gateway | OpenAI GPT-4o-mini | Function calling for tool selection, conversation context for multi-turn |
| Data Store | In-memory (Map) | Charges, registry, conversations, and idempotency โ resets on restart |
| Deployment | Railway | Auto-deploy from GitHub, HTTPS, environment variable management |
| Logging | Morgan | HTTP request logging in dev format |
| Wallet | Phantom (client-side) | Transaction signing and broadcasting via browser extension |
Architecture
Errors
All errors return a consistent JSON object.
HTTP status codes
| Code | Meaning |
|---|---|
200 | Success |
201 | Created โ service registered |
400 | Bad Request โ missing or invalid parameters |
401 | Unauthorized โ missing or invalid API key |
404 | Not Found โ resource doesn't exist |
500 | Internal Server Error |
502 | Gateway Error โ upstream AI down, retry |