Chart Snapshots

Render custom chart snapshot

Render a fully customized chart snapshot from a JSON body. Returns PNG, SVG, or JSON.

Designed for AI agents (MCP), automated pipelines, and advanced users. Supports per-metric styling, custom Y-axes, formulas (SMA, EMA, ratios), dark theme, stack groups, and stroke patterns.

metrics field supports mixed types:

  • Strings (shorthand): ["price", "lth_supply"]
  • Objects (full config): [{"id": "price", "axis": "right", "style": "line"}]
  • Mixed: ["price", {"id": "lth_supply", "axis": "left", "style": "area"}]

Output format is controlled via the format field or Accept header:

  • "png" (default) — PNG image
  • "svg" — SVG vector graphic
  • "json" — chart metadata (no image rendered)

All fields except metrics (or metric/template) are optional with smart defaults.

Formula warmup: When using formulas with rolling windows, set warmup_days (0-730) to the largest rolling window period used. Extra data is fetched before the display range and trimmed after evaluation.

post/v1/chart/snapshot

Request

  • Base URL: https://api.blocklens.co (the document declares no server; this is the origin it was published from)
  • URL: https://api.blocklens.co/v1/chart/snapshot
  • Auth: none declared

Request body

metricstring nullable

Single metric ID

templatestring nullable

Template ID

daysinteger nullable
startDatestring nullable
endDatestring nullable
warmupDaysinteger

Extra days before start_date for formula rolling window warmup (0-730). Data is fetched from (start - warmup_days) but only displayed from start_date.

titlestring nullable
widthinteger
heightinteger
theme'light' | 'dark'
format'png' | 'svg' | 'json'
overlay'price' nullable
layerOrderstring[] nullable

Render order (back to front)

paramsobject nullable

Runtime parameters for entity-filtered metrics (e.g., {"ticker": "IBIT"})

xAxis'date' | 'day_offset' nullable

X axis field. Default 'date'. Use 'day_offset' for indexed series (cycle performance).

heatmapIdstring nullable

Heatmap ID (e.g., 'cost-basis-distribution'). When set, renders a heatmap PNG instead of a line chart. Mutually exclusive with metric/metrics/template.

heatmapPeriod'all' | '10y' | '5y' | '3y' | '1y' | '6m' | '3m' | '1m' | '1w' nullable

Period for heatmap bin optimization (default: 'all')

heatmapColorScale'soft' | 'viridis' | 'plasma' nullable

Heatmap color scale (default: 'soft')

heatmapYScale'linear' | 'log' nullable

Heatmap Y-axis scale (default: 'log')

style'line' | 'area' | 'bar' nullable
scale'linear' | 'log'

Response

Chart image (PNG/SVG) or JSON metadata, depending on format field or Accept header

object required

Changes

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