openDesign
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.
Reads (and optionally updates) a specified part of the user's design.
Reads (and optionally updates) the current page of the user's design.
Usage: Read the current page
import { openDesign } from "@canva/design";await openDesign({ type: 'current_page' }, async (session) => {// Do something with session.pageawait session.sync();});
Parameters
optionsDesignOpenCurrentPageOptionsOptions for configuring how the current page is read.
typestringThe type of context.
The only valid value is "current_page".
callbackDesignOpenCurrentPageCallbackA callback for operating on the current page.
Parameters
sessionDesignEditing.CurrentPageSessionSession received by the openDesign callback when opening the current page.
pageDesignEditing.PageThe current page of the design.
A page with either fixed or unbounded dimensions.
For more information, see AbsolutePage.
Represents design content that the SDK doesn't support.
typestringRead-onlyThe only valid value is "unsupported".
helpersDesignEditing.PageHelpersThese are various utilities that allow apps to do more complex operations on the page.
For more information, see PageHelpers.
syncfunctionSaves any changes made during the session while keeping the session open.
- Any changes in the session are only reflected in the design after this method is called.
- Once this method is called, further changes in the session can still be made.
Returns
Promise<void>
Returns
Promise<void>
Returns
Promise<void>
Reads (and optionally updates) all pages of the user's design.
Usage: Read all pages
import { openDesign } from "@canva/design";await openDesign({ type: 'all_pages' }, async (session) => {// Do something with session.pageRefsawait session.sync();});
Parameters
optionsDesignOpenAllPagesOptionsOptions for configuring how all pages are read.
typestringThe type of context.
The only valid value is "all_pages".
callbackDesignOpenAllPagesCallbackA callback for operating on all pages.
Parameters
sessionDesignEditing.AllPagesSessionSession received by the openDesign callback when opening all pages.
pageRefsDesignEditing.PageRefListReferences to all pages of the design.
For more information, see PageRefList.
helpersDesignEditing.AllPagesHelpersThese are various utilities that allow apps to do more complex operations on the page.
For more information, see AllPagesHelpers.
syncfunctionSaves any changes made during the session while keeping the session open.
- Any changes in the session are only reflected in the design after this method is called.
- Once this method is called, further changes in the session can still be made.
Returns
Promise<void>
Returns
Promise<void>
Returns
Promise<void>
Permissions
To use this method, the following permissions must be enabled for the app:
canva:design:content:read, to read the designcanva:design:content:write, if the app calls thesyncmethod
To learn more, see Permissions.
Rate limit
This method has the following rate limits:
- Opening the design: 10 requests every 10 seconds
- Calling the
syncmethod: 10 requests every 10 seconds