onDesignPublish

API reference for the JavaScript API's onDesignPublish method.

A function that runs when a user publishes a design.

api.createDesign({
design: {
type: "Poster",
},
onDesignPublish: (opts) => {
console.log(opts);
},
});
javascript
NameTypeRequiredDescription
optsobjectYesParameters that Canva passes into the function.
opts.designIdstringYesThe ID of the user's design.
opts.designTitlestringYesThe title of the user's design.
opts.exportUrlstringYesThe URL for downloading the user's design. This URL expires after 15 minutes. The URL is in the form https://export-download.canva.com/<export_file>. If you're using the China version of the SDK, the TLD is .cn instead of .com. You can take the necessary security measures to protect the URL from any malicious attacks.

void