Platform Strategies Docs Blog About Launch App

API Integration

Complete API documentation for integrating with PoIPoE's MEV trading platform. Learn authentication, endpoints, SDKs, and best practices for building your trading bots.

Authentication

All PoIPoE API requests require authentication using API keys. API keys can be generated and managed through your dashboard.

API Key Generation

1

Create Account

Sign up for a PoIPoE account and complete identity verification

2

Navigate to API Keys

Go to Settings → API Keys in your dashboard

3

Generate Key

Create a new API key with appropriate permissions

4

Store Securely

Store your API key in a secure environment variable

API Authentication
# Using Authorization header
curl -H "Authorization: Bearer pk_live_abc123def456" \
     https://api.poipoe.com/v1/opportunities

# Using X-API-Key header
curl -H "X-API-Key: pk_live_abc123def456" \
     https://api.poipoe.com/v1/opportunities

# Using query parameter (not recommended for production)
curl "https://api.poipoe.com/v1/opportunities?api_key=pk_live_abc123def456"
JavaScript/Node.js SDK
// Initialize PoIPoE client
const PoIPoE = require('@poipoe/sdk');

const client = new PoIPoE({
    apiKey: process.env.POIPOE_API_KEY,
    environment: 'production' // or 'sandbox'
});

// Alternative: Using API key directly
const client = new PoIPoE('pk_live_abc123def456');

// Test connection
async function testConnection() {
    try {
        const status = await client.status();
        console.log('API Status:', status);
    } catch (error) {
        console.error('Authentication failed:', error.message);
    }
}
Security Best Practices: Never expose your API key in client-side code. Use environment variables and rotate your keys regularly. Consider using different keys for different environments.

Base URL & Endpoints

All API endpoints follow RESTful conventions and are versioned. Use the appropriate base URL for your environment.

Environment URLs

Production

https://api.poipoe.com/v1/

Sandbox

https://sandbox-api.poipoe.com/v1/

Development

https://dev-api.poipoe.com/v1/

Endpoint Structure
# Base endpoint pattern
GET /v1/{resource}
POST /v1/{resource}
PUT /v1/{resource}/{id}
DELETE /v1/{resource}/{id}

# Examples
GET /v1/opportunities          # Get MEV opportunities
GET /v1/portfolio             # Get portfolio summary
POST /v1/execute              # Execute a strategy
GET /v1/analytics/performance # Get performance metrics
GET /v1/auth/status           # Get API key status

# With parameters
GET /v1/opportunities?strategy=arbitrage&min_profit=1000
GET /v1/portfolio?currency=ETH&include_history=true
GET /v1/analytics/performance?period=24h&strategy=all

Rate Limits

API rate limits ensure fair usage and platform stability. Different endpoints have different rate limits based on their impact.

Rate Limit Tiers

Standard Tier

100 requests per minute, 10,000 per day

Professional Tier

500 requests per minute, 50,000 per day

Enterprise Tier

2,000 requests per minute, 200,000 per day

Rate Limit Headers
# Response headers show rate limit info
HTTP/1.1 200 OK
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1635780000
X-RateLimit-Window: 60

# Rate limit exceeded response
HTTP/1.1 429 Too Many Requests
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1635780060
Retry-After: 45

{
    "error": "rate_limit_exceeded",
    "message": "Rate limit exceeded. Try again in 45 seconds.",
    "retry_after": 45
}

Error Handling

PoIPoE API uses standard HTTP status codes and returns detailed error information to help you handle issues gracefully.

Error Response Format

Standard Error Response
{
    "error": "invalid_request",
    "message": "Missing required parameter: strategy",
    "details": {
        "parameter": "strategy",
        "provided": null,
        "expected": "arbitrage|liquidation|sandwich"
    },
    "request_id": "req_abc123def456",
    "timestamp": "2025-11-07T20:04:39Z"
}

Common Error Codes

401 Unauthorized

Invalid or missing API key. Check your authentication headers.

429 Too Many Requests

Rate limit exceeded. Use Retry-After header to retry.

500 Internal Server Error

Server error. Retry with exponential backoff.

Opportunities Endpoint

Get real-time MEV opportunities across all supported strategies. Filter by strategy type, minimum profit, and other criteria.

Get Opportunities
# Get all opportunities
GET /v1/opportunities

# Filter by strategy
GET /v1/opportunities?strategy=arbitrage

# Filter with multiple parameters
GET /v1/opportunities?strategy=liquidation&min_profit=1000&networks=ethereum,polygon

