The unique ID of the Datawrapper chart, table, or map. This ID can be found in the Datawrapper URL or dashboard.
Optional parameters to configure the request.
OptionalapiKey?: stringThe name of the environment variable that stores your Datawrapper API key (e.g., "DATAWRAPPER_KEY"). If not provided, the function defaults to looking for the DATAWRAPPER_KEY environment variable.
OptionalreturnResponse?: booleanIf true, the function will return the full, unconsumed Response object from the Datawrapper API call, including HTTP error responses. This can be useful for debugging or for more detailed handling of the API response. Defaults to false.
A Promise that resolves to a parsed Record<string, unknown> by default, or a Response object if returnResponse is true.
import { getInfoDW } from "@nshiab/journalism-dataviz";
const info = await getInfoDW("myChartId");
console.log(info); // full parsed chart object
Gets information and settings for a Datawrapper chart, table, or map.
Returns the full parsed chart object, including any chart-specific fields. Property values are typed as unknown because the response varies by visualization.
Authentication is handled via an API key stored in an environment variable (
DATAWRAPPER_KEYby default). The token requireschart:readorchart:writescope.