# `render_kpi_card` — Render Executive KPI Snapshot Card

> Part of [Executive SVG Chart & KPI Card Compiler Edge API](https://chart-viz.apikeg.com/llms.txt) (`com.apikeg/chart-viz`)

Renders 1-6 executive KPI summary tiles with formatted headline values ($1.2M, 45.3%), semantic trend pills (+14.2% MoM), and inline SVG sparklines ready for Slack, Notion, Email, PDFs, or slide decks.

**Why call instead of DIY:** Instant board-grade visual metric snapshot with proportional typography and zero-overlap verification at $0.001/card.

- **REST Endpoint:** `POST https://chart-viz.apikeg.com/v1/render-kpi-card`
- **MCP Server:** `https://chart-viz.apikeg.com/mcp` (tool: `render_kpi_card`)
- **Pricing:** $0.001 USD per executive KPI snapshot card (1-6 tiles) (x402 instant micropayment)
- **Free Dry-Run:** `POST https://chart-viz.apikeg.com/v1/render-kpi-card?dry_run=true`

## Input JSON Schema
```json
{
  "type": "object",
  "properties": {
    "title": {
      "type": "string",
      "maxLength": 160,
      "description": "Optional executive card header title."
    },
    "subtitle": {
      "type": "string",
      "maxLength": 200,
      "description": "Optional card subtitle or reporting period."
    },
    "footnote": {
      "type": "string",
      "maxLength": 200,
      "description": "Optional footer attribution note."
    },
    "palette": {
      "type": "string",
      "enum": [
        "corporate",
        "slate",
        "emerald",
        "dark"
      ],
      "default": "corporate",
      "description": "Accessible executive color palette ('corporate', 'slate', 'emerald', or 'dark')."
    },
    "columns": {
      "type": "integer",
      "minimum": 1,
      "maximum": 3,
      "description": "Grid column count (1-3). Defaults automatically from tile count."
    },
    "width": {
      "type": "integer",
      "minimum": 320,
      "maximum": 2400,
      "description": "SVG width in pixels (defaults to 400/680/940 for 1/2/3 columns)."
    },
    "metrics": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "description": "KPI tile metric title (e.g. 'Net New ARR', 'Gross Margin', 'NDR')."
          },
          "value": {
            "type": "number",
            "description": "Headline numeric metric value."
          },
          "displayValue": {
            "type": "string",
            "maxLength": 40,
            "description": "Optional custom pre-formatted headline override (e.g. '4.2 mos')."
          },
          "format": {
            "type": "string",
            "enum": [
              "compact",
              "currency",
              "percent",
              "percent_ratio",
              "integer",
              "decimal",
              "raw"
            ],
            "default": "compact",
            "description": "Number format for headline value ('currency', 'percent', 'compact', etc.)."
          },
          "currencySymbol": {
            "type": "string",
            "default": "$",
            "maxLength": 8,
            "description": "Currency symbol when format is 'currency'."
          },
          "unitSuffix": {
            "type": "string",
            "default": "",
            "maxLength": 16,
            "description": "Optional unit suffix (e.g. ' bps', 'x')."
          },
          "decimals": {
            "type": "integer",
            "minimum": 0,
            "maximum": 4,
            "description": "Optional fixed decimal precision override."
          },
          "deltaText": {
            "type": "string",
            "maxLength": 48,
            "description": "Explicit trend pill text (e.g. '+14.2% MoM' or '-40 bps QoQ')."
          },
          "deltaPercent": {
            "type": "number",
            "description": "Numeric percentage change used to build the trend pill when deltaText is omitted (e.g. 14.2 -> '+14.2%')."
          },
          "deltaPeriod": {
            "type": "string",
            "maxLength": 24,
            "description": "Comparison window appended to deltaPercent (e.g. 'MoM', 'QoQ', 'YoY')."
          },
          "sentiment": {
            "type": "string",
            "enum": [
              "positive",
              "negative",
              "neutral"
            ],
            "description": "Explicit trend pill color semantics ('positive', 'negative', or 'neutral')."
          },
          "invertSentiment": {
            "type": "boolean",
            "description": "Set true when negative deltas are good (e.g. Churn Rate, CAC Payback, P99 Latency)."
          },
          "sparkline": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "minItems": 2,
            "maxItems": 120,
            "description": "Optional historical series (2-120 points) rendered as an inline vector sparkline."
          },
          "subtext": {
            "type": "string",
            "maxLength": 64,
            "description": "Optional secondary benchmark text (e.g. 'Plan: $1.10M')."
          }
        },
        "required": [
          "label",
          "value"
        ],
        "additionalProperties": false,
        "description": "Single KPI metric tile specification."
      },
      "minItems": 1,
      "maxItems": 6,
      "description": "1 to 6 executive KPI tiles to render."
    }
  },
  "required": [
    "metrics"
  ],
  "additionalProperties": false
}
```

## Examples
### SaaS Board Flash KPI Card
```bash
curl -X POST "https://chart-viz.apikeg.com/v1/render-kpi-card" \
  -H "Content-Type: application/json" \
  -d '{"title":"November SaaS Flash Report","subtitle":"Consolidated Actuals vs. Prior Month","palette":"corporate","metrics":[{"label":"Ending ARR","value":14800000,"format":"currency","currencySymbol":"$","unitSuffix":"","deltaPercent":14.2,"deltaPeriod":"MoM","sparkline":[11200000,12100000,12950000,13800000,14800000],"subtext":"Plan: $14.2M"},{"label":"Net Dollar Retention","value":118.4,"format":"percent","currencySymbol":"$","unitSuffix":"","deltaPercent":2.1,"deltaPeriod":"QoQ","sparkline":[114,115.2,116.3,118.4]},{"label":"Logo Churn","value":1.8,"format":"percent","currencySymbol":"$","unitSuffix":"","deltaPercent":-0.6,"deltaPeriod":"MoM","invertSentiment":true,"sparkline":[2.9,2.5,2.4,1.8]}]}'
```
Expected output: Standalone 3-column SVG KPI card with semantic green trend pills and inline gradient sparklines.