# Response
{
    "opportunities": [
        {
            "id": "opp_abc123",
            "strategy": "arbitrage",
            "networks": ["ethereum"],
            "tokens": ["ETH", "USDC"],
            "estimated_profit": 1500,
            "profit_after_gas": 1200,
            "probability": 0.85,
            "dexes": ["uniswap", "sushiswap"],
            "created_at": "2025-11-07T20:00:00Z",
            "expires_at": "2025-11-07T20:05:00Z"
        }
    ],
    "pagination": {
        "total": 15,
        "page": 1,
        "per_page": 10,
        "has_more": true
    }
}
JavaScript SDK Usage
// Get opportunities with filters
const opportunities = await client.opportunities.list({
    strategy: 'arbitrage',
    min_profit: 1000,
    networks: ['ethereum', 'polygon'],
    limit: 50
});

// Subscribe to real-time opportunities
const subscription = client.opportunities.subscribe({
    strategy: ['arbitrage', 'liquidation'],
    min_profit: 500
});

subscription.on('opportunity', (opportunity) => {
    console.log('New opportunity:', opportunity);
    
    // Auto-execute if profitable
    if (opportunity.profit_after_gas > 100) {
        client.execution.execute({
            opportunity_id: opportunity.id,
            amount: opportunity.optimal_amount
        });
    }
});

subscription.on('error', (error) => {
    console.error('Subscription error:', error);
});

// Unsubscribe when done
subscription.unsubscribe();

Execution Endpoint

Execute MEV strategies through the API. Strategies are executed atomically with gas optimization and retry logic.

Execute Strategy
# Execute opportunity
POST /v1/execute
Content-Type: application/json

{
    "opportunity_id": "opp_abc123",
    "amount": 10000,
    "max_slippage": 0.005,
    "gas_price_multiplier": 1.2
}

# Response
{
    "execution_id": "exec_xyz789",
    "status": "pending",
    "estimated_cost": 50,
    "estimated_profit": 1200,
    "transaction_hash": "0x123...",
    "created_at": "2025-11-07T20:04:39Z"
}

# Check execution status
GET /v1/execution/exec_xyz789

{
    "execution_id": "exec_xyz789",
    "status": "success",
    "actual_cost": 45,
    "actual_profit": 1255,
    "transaction_hash": "0x123...",
    "confirmed_at": "2025-11-07T20:05:12Z"
}
Execution with Custom Parameters
// Execute with custom strategy
const execution = await client.execution.execute({
    strategy: 'arbitrage',
    networks: ['ethereum'],
    tokens: ['ETH', 'USDC'],
    amount: 50000,
    max_slippage: 0.003,
    gas_price_strategy: 'optimal', // 'slow', 'standard', 'fast', 'optimal'
    max_gas_price: 200000000000, // 200 gwei
    auto_retry: true,
    retry_attempts: 3
});

console.log('Execution started:', execution.execution_id);

// Monitor execution
const monitor = client.execution.monitor(execution.execution_id);

monitor.on('status', (status) => {
    console.log('Status update:', status.status, status.message);
});

monitor.on('completed', (result) => {
    if (result.status === 'success') {
        console.log('Executed successfully!');
        console.log('Profit:', result.actual_profit, 'Cost:', result.actual_cost);
    } else {
        console.log('Execution failed:', result.error_message);
    }
});

monitor.on('error', (error) => {
    console.error('Execution error:', error);
});

Portfolio Endpoint

Monitor your trading performance, current positions, and portfolio metrics across all strategies and networks.

Get Portfolio Summary
# Get portfolio overview
GET /v1/portfolio

# Get detailed portfolio with history
GET /v1/portfolio?include_history=true&period=30d¤cy=ETH

# Response
{
    "summary": {
        "total_balance_eth": 150.5,
        "total_balance_usd": 150000,
        "daily_pnl": 1250,
        "monthly_pnl": 15800,
        "total_trades": 1247,
        "win_rate": 0.67,
        "avg_profit": 47.8,
        "sharpe_ratio": 2.3,
        "max_drawdown": 0.05
    },
    "positions": [
        {
            "strategy": "arbitrage",
            "network": "ethereum",
            "token_a": "ETH",
            "token_b": "USDC",
            "amount_a": 100,
            "amount_b": 180000,
            "unrealized_pnl": 250,
            "unrealized_pnl_percent": 0.17
        }
    ],
    "recent_trades": [
        {
            "execution_id": "exec_xyz789",
            "strategy": "arbitrage",
            "profit": 1255,
            "cost": 45,
            "executed_at": "2025-11-07T20:05:12Z"
        }
    ]
}

Analytics Endpoint

Access detailed analytics and performance metrics for strategy optimization and performance tracking.

Performance Analytics
# Get performance metrics
GET /v1/analytics/performance?period=7d&group_by=strategy

