The Canva Apps SDK, Connect APIs, and MCP are now unified in the Canva Developers SDK. Learn more⁠(opens in a new tab or window).
Canva Developers SDK
The Canva Apps SDK, Connect APIs, and MCP are now unified in the Canva Developers SDK. Learn more⁠(opens in a new tab or window).

addAudioTrack

API reference for the addAudioTrack method.
This version of the API is deprecated. This version will soon be unsupported. You should use a stable version of the API in your app.

Adds an audio track to the user's design.

To learn more, see Creating audio tracks.

Usage

import { addAudioTrack } from "@canva/design";
import { upload } from "@canva/asset";
// Upload an audio asset
const audio = await upload({
type: "AUDIO",
title: "Example audio",
mimeType: "audio/mp3",
durationMs: 86047,
url: "https://www.canva.dev/example-assets/audio-import/audio.mp3",
});
// Add the audio track to the user's design
await addAudioTrack({
ref: audio.ref,
});
TS

Permissions

Before an app that uses this method can be submitted for review, the canva:design:content:write permission must be enabled through the Developer Portal. To learn more, see Permissions.

Parameters

optionsobject
Required

The options for adding an audio track to the user's design.

options.refstring
Required

A unique identifier that points to an audio asset in Canva's backend.

Returns

Promise<void>