Skip to main content

API Documentation

Integrate with AlgoStudio using our REST APIs. Set up webhooks for live EA tracking, upload backtest results, and interact with the template marketplace.

Webhook Setup

Configure webhooks to receive real-time events from your live Expert Advisors. Set your webhook URL in Account Settings, and your EAs will send events automatically.

Webhook URL Format

POST https://your-server.com/webhook/algostudio

Authentication

Each EA instance has a unique API key. Include it in the X-EA-Api-Key header.

Header
X-EA-Api-Key: ea_live_abc123def456

Payload Formats

Heartbeat Event

POST /api/telemetry/heartbeat
{
  "balance": 10250.5,
  "equity": 10180.25,
  "openTrades": 2,
  "totalTrades": 47,
  "totalProfit": 250.5,
  "drawdown": 0.68,
  "spread": 12
}

Trade Event

POST /api/telemetry/trade
{
  "ticket": "12345678",
  "symbol": "EURUSD",
  "type": "BUY",
  "openPrice": 1.0852,
  "closePrice": 1.0878,
  "lots": 0.1,
  "profit": 26,
  "openTime": "2026-01-15T10:30:00Z",
  "closeTime": "2026-01-15T14:45:00Z"
}

Error Event

POST /api/telemetry/error
{
  "errorCode": 4756,
  "message": "OrderSend failed: not enough money",
  "context": "OnTick"
}
CodeDescription
401Missing or invalid API key
429Rate limit exceeded (20 requests/minute)
500Internal server error
curl example
curl -X POST https://algo-studio.com/api/telemetry/heartbeat \
  -H "Content-Type: application/json" \
  -H "X-EA-Api-Key: ea_live_abc123def456" \
  -d '{"balance":10250.50,"equity":10180.25,"openTrades":2,"totalTrades":47,"totalProfit":250.50,"drawdown":0.68,"spread":12}'

Backtest API

POST/api/backtest/upload

Upload a backtest result file for a specific project. Accepts MT5 Strategy Tester HTML reports.

Auth: Session cookie (logged in)
curl example
curl -X POST https://algo-studio.com/api/backtest/upload \
  -H "Cookie: next-auth.session-token=YOUR_SESSION" \
  -F "file=@backtest-report.htm" \
  -F "projectId=clx1abc123"
Response (200)
{
  "id": "clx2def456",
  "projectId": "clx1abc123",
  "fileName": "backtest-report.htm",
  "results": {
    "totalTrades": 342,
    "winRate": 58.2,
    "profitFactor": 1.85,
    "maxDrawdown": 12.4,
    "netProfit": 4250
  },
  "createdAt": "2026-01-20T08:00:00Z"
}
CodeDescription
400Missing file or projectId
401Not authenticated
404Project not found
413File too large (max 5MB)
GET/api/backtest?projectId=clx1abc123

Retrieve backtest results for a project.

Auth: Session cookie (logged in)
Response (200)
{
  "data": [
    {
      "id": "clx2def456",
      "fileName": "backtest-report.htm",
      "results": {
        "totalTrades": 342,
        "winRate": 58.2,
        "profitFactor": 1.85
      },
      "createdAt": "2026-01-20T08:00:00Z"
    }
  ]
}
CodeDescription
401Not authenticated
404Project not found

Marketplace API

GET/api/marketplace/search?q=ema&category=trend-following&sort=popular&page=1&limit=20

Search public strategy templates. Supports filtering by query, category, and tag.

Auth: None (public)
Response (200)
{
  "data": [
    {
      "id": "tmpl_abc123",
      "name": "EMA Crossover Pro",
      "description": "Trend-following with dual EMA filters",
      "authorEmail": "joh***@gmail.com",
      "downloads": 142,
      "avgRating": 4.5,
      "ratingCount": 12,
      "category": "trend-following",
      "tags": [
        "ema",
        "trend"
      ],
      "createdAt": "2026-01-10T12:00:00Z"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 1,
    "totalPages": 1
  }
}
CodeDescription
500Internal server error
POST/api/marketplace/publish

Publish a project as a public marketplace template.

Auth: Session cookie (logged in)
Request body
{
  "projectId": "clx1abc123",
  "name": "My EMA Strategy",
  "description": "A simple EMA crossover strategy",
  "category": "trend-following",
  "tags": [
    "ema",
    "simple"
  ]
}
CodeDescription
400Validation failed
401Not authenticated
404Project not found
POST/api/marketplace/rate

Rate a marketplace template (1-5 stars). Updates existing rating if already rated.

Auth: Session cookie (logged in)
Request body
{
  "templateId": "tmpl_abc123",
  "rating": 5,
  "review": "Excellent strategy, works great on EURUSD"
}
CodeDescription
400Invalid rating (must be 1-5)
401Not authenticated
404Template not found

Live EA API

GET/api/live/status

Get the status of all your live EA instances, including trade history and equity heartbeats.

Auth: Session cookie (logged in)
Response (200)
{
  "data": [
    {
      "id": "ea_inst_001",
      "eaName": "EMA Cross v3",
      "symbol": "EURUSD",
      "timeframe": "H1",
      "broker": "IC Markets",
      "status": "ONLINE",
      "lastHeartbeat": "2026-01-20T14:30:00Z",
      "balance": 10500.25,
      "equity": 10480,
      "openTrades": 1,
      "totalTrades": 89,
      "totalProfit": 500.25,
      "trades": [
        {
          "profit": 32.5,
          "closeTime": "2026-01-20T12:15:00Z"
        }
      ],
      "heartbeats": [
        {
          "equity": 10480,
          "createdAt": "2026-01-20T14:30:00Z"
        }
      ]
    }
  ]
}
CodeDescription
401Not authenticated
500Internal server error
curl example
curl https://algo-studio.com/api/live/status \
  -H "Cookie: next-auth.session-token=YOUR_SESSION"