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.

Usage

1
(async () => {
2
if (!window.Canva || !window.Canva.DesignButton) {
3
return;
4
}
5
6
const api = await window.Canva.DesignButton.initialize({
7
apiKey: "API KEY GOES HERE",
8
});
9
})();
Copied!

Parameters

Name
Type
Required
Description
opts
object
Yes
Options for configuring the Canva Button API.
opts.apiKey
string
Yes
Your API key for the Canva Button.

Returns

Name
Type
Required
Description
api
object
Yes
An object that contains functions for interacting with Canva.
api.createDesign
function
Yes
A function that creates a new design in the Canva editor. For more information, see createDesign.
api.editDesign
function
Yes
A function that opens an existing design in the Canva editor. For more information, see editDesign.
Copy link