The Canva Button is only available for users in China. If your users aren't in China, you can't use the Canva Button. There are no plans to make the Canva Button available outside of China.

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

(async () => {
if (!window.Canva || !window.Canva.DesignButton) {
return;
}
const api = await window.Canva.DesignButton.initialize({
apiKey: "API KEY GOES HERE",
});
})();
JAVASCRIPT

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.