createDesign
Creates a design in the editor.
The createDesign method accepts different parameters depending on whether or not a design is created via a product catalog.

Create a design via the catalog-to-editor path

The catalog-to-editor path lets an integration create a design via a product catalog.

Usage

1
(async () => {
2
const api = await Canva.Partnership.initialize({
3
apiKey: "<partner_api_key>",
4
autoAuthToken: "<auto_auth_token>",
5
container: document.getElementById("container"),
6
});
7
8
const onBackClick = () => {
9
// the user has clicked the "Back" button in the editor's header
10
console.log("You clicked the 'Back' button!");
11
};
12
13
const onArtworkCreate = (opts) => {
14
// the user has finished proofing their design
15
console.log(opts);
16
};
17
18
const onProductSelect = (opts) => {
19
api.createDesign({
20
...opts,
21
onBackClick,
22
onArtworkCreate,
23
});
24
};
25
26
api.showCatalog({
27
onProductSelect,
28
});
29
})();
Copied!

Parameters

Parameter
Type
Required
Description
opts
object
Yes
Options for creating a new design in the Canva editor.
opts.onArtworkCreate (deprecated)
function
Yes
See onArtworkCreate. This parameter is superseded by opts.onMultiArtworkCreate.
opts.onBackClick
function
Yes
opts.onMultiArtworkCreate
function
Yes
opts.designId
string
No
The ID of an existing design. If present, a new design is created as a copy of the existing design.
opts.designSource
string
No
Whether a design is created via a product catalog or by directly launching the Canva editor. Set to "catalog".
opts.onDesignClose
function
No
opts.onDesignOpen
function
No
opts.publishLabel
string
No
A label for the editor's Publish button.
opts.title
string
No
The title of the design. The default title is Untitled design. The title is used in the exported design's filename. Users can change the title later in the Canva editor.
To set the minimum and maximum number of pages, raise a ticket and request Canva to set them up in the backend. Don’t set them via the opts.minPages and opts.maxPages parameters. The SDK ignores these parameters.

Create a design via the direct-to-editor path

The direct-to-editor path lets an integration create a design by directly launching the Canva editor.

Usage

1
(async () => {
2
const api = await Canva.Partnership.initialize({
3
apiKey: "<partner_api_key>",
4
autoAuthToken: "<auto_auth_token>",
5
});
6
7
const onBackClick = () => {
8
// the user has clicked the "Back" button in the editor's header
9
console.log("You clicked the 'Back' button!");
10
};
11
12
const onArtworkCreate = (opts) => {
13
console.log(opts);
14
};
15
16
api.createDesign({
17
partnerProductId: "Poster11x17",
18
designSource: "direct",
19
onBackClick,
20
onArtworkCreate,
21
});
22
})();
Copied!

Parameters

Parameter
Type
Required
Description
opts
object
Yes
Options for creating a new design in the Canva editor.
opts.designSource
string
Yes
Whether a design is created via a product catalog or by directly launching the Canva editor. Set to "direct".
opts.onArtworkCreate (deprecated)
function
Yes
See onArtworkCreate. This parameter is superseded by opts.onMultiArtworkCreate.
opts.onBackClick
function
Yes
opts.onMultiArtworkCreate
function
Yes
opts.partnerProductId
string
Yes
The ID of a partner's product. Some examples are "Poster11x17in" and "Banner96x24in". A partner product ID determines the dimensions, the templates, the furniture (if applicable), and the export settings to apply for a design. A partner may provide a partner product ID to Canva beforehand. This may match with a product ID in a partner’s back-end, such as SKU or internal system identifier. If partner doesn’t provide a partner product ID, Canva assigns one for each product.
opts.designId
string
No
The ID of an existing design. If present, a new design is created as a copy of the existing design.
opts.onDesignClose
function
No
opts.onDesignOpen
function
No
opts.publishLabel
string
No
A label for the editor's Publish button.
opts.title
string
No
The title of the design. The default title is Untitled design. The title is used in the exported design's filename. Users can change the title later in the Canva editor.
To set the minimum and maximum number of pages, raise a ticket and request Canva to set them up in the backend. Don’t set them via the opts.minPages and opts.maxPages parameters. The SDK ignores these parameters.
Last modified 20d ago