API reference
Design
addAudioTrackaddElementAtCursoraddElementAtPointaddNativeElementaddPagebulkCreate.launchcreateRichtextRangeeditContentgetCurrentPageContextgetDefaultPageDimensionsgetDesignMetadatagetDesignTokeninitAppElementopenDesignoverlay.registerOnCanOpenpublish.launchrequestExportselection.registerOnChangesetCurrentPageBackgroundui.startDragToCursorui.startDragToPointui.startDragChangelog
Error
Intents
Intents: Content
Intents: data
Intents: design
Platform
appProcessappProcess.broadcastMessageappProcess.currentappProcess.current.getInfoappProcess.current.requestCloseappProcess.current.setOnDisposeappProcess.requestCloseappProcess.registerOnMessageappProcess.registerOnStateChangefeatures.isSupportedfeatures.registerOnSupportChangegetPlatformInfonotification.addToastrequestOpenExternalUrlChangelog
monetization.openTrackingSession
API reference for the monetization.openTrackingSession method.
This API is only available to apps that have been accepted into the Premium Apps Program(opens in a new tab or window).
Starts a new tracking session for a billable action or resumes an existing one.
Usage
Start a tracking session for a billable action
import { auth } from '@canva/user';const session = await auth.monetization.openTrackingSession({action: 'MY_BILLABLE_ACTION'});try {// Perform billable action} finally {// Always close the session when doneawait session.close();}
TYPESCRIPT
Resume a tracking session for a billable action
import { auth } from '@canva/user';const session = await auth.monetization.openTrackingSession({id: 'EXISTING_SESSION_ID'});try {// Continue billable action} finally {await session.close();}
TYPESCRIPT
Parameters
optsOpenTrackingSessionOptionsRequired
Options to either start a new session or resume an existing session.
action: The billable action to be tracked (if starting a new session).id: The ID of an existing session to resume (if resuming a session).
actionBillableActionSometimes required
Represents the possible billable actions that can be tracked.
Available values:
"modify_image""modify_video""modify_audio""modify_text""import_image""import_video""import_audio""import_text""generate_image""generate_video""generate_audio""generate_text"
idneverSometimes required
Returns
An object containing the session's unique id and a method to close the session. This is a Promise that resolves with the following object:
idTrackingIdUnique identifier for tracking sessions associated with billable actions.
closeTrackingSessionfunctionReturns
Promise<void>