Getting started with integrations
Datawrapper can be integrated into existing application workflows. To get started with this, make sure you have created a valid API token and are able to make authenticated requests with it.
Workflow
The first step in adding a visualization to a page is to create it using the chart creation endpoint. Once you have created your visualization and want to open it in the user interface, you'll have to create a login URL. You can then open that login URL in a user-facing modal window to log the user in, and allow them to proceed with their chart creation.
To create a login URL, call the endpoint /auth/login-tokens to retrieve an object that contains a redirect_url:
curl --request POST \
--url https://api.datawrapper.de/v3/auth/login-tokensThe response will look like this:
{
"id": 1234567,
"token": "ge8ujLf3tJ4luAiGFbAxw1A9dS8Mpr3YwKNwd5dgwG6PCb8q1Srtpw3Db1Rrjexz",
"redirect_url": "https://api.datawrapper.de/v3/auth/login/ge8ujLf3tJ4luAiGFbAxw1A9dS8Mpr3YwKNwd5dgwG6PCb8q1Srtpw3Db1Rrjexz"
}To log in the user, open the redirect_url returned by Datawrapper in a user-facing modal window.
Specifying the app step that gets returned
You can specify which step in the Datawrapper app the redirect URL should point to. Here are all the options:
Returns a URL that opens the first step in Datawrapper for creating charts (Upload your data):
curl --request POST \
--url https://api.datawrapper.de/v3/auth/login-tokens \
--header 'content-type: application/json' \
--data '{"chartId": "<ID>", "step": "upload"}'Returns a URL that opens the first step in Datawrapper for creating maps (Select your map):
curl --request POST \
--url https://api.datawrapper.de/v3/auth/login-tokens \
--header 'content-type: application/json' \
--data '{"chartId": "<ID>", "step": "basemap"}'Returns a URL that opens the second step in Datawrapper for creating charts (Check & Describe):
curl --request POST \
--url https://api.datawrapper.de/v3/auth/login-tokens \
--header 'content-type: application/json' \
--data '{"chartId": "<ID>", "step": "describe"}'Returns a URL that opens the second step in Datawrapper for creating maps (Add your data):
curl --request POST \
--url https://api.datawrapper.de/v3/auth/login-tokens \
--header 'content-type: application/json' \
--data '{"chartId": "<ID>", "step": "data"}'Returns a URL that opens the third step in Datawrapper (Visualize):
curl --request POST \
--url https://api.datawrapper.de/v3/auth/login-tokens \
--header 'content-type: application/json' \
--data '{"chartId": "<ID>", "step": "visualize"}'Returns a URL that opens the fourth, final step in Datawrapper (Publish & Embed):
curl --request POST \
--url https://api.datawrapper.de/v3/auth/login-tokens \
--header 'content-type: application/json' \
--data '{"chartId": "<ID>", "step": "publish"}'Returns a URL that opens an interactive preview of the visualization:
curl --request POST \
--url https://api.datawrapper.de/v3/auth/login-tokens \
--header 'content-type: application/json' \
--data '{"chartId": "<ID>", "step": "preview"}'