Home > Docs > Compiler API

Compiler API Documentation

Complete API reference for the ChipaTrader CHTL Compiler

Quick Start

Base URL: https://api.chipatrade.com

Authentication: API Key (Header: X-API-Key)

Rate Limit: 100 requests/hour (Free), Unlimited (Pro)

API Endpoints

POST/api/compiler

Compile CHTL code into a Windows executable

Request Body

{
  "chtl_code": "string (required)",
  "strategy_name": "string (optional)",
  "demoOnly": "boolean (optional)"
}

Response

{
  "success": true,
  "blob_name": "strategy_abc123.exe",
  "download_url": "https://...",
  "size_bytes": 2457600,
  "compiled_at": "2025-12-08T10:30:00Z"
}

Error Response

{
  "success": false,
  "error": "Compilation error message"
}
GET/api/compiler

Check compiler service health and version

Response

{
  "status": "healthy",
  "version": "1.0.0",
  "uptime": 3600
}

Code Examples

curl -X POST https://api.chipatrade.com/api/compiler \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key_here" \
  -d '{
    "chtl_code": "let rsi = Rsi(14); TIMEOUT(3) { SEQUENCE(First) { IF rsi CROSSES_OVER 30 THEN Buy, IF rsi CROSSES_UNDER 70 THEN Sell, Hold } }",
    "strategy_name": "rsi_strategy"
  }'

Rate Limits

PlanRate LimitMax File Size
Free10 compilations/month1 MB
Basic100 compilations/month5 MB
ProUnlimited10 MB
EnterpriseUnlimited50 MB

Error Codes

400Bad Request - Invalid CHTL code or parameters
401Unauthorized - Invalid or missing API key
429Too Many Requests - Rate limit exceeded
500Internal Server Error - Compilation failed