getTemporaryUrl
Retrieves a temporary URL that points to an asset in Canva's backend.
Usage
Get the URL of an uploaded image asset
import { type ImageRef, getTemporaryUrl } from "@canva/asset";const placeholderImageRef = "PLACEHOLDER_IMAGE_REF" as ImageRef;const result = await getTemporaryUrl({type: "image",ref: placeholderImageRef});
Get the URL of an uploaded video asset
import { type VideoRef, getTemporaryUrl } from "@canva/asset";const placeholderVideoRef = "PLACEHOLDER_VIDEO_REF" as VideoRef;const result = await getTemporaryUrl({type: "video",ref: placeholderVideoRef});
Parameters
optionsGetTemporaryUrlOptionsOptions for retrieving a temporary URL that points to an asset in Canva's backend.
Options for retrieving a temporary URL that points to an image asset in Canva's backend.
typestringThe type of asset.
The only valid value is "image".
refImageRefA unique identifier that points to an image asset in Canva's backend.
Options for retrieving a temporary URL that points to a video asset in Canva's backend.
typestringThe type of asset.
The only valid value is "video".
refVideoRefA unique identifier that points to a video asset in Canva's backend.
Returns
The result of retrieving a temporary URL of an asset in Canva's backend. This is a Promise that resolves with the following object:
The result of retrieving a temporary URL of an image asset in Canva's backend.
typestringThe type of asset.
The only valid value is "image".
refImageRefA unique identifier that points to an image asset in Canva's backend.
urlstringA temporary URL for downloading the asset.
The result of retrieving a temporary URL of a video asset in Canva's backend.
typestringThe type of asset.
The only valid value is "video".
refVideoRefA unique identifier that points to a video asset in Canva's backend.
urlstringA temporary URL for downloading the asset.