---
name: amt-charts
description: Generate bar, line, or pie charts from JSON via free Chart API. Returns downloadUrl for SVG or PNG. Use when agents need charts from data without a frontend.
---

# Chart generation API (Agent Media Tools)

## When to use
- Turn numbers into bar/line/pie charts for reports or agent outputs
- No chart library or browser render step

## API
`POST https://agentmediatools.com/api/chart`  
`Content-Type: application/json`

```json
{
  "type": "bar",
  "values": [10, 25, 15, 40, 30],
  "labels": ["Jan", "Feb", "Mar", "Apr", "May"],
  "title": "Monthly Revenue",
  "format": "svg",
  "width": 800,
  "height": 480
}
```

- `values` required (up to 40 numbers)
- `type`: `bar` | `line` | `pie` (default bar)
- `format`: `svg` | `png`

## Response
```json
{
  "success": true,
  "filename": "...svg",
  "downloadUrl": "/downloads/....svg",
  "type": "bar"
}
```
Fetch `https://agentmediatools.com` + `downloadUrl`.

## curl
```bash
curl -s https://agentmediatools.com/api/chart \
  -H "Content-Type: application/json" \
  -d '{"values":[10,25,15],"type":"bar","title":"Demo"}'
```

## Guide
https://agentmediatools.com/blog/generate-charts-api-bar-pie-line

## Usage
Check remaining daily capacity: `GET https://agentmediatools.com/api/usage`  
(with Bearer key: `/api/agent/usage`)
