Chart from a statistic
Search, create, title, publish, and embed a chart from library data.
1. Find a statistic
curl "https://api.kitegraph.com/v1/statistics?search=gdp" -H "Authorization: Bearer kg_live_…"
→ { "results": [ { "id": 4821, "title": "GDP (current US$) · World", … } ] }
2. Create the chart
Reference the statistic by id. kind picks the chart type; meta holds the title.
curl -X POST "https://api.kitegraph.com/v1/charts" \
-H "Authorization: Bearer kg_live_…" \
-H "Content-Type: application/json" \
-d '{ "kind": "line", "series": [{ "statistic": 4821 }], "meta": { "title": "World GDP" } }'
→ { "id": "9f2c41d05b7a83e6", … }
3. Style it
Set any editor setting through meta with a PATCH. Read the full meta vocabulary from the editor.
curl -X PATCH "https://api.kitegraph.com/v1/charts/9f2c41d05b7a83e6" \
-H "Authorization: Bearer kg_live_…" -H "Content-Type: application/json" \
-d '{ "meta": { "subtitle": "Current US dollars", "theme": "kite" } }'
4. Publish and embed
curl -X POST "https://api.kitegraph.com/v1/charts/9f2c41d05b7a83e6/publish" -H "Authorization: Bearer kg_live_…"
→ { "embedUrl": "https://app.kitegraph.com/embed/…", "iframe": "<iframe …>" }
Paste the iframe into your page. See Embedding for the responsive script.