How to trigger toImage() in plot.ly Javascript API?

Is it possible to “Download plot as png” via an external button?

Thanks!

Gotit. .downloadImage()

Could not find it in the docs.