Agent API

Validate a chart or batch request and estimate quota before rendering

post/api/agents/preflight

Request

  • Base URL: https://klinepic.com
  • URL: https://klinepic.com/api/agents/preflight
  • Auth: one of:
    • HTTP bearer
    • API key in header X-KLine-Agent-Key

Headers

X-Agent-Request-Idstring

Stable client request id for idempotency and support lookup.

Request body

requestIdstring
kind'review-chart' | 'review-batch' | 'market-chart' required

Example request

{
  "chart": {
    "templateId": "clean-review",
    "tradesText": "trade_id,symbol,event_type,position_side,time,price,quantity\nT1,BTCUSDT,buy,long,2024-01-02T12:00:00.000Z,42210,0.2\nT1,BTCUSDT,sell,long,2024-01-02T14:30:00.000Z,43020,0.2",
    "tradesFormat": "csv",
    "preBars": 120,
    "postBars": 40,
    "minDisplayBars": 80,
    "indicatorProfile": "momentum",
    "showSubPanels": [
      "volume",
      "pnl"
    ],
    "imageTheme": "darkUs",
    "theme": "darkUs",
    "layoutPreset": "wide",
    "output": {
      "timezone": "America/New_York",
      "markerLabelTemplate": "{label} {price} x{quantity}",
      "themeOverrides": {
        "background": "#10b981",
        "grid": "#10b981",
        "axis": "#10b981",
        "candleUp": "#10b981",
        "candleDown": "#10b981",
        "candleLimitUp": "#10b981",
        "candleLimitDown": "#10b981",
        "ma": [
          "#10b981"
        ],
        "ema": [
          "#10b981"
        ],
        "boll": {
          "middle": "#10b981",
          "upper": "#10b981",
          "lower": "#10b981"
        },
        "vwap": "#10b981",
        "macd": {
          "dif": "#10b981",
          "dea": "#10b981",
          "histogramUp": "#10b981",
          "histogramDown": "#10b981"
        },
        "kdj": {
          "k": "#10b981",
          "d": "#10b981",
          "j": "#10b981"
        },
        "rsi": "#10b981",
        "atr": "#10b981",
        "volume": {
          "up": "#10b981",
          "down": "#10b981",
          "ma": [
            "#10b981"
          ]
        },
        "annotations": {
          "buyMarker": "#10b981",
          "sellMarker": "#10b981",
          "buyPriceLine": "#10b981",
          "sellPriceLine": "#10b981",
          "holdingBg": "#10b981",
          "maxProfit": "#10b981",
          "drawdown": "#10b981",
          "dividend": "#10b981"
        },
        "infoPanel": {
          "bg": "#10b981",
          "border": "#10b981",
          "text": "#10b981",
          "label": "#10b981",
          "valuePositive": "#10b981",
          "valueNegative": "#10b981",
          "accentCyan": "#10b981",
          "accentRed": "#10b981",
          "accentPurple": "#10b981"
        },
        "watermark": "#10b981"
      }
    },
    "period": "15m",
    "market": "crypto",
    "source": "csv",
    "klineCsv": "symbol,time,open,high,low,close,volume\nBTCUSDT,2024-01-02T12:00:00.000Z,42310,42450,42180,42210,1080",
    "symbol": "BTCUSDT"
  },
  "batch": {
    "templateId": "clean-review",
    "tradesText": "trade_id,symbol,event_type,position_side,time,price,quantity\nT1,BTCUSDT,buy,long,2024-01-02T12:00:00.000Z,42210,0.2\nT1,BTCUSDT,sell,long,2024-01-02T14:30:00.000Z,43020,0.2",
    "tradesFormat": "csv",
    "preBars": 120,
    "postBars": 40,
    "minDisplayBars": 80,
    "indicatorProfile": "momentum",
    "showSubPanels": [
      "volume",
      "pnl"
    ],
    "imageTheme": "darkUs",
    "theme": "darkUs",
    "layoutPreset": "wide",
    "output": {
      "timezone": "America/New_York",
      "markerLabelTemplate": "{label} {price} x{quantity}",
      "themeOverrides": {
        "background": "#10b981",
        "grid": "#10b981",
        "axis": "#10b981",
        "candleUp": "#10b981",
        "candleDown": "#10b981",
        "candleLimitUp": "#10b981",
        "candleLimitDown": "#10b981",
        "ma": [
          "#10b981"
        ],
        "ema": [
          "#10b981"
        ],
        "boll": {
          "middle": "#10b981",
          "upper": "#10b981",
          "lower": "#10b981"
        },
        "vwap": "#10b981",
        "macd": {
          "dif": "#10b981",
          "dea": "#10b981",
          "histogramUp": "#10b981",
          "histogramDown": "#10b981"
        },
        "kdj": {
          "k": "#10b981",
          "d": "#10b981",
          "j": "#10b981"
        },
        "rsi": "#10b981",
        "atr": "#10b981",
        "volume": {
          "up": "#10b981",
          "down": "#10b981",
          "ma": [
            "#10b981"
          ]
        },
        "annotations": {
          "buyMarker": "#10b981",
          "sellMarker": "#10b981",
          "buyPriceLine": "#10b981",
          "sellPriceLine": "#10b981",
          "holdingBg": "#10b981",
          "maxProfit": "#10b981",
          "drawdown": "#10b981",
          "dividend": "#10b981"
        },
        "infoPanel": {
          "bg": "#10b981",
          "border": "#10b981",
          "text": "#10b981",
          "label": "#10b981",
          "valuePositive": "#10b981",
          "valueNegative": "#10b981",
          "accentCyan": "#10b981",
          "accentRed": "#10b981",
          "accentPurple": "#10b981"
        },
        "watermark": "#10b981"
      }
    },
    "period": "15m",
    "market": "crypto",
    "source": "csv",
    "klineCsv": "symbol,time,open,high,low,close,volume\nBTCUSDT,2024-01-02T12:00:00.000Z,42310,42450,42180,42210,1080"
  }
}

Response

No-charge validation and quota projection

oktrue required
requestIdstring required
kind'review-chart' | 'review-batch' | 'market-chart' required
chargeablefalse required
validationobject required
accountobject required
apiKeyobject
warningsstring[] required

Changes

No recorded changes to this operation across all 1 revision of this API.