API Documentation

Everything you need to integrate ChartGen AI into your application.

Getting Started

Endpoints

Authentication

All API requests require a Bearer token in the Authorization header. Get your API key from the Dashboard.

Authorization: Bearer your_api_key_here

Base URL

https://api.chartgen.ai

Endpoints

POST/v1/charts/generate

Generate a chart from a natural language prompt.

REQUEST
{
  "prompt": "Monthly revenue as a gradient bar chart",
  "format": "svg",
  "theme": "dark",
  "width": 800,
  "height": 400
}
RESPONSE
{
  "id": "chart_a1b2c3d4",
  "url": "https://api.chartgen.ai/charts/chart_a1b2c3d4.svg",
  "format": "svg",
  "created_at": "2026-03-27T10:30:00Z",
  "prompt": "Monthly revenue as a gradient bar chart",
  "metadata": {
    "chart_type": "bar",
    "data_points": 12,
    "render_time_ms": 145
  }
}
GET/v1/charts/:id

Retrieve a previously generated chart by ID.

REQUEST
// No request body needed
// GET /v1/charts/chart_a1b2c3d4
RESPONSE
{
  "id": "chart_a1b2c3d4",
  "url": "https://api.chartgen.ai/charts/chart_a1b2c3d4.svg",
  "format": "svg",
  "created_at": "2026-03-27T10:30:00Z",
  "status": "ready",
  "downloads": 3
}
POST/v1/charts/from-data

Generate a chart from structured data (CSV or JSON).

REQUEST
{
  "data": [
    { "month": "Jan", "revenue": 4200 },
    { "month": "Feb", "revenue": 5800 },
    { "month": "Mar", "revenue": 7100 },
    { "month": "Apr", "revenue": 6300 }
  ],
  "chart_type": "bar",
  "options": {
    "title": "Monthly Revenue",
    "x_axis": "month",
    "y_axis": "revenue",
    "gradient": true,
    "format": "png"
  }
}
RESPONSE
{
  "id": "chart_e5f6g7h8",
  "url": "https://api.chartgen.ai/charts/chart_e5f6g7h8.png",
  "format": "png",
  "created_at": "2026-03-27T10:32:00Z",
  "metadata": {
    "chart_type": "bar",
    "data_points": 4,
    "render_time_ms": 210
  }
}

Code Examples

import requests

API_KEY = "your_api_key_here"
BASE_URL = "https://api.chartgen.ai"

response = requests.post(
    f"{BASE_URL}/v1/charts/generate",
    headers={
        "Authorization": f"Bearer {API_KEY}",
        "Content-Type": "application/json"
    },
    json={
        "prompt": "Monthly revenue as a gradient bar chart",
        "format": "svg",
        "theme": "dark"
    }
)

chart = response.json()
print(f"Chart URL: {chart['url']}")

Rate Limits

PlanRequests/MinRequests/DayConcurrent
Free101001
Pro605,0005
Enterprise300Unlimited20