API Integration
Overview
Integrate X804 reward data into your own applications using our API and WebSocket connections.
PumpPortal Integration
WebSocket Connection
Monitor trades in real-time:
const CONTRACT_ADDRESS = '...';
// Connect to PumpPortal
const ws = new WebSocket('wss://pumpportal.fun/api/data');
ws.onopen = () => {
console.log('Connected to PumpPortal');
// Subscribe to token
ws.send(JSON.stringify({
method: 'subscribe',
keys: [CONTRACT_ADDRESS]
}));
};
ws.onmessage = (event) => {
const trade = JSON.parse(event.data);
console.log('Trade detected:', {
type: trade.txType,
amount: trade.tokenAmount,
sol: trade.solAmount,
wallet: trade.signature.substring(0, 8)
});
};
ws.onerror = (error) => {
console.error('WebSocket error:', error);
};Trade Data Structure
X804 API Endpoints
Get Recent Rewards
Parameters:
limit(optional): Number of results (default: 50, max: 100)offset(optional): Pagination offset
Response:
Get Statistics
Response:
Get Wallet Rewards
Response:
Code Examples
React Integration
Node.js Backend
Python Integration
Rate Limits
API: 100 requests per minute
WebSocket: No limit on messages
Historical data: Last 30 days
Best Practices
Handle Reconnections: WebSocket connections may drop
Cache Data: Store historical data locally
Error Handling: Always handle API errors gracefully
Rate Limiting: Respect API rate limits
Webhook Alternative: Contact us for webhook integration
Support
Need help integrating?
Join our Telegram: t.me/x804
Check examples: GitHub
Read docs: x804.gitbook.io
Build with X804! Create your own reward tracking applications.
Last updated

