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

  1. Handle Reconnections: WebSocket connections may drop

  2. Cache Data: Store historical data locally

  3. Error Handling: Always handle API errors gracefully

  4. Rate Limiting: Respect API rate limits

  5. Webhook Alternative: Contact us for webhook integration

Support

Need help integrating?


Build with X804! Create your own reward tracking applications.

Last updated