structurizr.scripting when viewing the diagram viewer/editor page.
The following methods are provided.
exportCurrentDiagramToPNG: Exports the current diagram to PNG, and returns the resulting base64 data URI.
exportCurrentDiagramKeyToPNG: Exports the current diagram key to PNG, and returns the resulting base64 data URI.
exportCurrentDiagramToSVG: Exports the current diagram to SVG, and returns the resulting SVG markup.
exportCurrentDiagramKeyToSVG: Exports the current diagram key to SVG, and returns the resulting SVG markup.
exportDiagramsToOfflineHTMLPage(callback): Exports all diagrams to a single HTML page for offline use. The callback function is called when generation of the HTML page has been finished, and the first function argument is the resulting HTML markup.
getViews(): Gets an array of objects representing the views in the software architecture model.
changeView(diagramKey): Displays the specified view.
The diagram scripting API can be used in conjunction with tools such as Puppeteer, to automate the export of diagrams from the command line, perhaps as a part of a build process. The structurizr-puppeteer repo on GitHub has some code samples of how to do this.