Chart Crafter provides REST API endpoints to create, manage, and visualize charts. All API access requires HTTPS and returns JSON responses.
Each chart creation returns a deletion password in the response. Include this in the X-Delete-Password header for deletion requests.
Admins can use the MASTER_KEY environment variable with a Bearer token for full access to all operations.
Create a new chart entry. Example request:
curl -X POST https://chart-crafter.ideocanvas.com/api/chart \
-H "Content-Type: application/json" \
-d '{
"name": "Usage Stats",
"description": "Weekly usage metrics",
"expiresIn": "7d",
"data": {
"xAxis": { "type": "category", "data": ["Mon", "Tue", "Wed"] },
"yAxis": { "type": "value" },
"series": [{ "data": [10, 20, 30], "type": "bar" }]
}
}'Delete a chart using either method:
curl -X DELETE https://chart-crafter.ideocanvas.com/api/chart/123 \ -H "Authorization: Bearer $MASTER_KEY"
or
curl -X DELETE https://chart-crafter.ideocanvas.com/api/chart/123 \ -H "X-Delete-Password: chart-password"
The data field should contain valid ECharts configuration. Example minimal configuration:
{
"xAxis": {
"type": "category",
"data": ["Q1", "Q2", "Q3", "Q4"]
},
"yAxis": {
"type": "value"
},
"series": [{
"data": [120, 200, 150, 80],
"type": "line"
}]
}{
"id": "20240614-123e4567-e89b-12d3-a456-426614174000",
"url": "https://example.com/chart/20240614-123e4567-e89b-12d3-a456-426614174000/",
"thumbnail": "https://example.com/api/chart/image/20240614-123e4567-e89b-12d3-a456-426614174000/",
"password": "aBcDeFgHiJkL",
"svg": "<svg>...vector image data...</svg>"
}{
"chart": [
{
"id": "20240614-123e4567-e89b-12d3-a456-426614174000",
"name": "Usage Stats",
"url": "https://example.com/chart/20240614-123e4567-e89b-12d3-a456-426614174000",
"thumbnail": "https://example.com/api/chart/image/20240614-123e4567-e89b-12d3-a456-426614174000",
"createdAt": "2024-06-14T09:30:00Z",
"expiresAt": 1718352000000,
"status": "active"
},
{
"id": "20240613-98765432-1234-5678-9012-345678901234",
"name": "Old Chart",
"url": "https://example.com/chart/20240613-98765432-1234-5678-9012-345678901234",
"thumbnail": "https://example.com/api/chart/image/20240613-98765432-1234-5678-9012-345678901234",
"createdAt": "2024-06-13T15:45:00Z",
"expiresAt": 1718200000000,
"status": "expired"
}
]
}