Skip to main content

API Types

Raze.bot offers two API tiers:

Router V2 (Public API)

  • No authentication required
  • Usage-based fees deducted from transactions
  • Endpoints: /v2/sol/buy, /v2/sol/sell, /v2/sol/send, utilities

Premium API

  • Requires API key (subscription)
  • Endpoints: /sol/quote, /sol/swap, /api/sol/*

Authentication

Router V2

No authentication needed. Fees are included in transactions.
// No API key required
const response = await fetch('https://de.raze.sh/v2/sol/buy', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    walletAddresses: ['...'],
    tokenAddress: '...',
    solAmount: 0.1
  })
});

Premium API

Pass your API key as a query parameter:
// API key required
const response = await fetch(
  `https://de.raze.sh/sol/quote/${mint}?apiKey=${apiKey}`
);

Response Format

All APIs return JSON with a consistent structure:
{
  "success": true,
  "data": { ... }
}
Error responses:
{
  "success": false,
  "error": "Error message",
  "message": "Detailed description"
}

HTTP Status Codes

CodeDescription
200Success
400Bad Request - Invalid parameters
401Unauthorized - Invalid or missing API key
404Not Found - Resource doesn’t exist
429Rate Limited - Too many requests
500Server Error - Internal error
504Gateway Timeout - Request timed out

Transaction Flow

For swap operations, the typical flow is:
1

Request Transaction

Call the buy/sell endpoint to get unsigned transaction(s)
2

Sign Transaction

Sign the transaction with your wallet’s private key
3

Send Transaction

Submit via /v2/sol/send or directly to Solana RPC

Best Practices

  • Store API keys in environment variables
  • Never expose private keys in code
  • Use .gitignore for sensitive files
  • Always check success field in responses
  • Implement retry logic with exponential backoff
  • Log errors for debugging
  • Use the nearest server region
  • Cache quotes when appropriate
  • Batch transactions when possible
  • Set appropriate slippage for volatile tokens
  • Default slippage is usually sufficient for stable pairs
  • Higher slippage for low-liquidity tokens

Next Steps