getTemporaryUrl

API reference for the getTemporaryUrl method.

Gets the URL of an asset, such as an image or video file, from Canva's backend.

To see how this method is used, see Transforming elements.

import { getTemporaryUrl } from "@canva/preview/asset";
(async () => {
const result = await getTemporaryUrl({
type: "IMAGE",
ref: "<REFERENCE_GOES_HERE>",
});
console.log(result.url);
})();

This method has a rate limit of 20 requests every 10 seconds.

#optionsobject
Required

The options for getting the URL of an asset.

#options.typestring
Required

The type of asset.

#options.refstring
Required

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

A Promise that resolves with the following object:

#resultobject
Required

The successful result of getting a temporary URL.

#result.typestring
Required

The type of asset.

#result.refstring
Required

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

#result.urlstring
Required

The URL of the asset.