# Response
{
    "period": "7d",
    "strategies": {
        "arbitrage": {
            "total_profit": 15800,
            "total_trades": 245,
            "win_rate": 0.72,
            "avg_profit": 64.5,
            "max_profit": 2850,
            "min_profit": -120,
            "sharpe_ratio": 2.8,
            "max_drawdown": 0.03,
            "profit_factor": 3.2
        },
        "liquidation": {
            "total_profit": 12300,
            "total_trades": 89,
            "win_rate": 0.91,
            "avg_profit": 138.2,
            "max_profit": 2100,
            "min_profit": -50
        }
    },
    "overall": {
        "total_profit": 28100,
        "total_trades": 334,
        "avg_profit": 84.1,
        "sharpe_ratio": 2.4,
        "max_drawdown": 0.04
    }
}

JavaScript/Node.js SDK

Official JavaScript SDK for building MEV trading applications. Includes TypeScript support and comprehensive error handling.

Installation

Install SDK
# Using npm
npm install @poipoe/sdk

# Using yarn
yarn add @poipoe/sdk

# Using pnpm
pnpm add @poipoe/sdk

Complete Example

Complete Trading Bot Example
const PoIPoE = require('@poipoe/sdk');
const WebSocket = require('ws');

class PoIPoETradingBot {
    constructor(config) {
        this.client = new PoIPoE({
            apiKey: config.apiKey,
            environment: config.environment || 'production'
        });
        
        this.config = {
            min_profit: config.min_profit || 100,
            max_position_size: config.max_position_size || 50000,
            risk_per_trade: config.risk_per_trade || 0.02,
            strategies: config.strategies || ['arbitrage', 'liquidation']
        };
        
        this.portfolio = {
            total_balance: config.starting_balance,
            used_balance: 0,
            available_balance: config.starting_balance
        };
    }

    async start() {
        try {
            console.log('Starting PoIPoE Trading Bot...');
            
            // Test connection
            const status = await this.client.status();
            console.log('API Status:', status.version);
            
            // Start monitoring opportunities
            await this.startOpportunityMonitoring();
            
            // Start periodic portfolio updates
            this.startPortfolioMonitor();
            
        } catch (error) {
            console.error('Failed to start bot:', error.message);
            process.exit(1);
        }
    }

    async startOpportunityMonitoring() {
        const subscription = this.client.opportunities.subscribe({
            strategy: this.config.strategies,
            min_profit: this.config.min_profit
        });

        subscription.on('opportunity', (opportunity) => {
            this.handleOpportunity(opportunity);
        });

        subscription.on('error', (error) => {
            console.error('Opportunity stream error:', error);
        });

        console.log('Monitoring MEV opportunities...');
    }

    async handleOpportunity(opportunity) {
        try {
            console.log(`New ${opportunity.strategy} opportunity:`, {
                id: opportunity.id,
                profit: opportunity.estimated_profit,
                probability: opportunity.probability
            });

            // Skip low probability opportunities
            if (opportunity.probability < 0.7) {
                console.log('Skipping low probability opportunity');
                return;
            }

            // Calculate position size
            const position_size = this.calculatePositionSize(opportunity);
            if (position_size > this.portfolio.available_balance) {
                console.log('Insufficient balance for opportunity');
                return;
            }

            // Execute opportunity
            const execution = await this.client.execution.execute({
                opportunity_id: opportunity.id,
                amount: position_size,
                max_slippage: 0.005,
                auto_retry: true
            });

            console.log('Execution started:', execution.execution_id);

            // Monitor execution
            this.monitorExecution(execution.execution_id);

        } catch (error) {
            console.error('Error handling opportunity:', error);
        }
    }

    calculatePositionSize(opportunity) {
        // Risk-based position sizing
        const risk_amount = this.portfolio.total_balance * this.config.risk_per_trade;
        const max_size = Math.min(
            risk_amount / opportunity.risk_factor,
            this.config.max_position_size,
            this.portfolio.available_balance
        );

        return Math.floor(max_size);
    }

    async monitorExecution(execution_id) {
        const monitor = this.client.execution.monitor(execution_id);
        
        monitor.on('status', (status) => {
            console.log(`Execution ${execution_id} status:`, status.status);
        });

        monitor.on('completed', (result) => {
            if (result.status === 'success') {
                console.log(`✅ Execution successful!`);
                console.log(`   Profit: ${result.actual_profit} (after ${result.actual_cost} gas)`);
                
                // Update portfolio
                this.updatePortfolio(result);
            } else {
                console.log(`❌ Execution failed:`, result.error_message);
            }
        });

        monitor.on('error', (error) => {
            console.error(`Execution ${execution_id} error:`, error);
        });
    }

    updatePortfolio(execution_result) {
        this.portfolio.used_balance -= execution_result.amount || 0;
        this.portfolio.available_balance += execution_result.actual_profit;
        this.portfolio.total_balance += execution_result.actual_profit - execution_result.actual_cost;
    }

