requestApplyPublicTemplate
This API is a preview. Preview APIs are unstable and may change without warning. You can't release public apps using this API until it's stable.
Trigger the public template selection panel and apply the selected template to the current design. The panel can either display a developer-curated list of template IDs, or a partner's published Marketplace catalogue looked up by profile name.
The selected template's ID is never returned to the app — the host applies the template
directly, so use requestApplyPublicTemplate again if the user needs to pick another template.
Usage
Apply a template curated by the app
import { requestApplyPublicTemplate } from "@canva/design";const response = await requestApplyPublicTemplate({mode: "template_ids",templateIds: ["EAF000000000", "EAF000000001"],});if (response.status === "completed") {// Template was successfully applied}
Apply a template from a partner's Marketplace catalogue
import { requestApplyPublicTemplate } from "@canva/design";const response = await requestApplyPublicTemplate({mode: "query",query: { profile: "meta" },});if (response.status === "completed") {// Proceed with the flow...} else {// Display error message, change the flow, etc.}
Parameters
optsRequestPublicTemplateOptionsOptions for the RequestPublicTemplate operation.
Options for selecting a public template from a curated list of template IDs.
modestringThe only valid value is "template_ids".
templateIdsstring[]The list of template IDs curated by the app's owner to be displayed on the overlay panel.
Options for selecting a public template from a partner's published Marketplace catalogue.
modestringThe only valid value is "query".
queryobjectprofilestringThe partner profile name (slug) used to retrieve the collection, e.g. "meta".
filterstringAdditional filter applied to the query, e.g. "Instagram".
Returns
Response object from the RequestPublicTemplate operation. This is a Promise that resolves with the following object:
statusstringAvailable values:
"completed""aborted"