onDesignPublish
API reference for the JavaScript API's onDesignPublish method.
A function that runs when a user publishes a design.

Usage

1
api.createDesign({
2
design: {
3
type: "Poster",
4
},
5
onDesignPublish: (opts) => {
6
console.log(opts);
7
},
8
});
Copied!
You can pass the onDesignPublish function into the createDesign and editDesign functions.

Parameters

Name
Type
Required
Description
opts
object
Yes
Parameters that Canva passes into the function.
opts.designId
string
Yes
The ID of the user's design.
opts.designTitle
string
Yes
The title of the user's design.
opts.exportUrl
string
Yes
The 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.

Returns

void
Last modified 6mo ago
Copy link