Charts API

List, create, fetch, and update saved visualizations under /api/charts.

The charts endpoints manage saved visualizations. Reads need the read scope; creating and updating need write.

#List charts

GET /api/charts — return the charts the service account can read.

#Create a chart

POST /api/charts — create a chart from a name, a type, and a query. Requires the write scope.

curl https://flax-analytics.com/api/charts \
  -H "Authorization: Bearer flax_pat_..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Revenue by status",
    "type": "bar",
    "query": { "model": "orders", "dimensions": ["orders.status"], "measures": ["orders.revenue"] }
  }'

#Get a chart

GET /api/charts/{chartId} — fetch a single chart by id.

#Update a chart

PATCH /api/charts/{chartId} — update a chart's name, type, or query. Requires the write scope.