API Documentation

Welcome to the Switcher API. This API enables lightning-fast arbitrage trading on Solana by scanning multiple DEX pools in real-time for profitable opportunities.

Authentication

All API endpoints require authentication using an API key. You can generate API keys from your Account page.

Getting an API Key

  1. Sign in to your account
  2. Navigate to the Account page
  3. Click "Generate New Key" to create an API key
  4. Copy your API key and store it securely

Using Your API Key

Include your API key in requests using either method:

Option 1: X-API-Key Header (Recommended)

curl -X POST https://api.switcher.click/arbitrage/find \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key_here" \
  -d '{"tokenAddress": "...", "privateKey": "..."}'

Option 2: Request Body

{
  "apiKey": "your_api_key_here",
  "tokenAddress": "...",
  "privateKey": "..."
}

Rate Limits

  • /wallet/balance20 requests/minute
  • /wallet/send10 requests/minute
  • /arbitrage/find5 requests/minute
  • /arbitrage/execute3 requests/minute

Base URL

https://api.switcher.click

Supported Pools

Switcher currently supports arbitrage trading across the following DEX pools on Solana.

Raydium

Raydium

Automated Market Maker (AMM) on Solana

More DEX integrations coming soon. Stay tuned for updates on additional pool support.

Health Check

GET/health

Check if the API is running.

Test this endpoint

Response

{
  "status": "healthy",
  "timestamp": "2024-01-01T12:00:00.000Z",
  "version": "1.0.0"
}

Check Wallet Balance

POST/wallet/balance🔒 Requires API Key

Get SOL balance for a wallet.

Test this endpoint

Request Body

// Headers
X-API-Key: your_api_key_here

// Body
{
  "privateKey": "your_base58_private_key_here"
}

Response

{
  "success": true,
  "data": {
    "publicKey": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
    "balance": 1.2345,
    "balanceFormatted": "1.2345 SOL"
  }
}

Find Arbitrage Opportunities

POST/arbitrage/find🔒 Requires API Key

Find arbitrage opportunities for a specific token.

Test this endpoint

Request Body

// Headers
X-API-Key: your_api_key_here

// Body
{
  "tokenAddress": "EDcdVtzW4HG7Xtg5yH3RbzMEyfudg63RmZgdXpQFUk3s",
  "privateKey": "your_base58_private_key_here"
}

Response

{
  "success": true,
  "data": {
    "tokenAddress": "EDcdVtzW4HG7Xtg5yH3RbzMEyfudg63RmZgdXpQFUk3s",
    "poolsAnalyzed": 45,
    "validPriceCalculations": 32,
    "opportunities": [
      {
        "buyPool": {
          "id": "pool_id_1",
          "pair": "USDC",
          "price": 0.00012345,
          "tvl": 125000
        },
        "sellPool": {
          "id": "pool_id_2",
          "pair": "SOL",
          "price": 0.00012567,
          "tvl": 89000
        },
        "profitPercent": 1.29,
        "totalProfit": 0.0129
      }
    ]
  }
}

Execute Arbitrage Trade

POST/arbitrage/execute🔒 Requires API Key

Execute an arbitrage trade for a specific opportunity.

Test this endpoint

Request Body

// Headers
X-API-Key: your_api_key_here

// Body
{
  "tokenAddress": "EDcdVtzW4HG7Xtg5yH3RbzMEyfudg63RmZgdXpQFUk3s",
  "privateKey": "your_base58_private_key_here",
  "opportunityIndex": 0
}

Response

{
  "success": true,
  "data": {
    "execution": {
      "buyTxId": "transaction_hash_1",
      "sellTxId": "transaction_hash_2",
      "profit": 0.0129,
      "profitUSD": 3.10
    }
  }
}

Send SOL

POST/wallet/send🔒 Requires API Key

Send SOL from one wallet to another.

Test this endpoint

Request Body

// Headers
X-API-Key: your_api_key_here

// Body
{
  "privateKey": "your_base58_private_key_here",
  "toAddress": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
  "amount": 0.1
}

Response

{
  "success": true,
  "data": {
    "signature": "transaction_signature_here",
    "from": "sender_public_key",
    "to": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
    "amount": 0.1
  }
}

Error Handling

All endpoints return errors in a consistent format.

{
  "success": false,
  "error": "Error message description"
}

HTTP Status Codes

  • 200 - Success
  • 400 - Bad Request (invalid parameters)
  • 404 - Endpoint not found
  • 500 - Internal Server Error

Security Notes

Important Security Considerations

  • Never expose your private keys in logs, URLs, or client-side code
  • Use HTTPS in production to encrypt API requests
  • Consider implementing rate limiting for production use
  • All inputs are validated, but always verify on your end too
  • Run the API behind a firewall and use proper authentication in production