Note: the Flourish API is an enterprise-level bolt-on and not available to all customers
1. Get an API key
First of all, you need a Flourish API key. If you have access to the API, you can create this on https://app.flourish.studio/settings under the API keys heading. Note that this is an enterprise-level bolt-on and not currently available to most customers.
2. Load the Flourish API
Install the Flourish API with
npm install @flourish/live-api and import it as
import Flourish from "@flourish/live-api".
Or load it with a script tag — you can either specify the full version number in the filename:
... or just the major version number. The latter means your visualisation will always be using the latest version of the API with that major version number, so there shouldn’t be any breaking API changes. However, only specifying the major version number also means your code will use new versions of the API automatically, without prompting you to test changes in minor patches:
3. Call the API
Next you need to call the API, passing in details about the template, settings, data, etc. The easiest way to get started with this is to make a visualization in the Flourish editor, and then change the end of the url from
/api. This will give you code you can pass into the API (having added your API key) to create the graphic, taking account of the template, data and settings. For more information about creating a visualization, see How to make and update a visualization.