RelAI Documentation
Everything you need to know about using RelAI for API monetization
RelAI enables instant API monetization using the x402 protocol. Accept micropayments in cryptocurrency for every API call, with automatic payment verification and settlement.
Whether you're an API provider looking to monetize your services or a developer seeking pay-per-use APIs, RelAI makes it simple and secure.
Quick Start
Get started with RelAI in under 5 minutes
For API Providers
1. Upload Your API
Upload your OpenAPI specification to get started
2. Set Pricing
Configure pricing per API call
3. Publish
Make your API available on the marketplace
For API Consumers
1. Browse APIs
Find APIs in our marketplace
2. Make Requests
Pay per request with automatic settlement
3. Start Building
Integrate APIs into your applications
Upload Your API
To monetize your API with RelAI, start by uploading your OpenAPI specification:
- Go to your Dashboard
- Click "Add New API"
- Upload your OpenAPI/Swagger specification file (JSON or YAML)
- RelAI will automatically parse your endpoints and parameters
Tip: Make sure your OpenAPI spec is valid and includes all necessary endpoint descriptions for the best marketplace presentation.
Set Pricing
Configure pricing for your API endpoints:
- Set price per API call in USD or cryptocurrency
- Different endpoints can have different prices
- Choose between exact pricing or max amount
- Select payment facilitator (PayAI, Dexter, RelAI)
// Example pricing configuration
{
"endpoint": "/api/data",
"price": "$0.01",
"network": "solana",
"facilitator": "payai"
}Publish API
Once configured, publish your API to the marketplace:
- Review your API configuration
- Set visibility (public or private)
- Add description and documentation
- Click "Publish" to make it available
That's it! RelAI handles all x402 payment processing automatically. No need to write backend code or manage blockchain transactions.
Integration Guide
For API Providers
Using RelAI Platform:
- Create API on RelAI:
- Go to Dashboard
- Click "Add New API"
- Select your network (Solana, Base, SKALE Base)
- Choose payment facilitator (automatically selected for SKALE Base)
- Set your pricing (e.g., $0.01 per call)
- Configure your API:
- Upload OpenAPI specification
- Set your payment wallet address
- Publish to marketplace
- That's it! RelAI handles all x402 v2 payment processing and gas sponsoring automatically.
Browse APIs
Discover APIs in the RelAI marketplace:
- Browse by category or search
- View pricing and documentation
- Test endpoints before committing
Manage Payments
Track your API usage and payments:
- View transaction history in Dashboard
- Export payment reports
x402 Protocol
RelAI is built on the x402 protocol, an open standard for HTTP payment requests:
- HTTP 402 status code for payment required
- Standardized payment headers and responses
- Support for multiple blockchains (Solana, Base, SKALE)
- Facilitator-based payment verification
Authentication
RelAI supports multiple authentication methods:
- Wallet-based authentication
- API keys for server-to-server
- OAuth 2.0 integration
- Custom authentication schemes
Security
Security best practices:
- All payments verified on-chain
- HTTPS required for all API calls
- Rate limiting and DDoS protection
- Regular security audits
Webhooks
RelAI supports webhooks to notify your server about payment events in real-time. When a payment is successfully processed, RelAI sends a POST request to your configured webhook URL.
Webhook Setup
- Go to your API Dashboard
- Open Settings tab for your API
- Find the Webhook URL field
- Enter your webhook endpoint URL (must be HTTPS in production)
- Save changes
Tip: Use services like webhook.site or ngrok for testing webhooks locally.
Webhook Payload
When a payment is completed, RelAI sends a POST request with the following JSON payload:
{
"event": "payment.completed",
"apiId": "1234567890abc",
"timestamp": "2026-02-05T21:44:00.000Z",
"transaction": "0x1234...abcd",
"network": "solana",
"amount": "0.01",
"payer": "D1rUgfkappgDW4nB...",
"recipient": "7xKXtg2CW87d97T...",
"endpoint": "/api/generate",
"method": "POST"
}Payload Fields
| Field | Description |
|---|---|
| event | Event type (currently: payment.completed) |
| apiId | Your API identifier |
| timestamp | ISO 8601 timestamp |
| transaction | Transaction hash/signature |
| network | Network used (solana, skale-base, avalanche) |
| amount | Payment amount in USD |
| payer | Wallet address of the payer |
| recipient | Merchant wallet address |
| endpoint | API endpoint that was called |
| method | HTTP method (GET, POST, etc.) |
Header: X-Webhook-Event: payment.completed
Example Webhook Handler
Node.js / Express example:
app.post('/webhook', express.json(), (req, res) => {
const event = req.headers['x-webhook-event'];
if (event === 'payment.completed') {
const { apiId, transaction, amount, payer, network } = req.body;
console.log(`Payment received: ${amount} USD from ${payer}`);
console.log(`Transaction: ${transaction} on ${network}`);
// Your business logic here
// e.g., grant access, update database, send confirmation
}
// Always respond with 200 OK
res.status(200).json({ received: true });
});Best practices: Respond within 10 seconds, use transaction as idempotency key, process asynchronously for heavy operations.
© 2026 RelAI. Monetize your APIs with x402 Protocol.