initialize

API reference for the JavaScript API's initialize method.

Initializes the JavaScript API for the Canva Button. You must embed the Canva Button SDK before calling this function.

(async () => {
if (!window.Canva || !window.Canva.DesignButton) {
return;
}
const api = await window.Canva.DesignButton.initialize({
apiKey: "API KEY GOES HERE",
});
})();
javascript
NameTypeRequiredDescription
optsobjectYesOptions for configuring the Canva Button API.
opts.apiKeystringYesYour API key for the Canva Button.
NameTypeRequiredDescription
apiobjectYesAn object that contains functions for interacting with Canva.
api.createDesignfunctionYesA function that creates a new design in the Canva editor. For more information, see createDesign.
api.editDesignfunctionYesA function that opens an existing design in the Canva editor. For more information, see editDesign.