SWARM API Documentation

Build powerful applications with our comprehensive REST API. Access AI agents, trading data, and blockchain services on Solana.

API Rate Limits

100 Requests per minute (Free)
1,000 Requests per minute (Pro)
10,000 Requests per minute (Enterprise)

Authentication

All API requests require authentication using an API key. Include your key in the Authorization header.

POST /api/v1/auth/login

Authenticate with your credentials to receive an API key and access token.

Request Body

Parameter Type Required Description
email string Required User email address
password string Required User password
Request Example
curl -X POST https://api.myswarm.io/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "password": "your_secure_password"
  }'
Response Example
{
  "success": true,
  "data": {
    "apiKey": "swarm_1234567890abcdef",
    "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "expiresIn": 86400,
    "user": {
      "id": "usr_abc123",
      "email": "user@example.com",
      "tier": "pro"
    }
  }
}

AI Agents

Access and control SWARM's 150+ specialized AI agents for market analysis, trading, and portfolio management.

GET /api/v1/agents

Retrieve a list of all available AI agents with their current status and capabilities.

Request Example
curl -X GET https://api.myswarm.io/v1/agents \
  -H "Authorization: Bearer YOUR_API_KEY"
Response Example
{
  "success": true,
  "data": {
    "agents": [
      {
        "id": "agent_market_analyzer",
        "name": "Market Analyzer",
        "status": "active",
        "uptime": 99.9,
        "capabilities": ["market_analysis", "trend_detection", "sentiment_analysis"],
        "lastUpdate": "2025-10-19T17:00:00Z"
      },
      {
        "id": "agent_trading_bot",
        "name": "Trading Bot",
        "status": "active",
        "uptime": 99.8,
        "winRate": 73.2,
        "capabilities": ["automated_trading", "strategy_execution", "risk_management"],
        "lastUpdate": "2025-10-19T17:00:00Z"
      }
    ],
    "total": 27
  }
}
POST /api/v1/agents/{agentId}/execute

Execute a specific AI agent with custom parameters and receive analysis results.

Request Body

Parameter Type Required Description
task string Required Task type: "analyze", "predict", "execute"
parameters object Required Task-specific parameters
async boolean Optional Execute asynchronously (default: false)
Request Example
curl -X POST https://api.myswarm.io/v1/agents/agent_market_analyzer/execute \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "task": "analyze",
    "parameters": {
      "symbol": "SOL/USDT",
      "timeframe": "1h",
      "indicators": ["RSI", "MACD", "EMA"]
    }
  }'

Trading

Execute trades, manage orders, and access real-time market data on Solana.

POST /api/v1/trading/orders

Place a new trading order (market, limit, or stop-loss).

Request Body

Parameter Type Required Description
symbol string Required Trading pair (e.g., "SWRM/SOL")
type string Required Order type: "market", "limit", "stop_loss"
side string Required "buy" or "sell"
amount number Required Order amount in base currency
price number Optional Limit price (required for limit orders)
Request Example
curl -X POST https://api.myswarm.io/v1/trading/orders \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "symbol": "SWRM/SOL",
    "type": "limit",
    "side": "buy",
    "amount": 1000,
    "price": 0.001
  }'
GET /api/v1/trading/orders

Retrieve all your open and historical orders.

Response Example
{
  "success": true,
  "data": {
    "orders": [
      {
        "id": "ord_123456",
        "symbol": "SWRM/SOL",
        "type": "limit",
        "side": "buy",
        "status": "open",
        "amount": 1000,
        "filled": 0,
        "price": 0.001,
        "createdAt": "2025-10-19T16:30:00Z"
      }
    ],
    "total": 1
  }
}

Portfolio

Access portfolio balances, transaction history, and performance metrics.

GET /api/v1/portfolio/balances

Get current portfolio balances for all assets.

Response Example
{
  "success": true,
  "data": {
    "balances": [
      {
        "asset": "SWARM",
        "free": 50000,
        "locked": 10000,
        "total": 60000,
        "usdValue": 60.00
      },
      {
        "asset": "SOL",
        "free": 5.5,
        "locked": 0,
        "total": 5.5,
        "usdValue": 1375.00
      }
    ],
    "totalUsdValue": 1435.00
  }
}

Analytics

Access market analytics, price data, and statistical insights.

GET /api/v1/analytics/market-stats

Get comprehensive market statistics for SWARM token.

Response Example
{
  "success": true,
  "_note": "illustrative schema — $SWRM is pre-launch (devnet); values are not live",
  "data": {
    "price": 0,
    "marketCap": 0,
    "volume24h": 0,
    "priceChange24h": 0,
    "holders": 0,
    "transactions24h": 0,
    "tvl": 0
  }
}

Staking

Manage staking positions and claim rewards programmatically.

POST /api/v1/staking/stake

Stake SWARM tokens to earn potential rewards at a variable APY (subject to pool and TVL — not guaranteed).

Request Example
curl -X POST https://api.myswarm.io/v1/staking/stake \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 10000,
    "lockPeriod": 90
  }'

WebSocket API

Connect to real-time data streams for prices, trades, and agent updates.

WS wss://ws.myswarm.io/v1/stream

Connect to WebSocket server and subscribe to real-time channels.

JavaScript Example
const ws = new WebSocket('wss://ws.myswarm.io/v1/stream');

ws.onopen = () => {
  // Subscribe to price updates
  ws.send(JSON.stringify({
    action: 'subscribe',
    channels: ['prices:SWRM/SOL', 'agents:status']
  }));
};

ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  console.log('Received:', data);
};

// Example message
{
  "channel": "prices:SWRM/SOL",
  "data": {
    "price": 0.001,
    "timestamp": "2025-10-19T17:00:00Z"
  }
}

API Explorer

Test API endpoints directly from your browser. Select an endpoint, configure parameters, and see live responses.

Response will appear here...