    startPortfolioMonitor() {
        setInterval(async () => {
            try {
                const portfolio = await this.client.portfolio.get();
                this.portfolio = {
                    total_balance: portfolio.summary.total_balance_eth,
                    available_balance: portfolio.summary.total_balance_eth * 0.8, // Keep 20% reserve
                    used_balance: portfolio.summary.total_balance_eth * 0.2
                };
                
                console.log('Portfolio Update:', {
                    total: this.portfolio.total_balance,
                    available: this.portfolio.available_balance
                });
            } catch (error) {
                console.error('Portfolio update error:', error);
            }
        }, 30000); // Every 30 seconds
    }

    stop() {
        console.log('Stopping PoIPoE Trading Bot...');
        process.exit(0);
    }
}

// Usage
const bot = new PoIPoETradingBot({
    apiKey: process.env.POIPOE_API_KEY,
    environment: 'production',
    starting_balance: 10, // ETH
    min_profit: 100,
    max_position_size: 5000,
    risk_per_trade: 0.02,
    strategies: ['arbitrage', 'liquidation']
});

bot.start();

// Graceful shutdown
process.on('SIGINT', () => bot.stop());
process.on('SIGTERM', () => bot.stop());

Python SDK

Official Python SDK for data analysis, backtesting, and integration with Python-based trading systems.

Python SDK Example
# pip install poipoe-sdk
from poipoe import PoIPoE
import asyncio

class PoIPoEAnalysis:
    def __init__(self, api_key):
        self.client = PoIPoE(api_key=api_key)
    
    async def get_opportunity_stats(self, days=30):
        """Get statistical analysis of opportunities"""
        opportunities = await self.client.opportunities.list(
            min_profit=100,
            limit=1000
        )
        
        # Calculate statistics
        profits = [opp.estimated_profit for opp in opportunities]
        probabilities = [opp.probability for opp in opportunities]
        
        return {
            'total_opportunities': len(opportunities),
            'avg_profit': sum(profits) / len(profits),
            'avg_probability': sum(probabilities) / len(probabilities),
            'high_profit_opportunities': len([p for p in profits if p > 1000])
        }
    
    async def backtest_strategy(self, strategy, start_date, end_date):
        """Backtest a specific strategy over a time period"""
        return await self.client.analytics.backtest({
            'strategy': strategy,
            'start_date': start_date,
            'end_date': end_date,
            'initial_balance': 10.0  # ETH
        })

# Usage
async def main():
    analysis = PoIPoEAnalysis('your-api-key')
    
    # Get opportunity statistics
    stats = await analysis.get_opportunity_stats(days=30)
    print(f"Found {stats['total_opportunities']} opportunities")
    print(f"Average profit: {stats['avg_profit']:.2f}")
    
    # Backtest arbitrage strategy
    backtest = await analysis.backtest_strategy(
        'arbitrage', 
        '2025-10-01', 
        '2025-11-01'
    )
    
    print(f"Backtest results: {backtest}")

if __name__ == '__main__':
    asyncio.run(main())

Web3 Library Integration

PoIPoE API integrates with popular Web3 libraries for direct blockchain interaction and advanced transaction handling.

Ethers.js Integration
// Using PoIPoE with Ethers.js
const { ethers } = require('ethers');
const PoIPoE = require('@poipoe/sdk');

async function integratedTrading() {
    // Initialize providers
    const provider = new ethers.JsonRpcProvider(process.env.RPC_URL);
    const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider);
    
    // Initialize PoIPoE client
    const poipoe = new PoIPoE({
        apiKey: process.env.POIPOE_API_KEY
    });
    
    // Get arbitrage opportunity
    const opportunity = await poipoe.opportunities.list({
        strategy: 'arbitrage',
        min_profit: 1000
    });
    
    if (opportunity.length === 0) {
        console.log('No profitable opportunities found');
        return;
    }
    
    const target = opportunity[0];
    console.log('Executing arbitrage:', target);
    
    // Use PoIPoE for opportunity detection and execution planning
    const execution_plan = await poipoe.execution.plan({
        opportunity_id: target.id,
        wallet_address: wallet.address
    });
    
    // Execute using native Web3 transaction
    const tx = await wallet.sendTransaction({
        to: execution_plan.contract_address,
        data: execution_plan.call_data,
        gasLimit: execution_plan.gas_estimate,
        gasPrice: execution_plan.optimal_gas_price
    });
    
    console.log('Transaction sent:', tx.hash);
    
    // Wait for confirmation
    const receipt = await tx.wait();
    console.log('Transaction confirmed:', receipt.status);
    
    // Record results with PoIPoE
    await poipoe.analytics.record({
        transaction_hash: tx.hash,
        strategy: target.strategy,
        success: receipt.status === 1
    });
}