---
title: "Generate a chart image"
method: POST
path: "/api/charts/generate-png"
tags: ["Charts"]
---

# Generate a chart image

`POST /api/charts/generate-png`

## Request

- Base URL: `https://monit.ly`
- URL: `https://monit.ly/api/charts/generate-png`
- Auth: API key in header `X-API-Key`

Render a line, bar, horizontal-bar or world-map chart from a dataset as PNG/JPEG (base64 or URL).

## Request body

- object
  - `datasetId` integer, required
  - `chartType` 'line' | 'bar' | 'map' | 'horizontal-bar', required
  - `selectedDimensions` object
  - `dimensions_query` string: Same format as /data query, e.g. dim1=Annual&dim2=...
  - `period` string: Single period for map / horizontal-bar
  - `seriesColors` object
  - `customLegendLabels` object
  - `customTitle` string
  - `width` integer
  - `height` integer
  - `includeTitle` boolean
  - `includeSource` boolean
  - `includeDate` boolean
  - `highlightLatest` boolean
  - `showValues` boolean
  - `showBorders` boolean
  - `showLegend` boolean
  - `mapLocation` 'europe' | 'asia' | 'africa' | 'north-america' | 'south-america' | 'oceania'
  - `additionalText` string
  - `mapTransform` object
    - `x` number
    - `y` number
    - `scale` number
  - `format` 'json' | 'png' | 'jpeg'

## Response `200`

Chart image

- object
  - `success` boolean
  - `base64` string
  - `url` string

## Other responses

- `400`: Invalid parameters
- `429`: Daily limit exceeded (resets at midnight UTC)

---

[API](https://skmtc.dev/monitly/apis/monitly-api.md) · [All operations](https://skmtc.dev/monitly/apis/monitly-api/llms.txt) · [OpenAPI document](https://skmtc.dev/monitly/apis/monitly-api/revisions/87330898d3a6?raw)
