Appearance
Connect API — Assets
Assets Overview
The Canva Connect APIs for managing assets.
The assets endpoint lets you upload assets to a user's Canva library. You can directly upload assets from the user’s local storage system, name and tag the assets, get information about the assets, or update and delete assets using this endpoint. For more information about assets, see Canva concepts.
The assets APIs support images and videos.
Images
Image files must be smaller than 50 MB, and we accept the following file formats:
- JPEG
- PNG
- HEIC
- Single-frame GIFs
- TIFF
- Single-frame WEBP
Videos
Video files must be smaller than 500 MB, and we accept the following file formats:
- M4V
- Matroska (MKV)
- MP4 video
- MPEG
- QuickTime
- WebM
Assets APIs
- Create asset upload job: Create an asynchronous job to upload an asset.
- Get asset upload job: Get the status and results of an upload asset job.
- Create asset upload job via URL: Create an asynchronous job to upload an asset from a URL.
- Get asset upload job via URL: Get the status and results of job to upload asset from a URL.
- Get asset: Get the metadata for an asset in the user's Projects.
- Update asset: Update the metadata for an asset in the users Projects.
- Delete asset: Delete an asset from the user's Projects.
Create Asset Upload Job
Create an asynchronous job to upload an asset.
Starts a new asynchronous job to upload an asset to the user's content library. Supported file types for assets are listed in the Assets API overview.
The request format for this endpoint is an application/octet-stream body of bytes. Attach information about the upload using an Asset-Upload-Metadata header.
<Note> For more information on the workflow for using asynchronous jobs, see API requests and responses. You can check the status and get the results of asset upload jobs created with this API using the Get asset upload job API. </Note>
HTTP method and URL path
POST https://api.canva.com/rest/v1/asset-uploads
This operation is rate limited to 30 requests per minute for each user of your integration.
Authentication and authorization
This endpoint requires a valid access token that acts on behalf of a user.
Scopes
The access token must have all the following scopes (permissions):
asset:write
Header parameters
<Prop.List> <Prop name="Authorization" type="string" required> Provides credentials to authenticate the request, in the form of a Bearer token.
For example: `Authorization: Bearer {token}`
</Prop>
<Prop name="Content-Type" type="string" required> Indicates the media type of the information sent in the request. This must be set to application/octet-stream.
For example: `Content-Type: application/octet-stream`
</Prop>
<Prop name="Asset-Upload-Metadata" type="AssetUploadMetadata" required> Metadata for the asset being uploaded.
<PillAccordion title={<>Properties of <strong>Asset-Upload-Metadata</strong></>}>
<Prop.List>
<Prop name="name_base64" type="string" required>
The asset's name, encoded in Base64.
The maximum length of an asset name in Canva (unencoded) is 50 characters.
Base64 encoding allows names containing emojis and other special
characters to be sent using HTTP headers.
For example, "My Awesome Upload 🚀" Base64 encoded
is `TXkgQXdlc29tZSBVcGxvYWQg8J+agA==`.
<Prop.Extras>
**Minimum length:** `1`
</Prop.Extras>
</Prop>
</Prop.List>
</PillAccordion>
</Prop> </Prop.List>
Body parameters
Binary of the asset to upload.
Example request
Examples for using the /v1/asset-uploads endpoint:
<Tabs storageKey="example.language" disableContentTransition> <Tab name="cURL"> sh curl --request POST 'https://api.canva.com/rest/v1/asset-uploads' \ --header 'Authorization: Bearer {token}' \ --header 'Content-Type: application/octet-stream' \ --header 'Asset-Upload-Metadata: { "name_base64": "TXkgQXdlc29tZSBVcGxvYWQg8J+agA==" }' \ --data-binary '@/path/to/file' </Tab>
<Tab name="Node.js"> ```js const fetch = require("node-fetch"); const fs = require("fs");
fetch("https://api.canva.com/rest/v1/asset-uploads", {
method: "POST",
headers: {
"Asset-Upload-Metadata": JSON.stringify({ "name_base64": "TXkgQXdlc29tZSBVcGxvYWQg8J+agA==" }),
"Authorization": "Bearer {token}",
"Content-Length": fs.statSync("/path/to/file").size,
"Content-Type": "application/octet-stream",
},
body: fs.createReadStream("/path/to/file"),
})
.then(async (response) => {
const data = await response.json();
console.log(data);
})
.catch(err => console.error(err));
```
</Tab>
<Tab name="Java"> ```java import java.io.IOException; import java.net.URI; import java.net.http.*; import java.nio.file.Paths;
public class ApiExample {
public static void main(String[] args) throws IOException, InterruptedException {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.canva.com/rest/v1/asset-uploads"))
.header("Authorization", "Bearer {token}")
.header("Content-Type", "application/octet-stream")
.header("Asset-Upload-Metadata", "{ \"name_base64\": \"TXkgQXdlc29tZSBVcGxvYWQg8J+agA==\" }")
.method("POST", HttpRequest.BodyPublishers.ofFile(Paths.get("/path/to/file")))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}
```
</Tab>
<Tab name="Python"> ```py import requests import json
headers = {
"Authorization": "Bearer {token}",
"Content-Type": "application/octet-stream",
"Asset-Upload-Metadata": json.dumps({ "name_base64": "TXkgQXdlc29tZSBVcGxvYWQg8J+agA==" })
}
with open("/path/to/file", "rb") as file:
response = requests.post("https://api.canva.com/rest/v1/asset-uploads",
headers=headers,
data=file
)
print(response.json())
```
</Tab>
<Tab name="C#"> ```csharp using System.Net.Http; using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://api.canva.com/rest/v1/asset-uploads"),
Headers =
{
{ "Authorization", "Bearer {token}" },
{ "Asset-Upload-Metadata", "{ \"name_base64\": \"TXkgQXdlc29tZSBVcGxvYWQg8J+agA==\" }" },
},
Content = new StreamContent(File.OpenRead("/path/to/file"))
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/octet-stream"),
}
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
};
```
</Tab>
<Tab name="Go"> ```go package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
payload, _ := os.Open("/path/to/file")
defer payload.Close()
url := "https://api.canva.com/rest/v1/asset-uploads"
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer {token}")
req.Header.Add("Content-Type", "application/octet-stream")
req.Header.Add("Asset-Upload-Metadata", "{ \"name_base64\": \"TXkgQXdlc29tZSBVcGxvYWQg8J+agA==\" }")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
```
</Tab>
<Tab name="PHP"> ```php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.canva.com/rest/v1/asset-uploads", CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array( 'Authorization: Bearer {token}', 'Content-Type: application/octet-stream', 'Asset-Upload-Metadata: { "name_base64": "TXkgQXdlc29tZSBVcGxvYWQg8J+agA==" }', ), CURLOPT_POSTFIELDS => file_get_contents("/path/to/file") ));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if (empty($err)) {
echo $response;
} else {
echo "Error: " . $err;
}
```
</Tab>
<Tab name="Ruby"> ```ruby require 'net/http' require 'uri'
url = URI('https://api.canva.com/rest/v1/asset-uploads')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request['Authorization'] = 'Bearer {token}'
request['Content-Type'] = 'application/octet-stream'
request['Asset-Upload-Metadata'] = '{ "name_base64": "TXkgQXdlc29tZSBVcGxvYWQg8J+agA==" }'
request.body = File.read('/path/to/file')
response = http.request(request)
puts response.read_body
```
</Tab> </Tabs>
Success response
If successful, the endpoint returns a 200 response with a JSON body with the following parameters:
<Prop.List> <Prop name="job" type="AssetUploadJob" required mode="output"> The status of the asset upload job.
<PillAccordion title={<>Properties of <strong>job</strong></>} defaultExpanded={true}>
<Prop.List>
<Prop name="id" type="string" required mode="output">
The ID of the asset upload job.
</Prop>
<Prop name="status" type="string" required mode="output">
Status of the asset upload job.
<Prop.Extras>
**Available values:**
* `failed`
* `in_progress`
* `success`
</Prop.Extras>
</Prop>
<Prop name="error" type="AssetUploadError" mode="output">
If the upload fails, this object provides details about the error.
<PillAccordion title={<>Properties of <strong>error</strong></>}>
<Prop.List>
<Prop name="code" type="string" required mode="output">
A short string indicating why the upload failed. This field can be used to handle errors
programmatically.
<Prop.Extras>
**Available values:**
* `file_too_big`
* `import_failed`
* `fetch_failed`
</Prop.Extras>
</Prop>
<Prop name="message" type="string" required mode="output">
A human-readable description of what went wrong.
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
<Prop name="asset" type="Asset" mode="output">
The asset object, which contains metadata about the asset.
<PillAccordion title={<>Properties of <strong>asset</strong></>}>
<Prop.List>
<Prop name="type" type="string" required mode="output">
Type of an asset.
<Prop.Extras>
**Available values:**
* `image`
* `video`
</Prop.Extras>
</Prop>
<Prop name="id" type="string" required mode="output">
The ID of the asset.
</Prop>
<Prop name="name" type="string" required mode="output">
The name of the asset.
</Prop>
<Prop name="tags" type="string[]" required mode="output">
The user-facing tags attached to the asset.
Users can add these tags to their uploaded assets, and they can search their uploaded
assets in the Canva UI by searching for these tags. For information on how users use
tags, see the
Canva Help Center page on asset tags.
</Prop>
<Prop name="created_at" type="integer" required mode="output">
When the asset was added to Canva, as a Unix timestamp (in seconds since the Unix
Epoch).
</Prop>
<Prop name="updated_at" type="integer" required mode="output">
When the asset was last updated in Canva, as a Unix timestamp (in seconds since the
Unix Epoch).
</Prop>
<Prop name="owner" type="TeamUserSummary" required mode="output">
Metadata for the user, consisting of the User ID and Team ID.
<PillAccordion title={<>Properties of <strong>owner</strong></>}>
<Prop.List>
<Prop name="user_id" type="string" required mode="output">
The ID of the user.
</Prop>
<Prop name="team_id" type="string" required mode="output">
The ID of the user's Canva Team.
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
<Prop name="thumbnail" type="Thumbnail" mode="output">
A thumbnail image representing the object.
<PillAccordion title={<>Properties of <strong>thumbnail</strong></>}>
<Prop.List>
<Prop name="width" type="integer" required mode="output">
The width of the thumbnail image in pixels.
</Prop>
<Prop name="height" type="integer" required mode="output">
The height of the thumbnail image in pixels.
</Prop>
<Prop name="url" type="string" required mode="output">
A URL for retrieving the thumbnail image.
This URL expires after 15 minutes. This URL includes a query string
that's required for retrieving the thumbnail.
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
<Prop name="metadata" type="AssetMetadata" mode="output">
Type-specific metadata for the asset.
<Tabs>
<Tab name="image">
<Prop.List>
<Prop name="type" type="string" required mode="output">
<Prop.Extras>
**Available values:** The only valid value is `image`.
</Prop.Extras>
</Prop>
<Prop name="width" type="integer" mode="output">
The width of the image in pixels.
</Prop>
<Prop name="height" type="integer" mode="output">
The height of the image in pixels.
</Prop>
<Prop name="smart_tags" type="string[]" mode="output">
AI-generated tags for the image.
</Prop>
</Prop.List>
</Tab>
<Tab name="video">
<Prop.List>
<Prop name="type" type="string" required mode="output">
<Prop.Extras>
**Available values:** The only valid value is `video`.
</Prop.Extras>
</Prop>
<Prop name="width" type="integer" required mode="output">
The width of the video in pixels.
</Prop>
<Prop name="height" type="integer" required mode="output">
The height of the video in pixels.
</Prop>
<Prop name="duration" type="integer" mode="output">
The duration of the video in seconds.
</Prop>
</Prop.List>
</Tab>
</Tabs>
</Prop>
<Prop name="import_status" type="ImportStatus" deprecated mode="output">
The import status of the asset.
<PillAccordion title={<>Properties of <strong>import_status</strong></>}>
<Prop.List>
<Prop name="state" type="string" required mode="output">
State of the import job for an uploaded asset.
<Prop.Extras>
**Available values:**
* `failed`
* `in_progress`
* `success`
</Prop.Extras>
</Prop>
<Prop name="error" type="ImportError" deprecated mode="output">
If the import fails, this object provides details about the error.
<PillAccordion title={<>Properties of <strong>error</strong></>}>
<Prop.List>
<Prop name="message" type="string" required mode="output">
A human-readable description of what went wrong.
</Prop>
<Prop name="code" type="string" required mode="output">
A short string indicating why the upload failed. This field can be used to handle errors programmatically.
<Prop.Extras>
**Available values:**
* `file_too_big`
* `import_failed`
</Prop.Extras>
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
</Prop.List>
</PillAccordion>
</Prop> </Prop.List>
Example responses
In progress job
json
{
"job": {
"id": "e08861ae-3b29-45db-8dc1-1fe0bf7f1cc8",
"status": "in_progress"
}
}Successfully completed job
json
{
"job": {
"id": "e08861ae-3b29-45db-8dc1-1fe0bf7f1cc8",
"status": "success",
"asset": {
"id": "Msd59349ff",
"type": "image",
"name": "My Awesome Upload",
"tags": [
"image",
"holiday",
"best day ever"
],
"owner": {
"user_id": "oU123456AbCdE",
"team_id": "oB123456AbCdE"
},
"created_at": 1377396000,
"updated_at": 1692928800,
"thumbnail": {
"width": 595,
"height": 335,
"url": "https://document-export.canva.com/Vczz9/zF9vzVtdADc/2/thumbnail/0001.png?<query-string>"
}
}
}
}Failed job
json
{
"job": {
"id": "e08861ae-3b29-45db-8dc1-1fe0bf7f1cc8",
"status": "failed",
"error": {
"code": "file_too_big",
"message": "Failed to import because the file is too big"
}
}
}Create URL Asset Upload Job
Create an asynchronous job to upload an asset from a URL.
<Warning> This API is currently provided as a preview. Be aware of the following:
- There might be unannounced breaking changes.
- Any breaking changes to preview APIs won't produce a new API version.
- Public integrations that use preview APIs will not pass the review process, and can't be made available to all Canva users. </Warning>
Starts a new asynchronous job to upload an asset from a URL to the user's content library. Supported file types for assets are listed in the Assets API overview.
<Note> Uploading a video asset from a URL is limited to a maximum 100MB file size. For importing larger video files, use the Create asset upload job API. </Note>
<Note> For more information on the workflow for using asynchronous jobs, see API requests and responses. You can check the status and get the results of asset upload jobs created with this API using the Get asset upload job via URL API. </Note>
HTTP method and URL path
POST https://api.canva.com/rest/v1/url-asset-uploads
This operation is rate limited to 30 requests per minute for each user of your integration.
Authentication and authorization
This endpoint requires a valid access token that acts on behalf of a user.
Scopes
The access token must have all the following scopes (permissions):
asset:write
Header parameters
<Prop.List> <Prop name="Authorization" type="string" required> Provides credentials to authenticate the request, in the form of a Bearer token.
For example: `Authorization: Bearer {token}`
</Prop>
<Prop name="Content-Type" type="string" required> Indicates the media type of the information sent in the request. This must be set to application/json.
For example: `Content-Type: application/json`
</Prop> </Prop.List>
Body parameters
<Prop.List> <Prop name="name" type="string" required> A name for the asset.
<Prop.Extras>
**Minimum length:** `1`
**Maximum length:** `255`
</Prop.Extras>
</Prop>
<Prop name="url" type="string" required> The URL of the file to import. This URL must be accessible from the internet and be publicly available.
<Prop.Extras>
**Minimum length:** `8`
**Maximum length:** `2048`
</Prop.Extras>
</Prop> </Prop.List>
Example request
Examples for using the /v1/url-asset-uploads endpoint:
<Tabs storageKey="example.language" disableContentTransition> <Tab name="cURL"> sh curl --request POST 'https://api.canva.com/rest/v1/url-asset-uploads' \ --header 'Authorization: Bearer {token}' \ --header 'Content-Type: application/json' \ --data '{ "name": "My Awesome Asset", "url": "https://example.com/my_asset_to_upload.jpg" }' </Tab>
<Tab name="Node.js"> ```js const fetch = require("node-fetch");
fetch("https://api.canva.com/rest/v1/url-asset-uploads", {
method: "POST",
headers: {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
},
body: JSON.stringify({
"name": "My Awesome Asset",
"url": "https://example.com/my_asset_to_upload.jpg"
}),
})
.then(async (response) => {
const data = await response.json();
console.log(data);
})
.catch(err => console.error(err));
```
</Tab>
<Tab name="Java"> ```java import java.io.IOException; import java.net.URI; import java.net.http.*;
public class ApiExample {
public static void main(String[] args) throws IOException, InterruptedException {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.canva.com/rest/v1/url-asset-uploads"))
.header("Authorization", "Bearer {token}")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"name\": \"My Awesome Asset\", \"url\": \"https://example.com/my_asset_to_upload.jpg\"}"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}
```
</Tab>
<Tab name="Python"> ```py import requests
headers = {
"Authorization": "Bearer {token}",
"Content-Type": "application/json"
}
data = {
"name": "My Awesome Asset",
"url": "https://example.com/my_asset_to_upload.jpg"
}
response = requests.post("https://api.canva.com/rest/v1/url-asset-uploads",
headers=headers,
json=data
)
print(response.json())
```
</Tab>
<Tab name="C#"> ```csharp using System.Net.Http;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://api.canva.com/rest/v1/url-asset-uploads"),
Headers =
{
{ "Authorization", "Bearer {token}" },
},
Content = new StringContent(
"{\"name\": \"My Awesome Asset\", \"url\": \"https://example.com/my_asset_to_upload.jpg\"}",
Encoding.UTF8,
"application/json"
),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
};
```
</Tab>
<Tab name="Go"> ```go package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"name": "My Awesome Asset",
"url": "https://example.com/my_asset_to_upload.jpg"
}`)
url := "https://api.canva.com/rest/v1/url-asset-uploads"
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer {token}")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
```
</Tab>
<Tab name="PHP"> ```php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.canva.com/rest/v1/url-asset-uploads", CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array( 'Authorization: Bearer {token}', 'Content-Type: application/json', ), CURLOPT_POSTFIELDS => json_encode([ "name" => "My Awesome Asset", "url" => "https://example.com/my_asset_to_upload.jpg" ]) ));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if (empty($err)) {
echo $response;
} else {
echo "Error: " . $err;
}
```
</Tab>
<Tab name="Ruby"> ```ruby require 'net/http' require 'uri'
url = URI('https://api.canva.com/rest/v1/url-asset-uploads')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request['Authorization'] = 'Bearer {token}'
request['Content-Type'] = 'application/json'
request.body = <<REQUEST_BODY
{
"name": "My Awesome Asset",
"url": "https://example.com/my_asset_to_upload.jpg"
}
REQUEST_BODY
response = http.request(request)
puts response.read_body
```
</Tab> </Tabs>
Success response
If successful, the endpoint returns a 200 response with a JSON body with the following parameters:
<Prop.List> <Prop name="job" type="AssetUploadJob" required mode="output"> The status of the asset upload job.
<PillAccordion title={<>Properties of <strong>job</strong></>} defaultExpanded={true}>
<Prop.List>
<Prop name="id" type="string" required mode="output">
The ID of the asset upload job.
</Prop>
<Prop name="status" type="string" required mode="output">
Status of the asset upload job.
<Prop.Extras>
**Available values:**
* `failed`
* `in_progress`
* `success`
</Prop.Extras>
</Prop>
<Prop name="error" type="AssetUploadError" mode="output">
If the upload fails, this object provides details about the error.
<PillAccordion title={<>Properties of <strong>error</strong></>}>
<Prop.List>
<Prop name="code" type="string" required mode="output">
A short string indicating why the upload failed. This field can be used to handle errors
programmatically.
<Prop.Extras>
**Available values:**
* `file_too_big`
* `import_failed`
* `fetch_failed`
</Prop.Extras>
</Prop>
<Prop name="message" type="string" required mode="output">
A human-readable description of what went wrong.
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
<Prop name="asset" type="Asset" mode="output">
The asset object, which contains metadata about the asset.
<PillAccordion title={<>Properties of <strong>asset</strong></>}>
<Prop.List>
<Prop name="type" type="string" required mode="output">
Type of an asset.
<Prop.Extras>
**Available values:**
* `image`
* `video`
</Prop.Extras>
</Prop>
<Prop name="id" type="string" required mode="output">
The ID of the asset.
</Prop>
<Prop name="name" type="string" required mode="output">
The name of the asset.
</Prop>
<Prop name="tags" type="string[]" required mode="output">
The user-facing tags attached to the asset.
Users can add these tags to their uploaded assets, and they can search their uploaded
assets in the Canva UI by searching for these tags. For information on how users use
tags, see the
Canva Help Center page on asset tags.
</Prop>
<Prop name="created_at" type="integer" required mode="output">
When the asset was added to Canva, as a Unix timestamp (in seconds since the Unix
Epoch).
</Prop>
<Prop name="updated_at" type="integer" required mode="output">
When the asset was last updated in Canva, as a Unix timestamp (in seconds since the
Unix Epoch).
</Prop>
<Prop name="owner" type="TeamUserSummary" required mode="output">
Metadata for the user, consisting of the User ID and Team ID.
<PillAccordion title={<>Properties of <strong>owner</strong></>}>
<Prop.List>
<Prop name="user_id" type="string" required mode="output">
The ID of the user.
</Prop>
<Prop name="team_id" type="string" required mode="output">
The ID of the user's Canva Team.
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
<Prop name="thumbnail" type="Thumbnail" mode="output">
A thumbnail image representing the object.
<PillAccordion title={<>Properties of <strong>thumbnail</strong></>}>
<Prop.List>
<Prop name="width" type="integer" required mode="output">
The width of the thumbnail image in pixels.
</Prop>
<Prop name="height" type="integer" required mode="output">
The height of the thumbnail image in pixels.
</Prop>
<Prop name="url" type="string" required mode="output">
A URL for retrieving the thumbnail image.
This URL expires after 15 minutes. This URL includes a query string
that's required for retrieving the thumbnail.
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
<Prop name="metadata" type="AssetMetadata" mode="output">
Type-specific metadata for the asset.
<Tabs>
<Tab name="image">
<Prop.List>
<Prop name="type" type="string" required mode="output">
<Prop.Extras>
**Available values:** The only valid value is `image`.
</Prop.Extras>
</Prop>
<Prop name="width" type="integer" mode="output">
The width of the image in pixels.
</Prop>
<Prop name="height" type="integer" mode="output">
The height of the image in pixels.
</Prop>
<Prop name="smart_tags" type="string[]" mode="output">
AI-generated tags for the image.
</Prop>
</Prop.List>
</Tab>
<Tab name="video">
<Prop.List>
<Prop name="type" type="string" required mode="output">
<Prop.Extras>
**Available values:** The only valid value is `video`.
</Prop.Extras>
</Prop>
<Prop name="width" type="integer" required mode="output">
The width of the video in pixels.
</Prop>
<Prop name="height" type="integer" required mode="output">
The height of the video in pixels.
</Prop>
<Prop name="duration" type="integer" mode="output">
The duration of the video in seconds.
</Prop>
</Prop.List>
</Tab>
</Tabs>
</Prop>
<Prop name="import_status" type="ImportStatus" deprecated mode="output">
The import status of the asset.
<PillAccordion title={<>Properties of <strong>import_status</strong></>}>
<Prop.List>
<Prop name="state" type="string" required mode="output">
State of the import job for an uploaded asset.
<Prop.Extras>
**Available values:**
* `failed`
* `in_progress`
* `success`
</Prop.Extras>
</Prop>
<Prop name="error" type="ImportError" deprecated mode="output">
If the import fails, this object provides details about the error.
<PillAccordion title={<>Properties of <strong>error</strong></>}>
<Prop.List>
<Prop name="message" type="string" required mode="output">
A human-readable description of what went wrong.
</Prop>
<Prop name="code" type="string" required mode="output">
A short string indicating why the upload failed. This field can be used to handle errors programmatically.
<Prop.Extras>
**Available values:**
* `file_too_big`
* `import_failed`
</Prop.Extras>
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
</Prop.List>
</PillAccordion>
</Prop> </Prop.List>
Example responses
In progress job
json
{
"job": {
"id": "e08861ae-3b29-45db-8dc1-1fe0bf7f1cc8",
"status": "in_progress"
}
}Successfully completed job
json
{
"job": {
"id": "e08861ae-3b29-45db-8dc1-1fe0bf7f1cc8",
"status": "success",
"asset": {
"id": "Msd59349ff",
"type": "image",
"name": "My Awesome Upload",
"tags": [
"image",
"holiday",
"best day ever"
],
"owner": {
"user_id": "oU123456AbCdE",
"team_id": "oB123456AbCdE"
},
"created_at": 1377396000,
"updated_at": 1692928800,
"thumbnail": {
"width": 595,
"height": 335,
"url": "https://document-export.canva.com/Vczz9/zF9vzVtdADc/2/thumbnail/0001.png?<query-string>"
}
}
}
}Failed job
json
{
"job": {
"id": "e08861ae-3b29-45db-8dc1-1fe0bf7f1cc8",
"status": "failed",
"error": {
"code": "file_too_big",
"message": "Failed to import because the file is too big"
}
}
}Get Asset
Get the metadata for an asset in the user's Project.
You can retrieve the metadata of an asset by specifying its assetId.
HTTP method and URL path
GET https://api.canva.com/rest/v1/assets/{assetId}
This operation is rate limited to 100 requests per minute for each user of your integration.
Authentication and authorization
This endpoint requires a valid access token that acts on behalf of a user.
Scopes
The access token must have all the following scopes (permissions):
asset:read
Header parameters
<Prop.List> <Prop name="Authorization" type="string" required> Provides credentials to authenticate the request, in the form of a Bearer token.
For example: `Authorization: Bearer {token}`
</Prop> </Prop.List>
Path parameters
<Prop.List> <Prop name="assetId" type="string" required> The ID of the asset. </Prop> </Prop.List>
Example request
Examples for using the /v1/assets/{assetId} endpoint:
<Tabs storageKey="example.language" disableContentTransition> <Tab name="cURL"> sh curl --request GET 'https://api.canva.com/rest/v1/assets/{assetId}' \ --header 'Authorization: Bearer {token}' </Tab>
<Tab name="Node.js"> ```js const fetch = require("node-fetch");
fetch("https://api.canva.com/rest/v1/assets/{assetId}", {
method: "GET",
headers: {
"Authorization": "Bearer {token}",
},
})
.then(async (response) => {
const data = await response.json();
console.log(data);
})
.catch(err => console.error(err));
```
</Tab>
<Tab name="Java"> ```java import java.io.IOException; import java.net.URI; import java.net.http.*;
public class ApiExample {
public static void main(String[] args) throws IOException, InterruptedException {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.canva.com/rest/v1/assets/{assetId}"))
.header("Authorization", "Bearer {token}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}
```
</Tab>
<Tab name="Python"> ```py import requests
headers = {
"Authorization": "Bearer {token}"
}
response = requests.get("https://api.canva.com/rest/v1/assets/{assetId}",
headers=headers
)
print(response.json())
```
</Tab>
<Tab name="C#"> ```csharp using System.Net.Http;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("https://api.canva.com/rest/v1/assets/{assetId}"),
Headers =
{
{ "Authorization", "Bearer {token}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
};
```
</Tab>
<Tab name="Go"> ```go package main
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.canva.com/rest/v1/assets/{assetId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer {token}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
```
</Tab>
<Tab name="PHP"> ```php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.canva.com/rest/v1/assets/{assetId}", CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array( 'Authorization: Bearer {token}', ), ));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if (empty($err)) {
echo $response;
} else {
echo "Error: " . $err;
}
```
</Tab>
<Tab name="Ruby"> ```ruby require 'net/http' require 'uri'
url = URI('https://api.canva.com/rest/v1/assets/{assetId}')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request['Authorization'] = 'Bearer {token}'
response = http.request(request)
puts response.read_body
```
</Tab> </Tabs>
Success response
If successful, the endpoint returns a 200 response with a JSON body with the following parameters:
<Prop.List> <Prop name="asset" type="Asset" required mode="output"> The asset object, which contains metadata about the asset.
<PillAccordion title={<>Properties of <strong>asset</strong></>} defaultExpanded={true}>
<Prop.List>
<Prop name="type" type="string" required mode="output">
Type of an asset.
<Prop.Extras>
**Available values:**
* `image`
* `video`
</Prop.Extras>
</Prop>
<Prop name="id" type="string" required mode="output">
The ID of the asset.
</Prop>
<Prop name="name" type="string" required mode="output">
The name of the asset.
</Prop>
<Prop name="tags" type="string[]" required mode="output">
The user-facing tags attached to the asset.
Users can add these tags to their uploaded assets, and they can search their uploaded
assets in the Canva UI by searching for these tags. For information on how users use
tags, see the
Canva Help Center page on asset tags.
</Prop>
<Prop name="created_at" type="integer" required mode="output">
When the asset was added to Canva, as a Unix timestamp (in seconds since the Unix
Epoch).
</Prop>
<Prop name="updated_at" type="integer" required mode="output">
When the asset was last updated in Canva, as a Unix timestamp (in seconds since the
Unix Epoch).
</Prop>
<Prop name="owner" type="TeamUserSummary" required mode="output">
Metadata for the user, consisting of the User ID and Team ID.
<PillAccordion title={<>Properties of <strong>owner</strong></>}>
<Prop.List>
<Prop name="user_id" type="string" required mode="output">
The ID of the user.
</Prop>
<Prop name="team_id" type="string" required mode="output">
The ID of the user's Canva Team.
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
<Prop name="thumbnail" type="Thumbnail" mode="output">
A thumbnail image representing the object.
<PillAccordion title={<>Properties of <strong>thumbnail</strong></>}>
<Prop.List>
<Prop name="width" type="integer" required mode="output">
The width of the thumbnail image in pixels.
</Prop>
<Prop name="height" type="integer" required mode="output">
The height of the thumbnail image in pixels.
</Prop>
<Prop name="url" type="string" required mode="output">
A URL for retrieving the thumbnail image.
This URL expires after 15 minutes. This URL includes a query string
that's required for retrieving the thumbnail.
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
<Prop name="metadata" type="AssetMetadata" mode="output">
Type-specific metadata for the asset.
<Tabs>
<Tab name="image">
<Prop.List>
<Prop name="type" type="string" required mode="output">
<Prop.Extras>
**Available values:** The only valid value is `image`.
</Prop.Extras>
</Prop>
<Prop name="width" type="integer" mode="output">
The width of the image in pixels.
</Prop>
<Prop name="height" type="integer" mode="output">
The height of the image in pixels.
</Prop>
<Prop name="smart_tags" type="string[]" mode="output">
AI-generated tags for the image.
</Prop>
</Prop.List>
</Tab>
<Tab name="video">
<Prop.List>
<Prop name="type" type="string" required mode="output">
<Prop.Extras>
**Available values:** The only valid value is `video`.
</Prop.Extras>
</Prop>
<Prop name="width" type="integer" required mode="output">
The width of the video in pixels.
</Prop>
<Prop name="height" type="integer" required mode="output">
The height of the video in pixels.
</Prop>
<Prop name="duration" type="integer" mode="output">
The duration of the video in seconds.
</Prop>
</Prop.List>
</Tab>
</Tabs>
</Prop>
<Prop name="import_status" type="ImportStatus" deprecated mode="output">
The import status of the asset.
<PillAccordion title={<>Properties of <strong>import_status</strong></>}>
<Prop.List>
<Prop name="state" type="string" required mode="output">
State of the import job for an uploaded asset.
<Prop.Extras>
**Available values:**
* `failed`
* `in_progress`
* `success`
</Prop.Extras>
</Prop>
<Prop name="error" type="ImportError" deprecated mode="output">
If the import fails, this object provides details about the error.
<PillAccordion title={<>Properties of <strong>error</strong></>}>
<Prop.List>
<Prop name="message" type="string" required mode="output">
A human-readable description of what went wrong.
</Prop>
<Prop name="code" type="string" required mode="output">
A short string indicating why the upload failed. This field can be used to handle errors programmatically.
<Prop.Extras>
**Available values:**
* `file_too_big`
* `import_failed`
</Prop.Extras>
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
</Prop.List>
</PillAccordion>
</Prop> </Prop.List>
Example response
json
{
"asset": {
"type": "image",
"id": "Msd59349ff",
"name": "My Awesome Upload",
"tags": [
"image",
"holiday",
"best day ever"
],
"created_at": 1377396000,
"updated_at": 1692928800,
"owner": {
"user_id": "auDAbliZ2rQNNOsUl5OLu",
"team_id": "Oi2RJILTrKk0KRhRUZozX"
},
"thumbnail": {
"width": 595,
"height": 335,
"url": "https://document-export.canva.com/Vczz9/zF9vzVtdADc/2/thumbnail/0001.png?<query-string>"
},
"metadata": {
"type": "image",
"width": 1920,
"height": 1080,
"smart_tags": [
"landscape",
"sunset",
"mountains",
"nature"
]
}
}
}Get Asset Upload Job
Get the status and results of an upload asset job.
Get the result of an asset upload job that was created using the Create asset upload job API.
You might need to make multiple requests to this endpoint until you get a success or failed status. For more information on the workflow for using asynchronous jobs, see API requests and responses.
HTTP method and URL path
GET https://api.canva.com/rest/v1/asset-uploads/{jobId}
This operation is rate limited to 180 requests per minute for each user of your integration.
Authentication and authorization
This endpoint requires a valid access token that acts on behalf of a user.
Scopes
The access token must have all the following scopes (permissions):
asset:read
Header parameters
<Prop.List> <Prop name="Authorization" type="string" required> Provides credentials to authenticate the request, in the form of a Bearer token.
For example: `Authorization: Bearer {token}`
</Prop> </Prop.List>
Path parameters
<Prop.List> <Prop name="jobId" type="string" required> The asset upload job ID. </Prop> </Prop.List>
Example request
Examples for using the /v1/asset-uploads/{jobId} endpoint:
<Tabs storageKey="example.language" disableContentTransition> <Tab name="cURL"> sh curl --request GET 'https://api.canva.com/rest/v1/asset-uploads/{jobId}' \ --header 'Authorization: Bearer {token}' </Tab>
<Tab name="Node.js"> ```js const fetch = require("node-fetch");
fetch("https://api.canva.com/rest/v1/asset-uploads/{jobId}", {
method: "GET",
headers: {
"Authorization": "Bearer {token}",
},
})
.then(async (response) => {
const data = await response.json();
console.log(data);
})
.catch(err => console.error(err));
```
</Tab>
<Tab name="Java"> ```java import java.io.IOException; import java.net.URI; import java.net.http.*;
public class ApiExample {
public static void main(String[] args) throws IOException, InterruptedException {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.canva.com/rest/v1/asset-uploads/{jobId}"))
.header("Authorization", "Bearer {token}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}
```
</Tab>
<Tab name="Python"> ```py import requests
headers = {
"Authorization": "Bearer {token}"
}
response = requests.get("https://api.canva.com/rest/v1/asset-uploads/{jobId}",
headers=headers
)
print(response.json())
```
</Tab>
<Tab name="C#"> ```csharp using System.Net.Http;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("https://api.canva.com/rest/v1/asset-uploads/{jobId}"),
Headers =
{
{ "Authorization", "Bearer {token}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
};
```
</Tab>
<Tab name="Go"> ```go package main
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.canva.com/rest/v1/asset-uploads/{jobId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer {token}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
```
</Tab>
<Tab name="PHP"> ```php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.canva.com/rest/v1/asset-uploads/{jobId}", CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array( 'Authorization: Bearer {token}', ), ));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if (empty($err)) {
echo $response;
} else {
echo "Error: " . $err;
}
```
</Tab>
<Tab name="Ruby"> ```ruby require 'net/http' require 'uri'
url = URI('https://api.canva.com/rest/v1/asset-uploads/{jobId}')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request['Authorization'] = 'Bearer {token}'
response = http.request(request)
puts response.read_body
```
</Tab> </Tabs>
Success response
If successful, the endpoint returns a 200 response with a JSON body with the following parameters:
<Prop.List> <Prop name="job" type="AssetUploadJob" required mode="output"> The status of the asset upload job.
<PillAccordion title={<>Properties of <strong>job</strong></>} defaultExpanded={true}>
<Prop.List>
<Prop name="id" type="string" required mode="output">
The ID of the asset upload job.
</Prop>
<Prop name="status" type="string" required mode="output">
Status of the asset upload job.
<Prop.Extras>
**Available values:**
* `failed`
* `in_progress`
* `success`
</Prop.Extras>
</Prop>
<Prop name="error" type="AssetUploadError" mode="output">
If the upload fails, this object provides details about the error.
<PillAccordion title={<>Properties of <strong>error</strong></>}>
<Prop.List>
<Prop name="code" type="string" required mode="output">
A short string indicating why the upload failed. This field can be used to handle errors
programmatically.
<Prop.Extras>
**Available values:**
* `file_too_big`
* `import_failed`
* `fetch_failed`
</Prop.Extras>
</Prop>
<Prop name="message" type="string" required mode="output">
A human-readable description of what went wrong.
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
<Prop name="asset" type="Asset" mode="output">
The asset object, which contains metadata about the asset.
<PillAccordion title={<>Properties of <strong>asset</strong></>}>
<Prop.List>
<Prop name="type" type="string" required mode="output">
Type of an asset.
<Prop.Extras>
**Available values:**
* `image`
* `video`
</Prop.Extras>
</Prop>
<Prop name="id" type="string" required mode="output">
The ID of the asset.
</Prop>
<Prop name="name" type="string" required mode="output">
The name of the asset.
</Prop>
<Prop name="tags" type="string[]" required mode="output">
The user-facing tags attached to the asset.
Users can add these tags to their uploaded assets, and they can search their uploaded
assets in the Canva UI by searching for these tags. For information on how users use
tags, see the
Canva Help Center page on asset tags.
</Prop>
<Prop name="created_at" type="integer" required mode="output">
When the asset was added to Canva, as a Unix timestamp (in seconds since the Unix
Epoch).
</Prop>
<Prop name="updated_at" type="integer" required mode="output">
When the asset was last updated in Canva, as a Unix timestamp (in seconds since the
Unix Epoch).
</Prop>
<Prop name="owner" type="TeamUserSummary" required mode="output">
Metadata for the user, consisting of the User ID and Team ID.
<PillAccordion title={<>Properties of <strong>owner</strong></>}>
<Prop.List>
<Prop name="user_id" type="string" required mode="output">
The ID of the user.
</Prop>
<Prop name="team_id" type="string" required mode="output">
The ID of the user's Canva Team.
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
<Prop name="thumbnail" type="Thumbnail" mode="output">
A thumbnail image representing the object.
<PillAccordion title={<>Properties of <strong>thumbnail</strong></>}>
<Prop.List>
<Prop name="width" type="integer" required mode="output">
The width of the thumbnail image in pixels.
</Prop>
<Prop name="height" type="integer" required mode="output">
The height of the thumbnail image in pixels.
</Prop>
<Prop name="url" type="string" required mode="output">
A URL for retrieving the thumbnail image.
This URL expires after 15 minutes. This URL includes a query string
that's required for retrieving the thumbnail.
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
<Prop name="metadata" type="AssetMetadata" mode="output">
Type-specific metadata for the asset.
<Tabs>
<Tab name="image">
<Prop.List>
<Prop name="type" type="string" required mode="output">
<Prop.Extras>
**Available values:** The only valid value is `image`.
</Prop.Extras>
</Prop>
<Prop name="width" type="integer" mode="output">
The width of the image in pixels.
</Prop>
<Prop name="height" type="integer" mode="output">
The height of the image in pixels.
</Prop>
<Prop name="smart_tags" type="string[]" mode="output">
AI-generated tags for the image.
</Prop>
</Prop.List>
</Tab>
<Tab name="video">
<Prop.List>
<Prop name="type" type="string" required mode="output">
<Prop.Extras>
**Available values:** The only valid value is `video`.
</Prop.Extras>
</Prop>
<Prop name="width" type="integer" required mode="output">
The width of the video in pixels.
</Prop>
<Prop name="height" type="integer" required mode="output">
The height of the video in pixels.
</Prop>
<Prop name="duration" type="integer" mode="output">
The duration of the video in seconds.
</Prop>
</Prop.List>
</Tab>
</Tabs>
</Prop>
<Prop name="import_status" type="ImportStatus" deprecated mode="output">
The import status of the asset.
<PillAccordion title={<>Properties of <strong>import_status</strong></>}>
<Prop.List>
<Prop name="state" type="string" required mode="output">
State of the import job for an uploaded asset.
<Prop.Extras>
**Available values:**
* `failed`
* `in_progress`
* `success`
</Prop.Extras>
</Prop>
<Prop name="error" type="ImportError" deprecated mode="output">
If the import fails, this object provides details about the error.
<PillAccordion title={<>Properties of <strong>error</strong></>}>
<Prop.List>
<Prop name="message" type="string" required mode="output">
A human-readable description of what went wrong.
</Prop>
<Prop name="code" type="string" required mode="output">
A short string indicating why the upload failed. This field can be used to handle errors programmatically.
<Prop.Extras>
**Available values:**
* `file_too_big`
* `import_failed`
</Prop.Extras>
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
</Prop.List>
</PillAccordion>
</Prop> </Prop.List>
Example responses
In progress job
json
{
"job": {
"id": "e08861ae-3b29-45db-8dc1-1fe0bf7f1cc8",
"status": "in_progress"
}
}Successfully completed job
json
{
"job": {
"id": "e08861ae-3b29-45db-8dc1-1fe0bf7f1cc8",
"status": "success",
"asset": {
"id": "Msd59349ff",
"type": "image",
"name": "My Awesome Upload",
"tags": [
"image",
"holiday",
"best day ever"
],
"owner": {
"user_id": "oU123456AbCdE",
"team_id": "oB123456AbCdE"
},
"created_at": 1377396000,
"updated_at": 1692928800,
"thumbnail": {
"width": 595,
"height": 335,
"url": "https://document-export.canva.com/Vczz9/zF9vzVtdADc/2/thumbnail/0001.png?<query-string>"
}
}
}
}Failed job
json
{
"job": {
"id": "e08861ae-3b29-45db-8dc1-1fe0bf7f1cc8",
"status": "failed",
"error": {
"code": "file_too_big",
"message": "Failed to import because the file is too big"
}
}
}Get URL Asset Upload Job
Get the status and results of job to upload asset from a URL.
<Warning> This API is currently provided as a preview. Be aware of the following:
- There might be unannounced breaking changes.
- Any breaking changes to preview APIs won't produce a new API version.
- Public integrations that use preview APIs will not pass the review process, and can't be made available to all Canva users. </Warning>
Get the result of an asset upload job that was created using the Create asset upload job via URL API.
You might need to make multiple requests to this endpoint until you get a success or failed status. For more information on the workflow for using asynchronous jobs, see API requests and responses.
HTTP method and URL path
GET https://api.canva.com/rest/v1/url-asset-uploads/{jobId}
This operation is rate limited to 180 requests per minute for each user of your integration.
Authentication and authorization
This endpoint requires a valid access token that acts on behalf of a user.
Scopes
The access token must have all the following scopes (permissions):
asset:read
Header parameters
<Prop.List> <Prop name="Authorization" type="string" required> Provides credentials to authenticate the request, in the form of a Bearer token.
For example: `Authorization: Bearer {token}`
</Prop> </Prop.List>
Path parameters
<Prop.List> <Prop name="jobId" type="string" required> The asset upload job ID. </Prop> </Prop.List>
Example request
Examples for using the /v1/url-asset-uploads/{jobId} endpoint:
<Tabs storageKey="example.language" disableContentTransition> <Tab name="cURL"> sh curl --request GET 'https://api.canva.com/rest/v1/url-asset-uploads/{jobId}' \ --header 'Authorization: Bearer {token}' </Tab>
<Tab name="Node.js"> ```js const fetch = require("node-fetch");
fetch("https://api.canva.com/rest/v1/url-asset-uploads/{jobId}", {
method: "GET",
headers: {
"Authorization": "Bearer {token}",
},
})
.then(async (response) => {
const data = await response.json();
console.log(data);
})
.catch(err => console.error(err));
```
</Tab>
<Tab name="Java"> ```java import java.io.IOException; import java.net.URI; import java.net.http.*;
public class ApiExample {
public static void main(String[] args) throws IOException, InterruptedException {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.canva.com/rest/v1/url-asset-uploads/{jobId}"))
.header("Authorization", "Bearer {token}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}
```
</Tab>
<Tab name="Python"> ```py import requests
headers = {
"Authorization": "Bearer {token}"
}
response = requests.get("https://api.canva.com/rest/v1/url-asset-uploads/{jobId}",
headers=headers
)
print(response.json())
```
</Tab>
<Tab name="C#"> ```csharp using System.Net.Http;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("https://api.canva.com/rest/v1/url-asset-uploads/{jobId}"),
Headers =
{
{ "Authorization", "Bearer {token}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
};
```
</Tab>
<Tab name="Go"> ```go package main
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.canva.com/rest/v1/url-asset-uploads/{jobId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer {token}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
```
</Tab>
<Tab name="PHP"> ```php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.canva.com/rest/v1/url-asset-uploads/{jobId}", CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array( 'Authorization: Bearer {token}', ), ));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if (empty($err)) {
echo $response;
} else {
echo "Error: " . $err;
}
```
</Tab>
<Tab name="Ruby"> ```ruby require 'net/http' require 'uri'
url = URI('https://api.canva.com/rest/v1/url-asset-uploads/{jobId}')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request['Authorization'] = 'Bearer {token}'
response = http.request(request)
puts response.read_body
```
</Tab> </Tabs>
Success response
If successful, the endpoint returns a 200 response with a JSON body with the following parameters:
<Prop.List> <Prop name="job" type="AssetUploadJob" required mode="output"> The status of the asset upload job.
<PillAccordion title={<>Properties of <strong>job</strong></>} defaultExpanded={true}>
<Prop.List>
<Prop name="id" type="string" required mode="output">
The ID of the asset upload job.
</Prop>
<Prop name="status" type="string" required mode="output">
Status of the asset upload job.
<Prop.Extras>
**Available values:**
* `failed`
* `in_progress`
* `success`
</Prop.Extras>
</Prop>
<Prop name="error" type="AssetUploadError" mode="output">
If the upload fails, this object provides details about the error.
<PillAccordion title={<>Properties of <strong>error</strong></>}>
<Prop.List>
<Prop name="code" type="string" required mode="output">
A short string indicating why the upload failed. This field can be used to handle errors
programmatically.
<Prop.Extras>
**Available values:**
* `file_too_big`
* `import_failed`
* `fetch_failed`
</Prop.Extras>
</Prop>
<Prop name="message" type="string" required mode="output">
A human-readable description of what went wrong.
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
<Prop name="asset" type="Asset" mode="output">
The asset object, which contains metadata about the asset.
<PillAccordion title={<>Properties of <strong>asset</strong></>}>
<Prop.List>
<Prop name="type" type="string" required mode="output">
Type of an asset.
<Prop.Extras>
**Available values:**
* `image`
* `video`
</Prop.Extras>
</Prop>
<Prop name="id" type="string" required mode="output">
The ID of the asset.
</Prop>
<Prop name="name" type="string" required mode="output">
The name of the asset.
</Prop>
<Prop name="tags" type="string[]" required mode="output">
The user-facing tags attached to the asset.
Users can add these tags to their uploaded assets, and they can search their uploaded
assets in the Canva UI by searching for these tags. For information on how users use
tags, see the
Canva Help Center page on asset tags.
</Prop>
<Prop name="created_at" type="integer" required mode="output">
When the asset was added to Canva, as a Unix timestamp (in seconds since the Unix
Epoch).
</Prop>
<Prop name="updated_at" type="integer" required mode="output">
When the asset was last updated in Canva, as a Unix timestamp (in seconds since the
Unix Epoch).
</Prop>
<Prop name="owner" type="TeamUserSummary" required mode="output">
Metadata for the user, consisting of the User ID and Team ID.
<PillAccordion title={<>Properties of <strong>owner</strong></>}>
<Prop.List>
<Prop name="user_id" type="string" required mode="output">
The ID of the user.
</Prop>
<Prop name="team_id" type="string" required mode="output">
The ID of the user's Canva Team.
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
<Prop name="thumbnail" type="Thumbnail" mode="output">
A thumbnail image representing the object.
<PillAccordion title={<>Properties of <strong>thumbnail</strong></>}>
<Prop.List>
<Prop name="width" type="integer" required mode="output">
The width of the thumbnail image in pixels.
</Prop>
<Prop name="height" type="integer" required mode="output">
The height of the thumbnail image in pixels.
</Prop>
<Prop name="url" type="string" required mode="output">
A URL for retrieving the thumbnail image.
This URL expires after 15 minutes. This URL includes a query string
that's required for retrieving the thumbnail.
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
<Prop name="metadata" type="AssetMetadata" mode="output">
Type-specific metadata for the asset.
<Tabs>
<Tab name="image">
<Prop.List>
<Prop name="type" type="string" required mode="output">
<Prop.Extras>
**Available values:** The only valid value is `image`.
</Prop.Extras>
</Prop>
<Prop name="width" type="integer" mode="output">
The width of the image in pixels.
</Prop>
<Prop name="height" type="integer" mode="output">
The height of the image in pixels.
</Prop>
<Prop name="smart_tags" type="string[]" mode="output">
AI-generated tags for the image.
</Prop>
</Prop.List>
</Tab>
<Tab name="video">
<Prop.List>
<Prop name="type" type="string" required mode="output">
<Prop.Extras>
**Available values:** The only valid value is `video`.
</Prop.Extras>
</Prop>
<Prop name="width" type="integer" required mode="output">
The width of the video in pixels.
</Prop>
<Prop name="height" type="integer" required mode="output">
The height of the video in pixels.
</Prop>
<Prop name="duration" type="integer" mode="output">
The duration of the video in seconds.
</Prop>
</Prop.List>
</Tab>
</Tabs>
</Prop>
<Prop name="import_status" type="ImportStatus" deprecated mode="output">
The import status of the asset.
<PillAccordion title={<>Properties of <strong>import_status</strong></>}>
<Prop.List>
<Prop name="state" type="string" required mode="output">
State of the import job for an uploaded asset.
<Prop.Extras>
**Available values:**
* `failed`
* `in_progress`
* `success`
</Prop.Extras>
</Prop>
<Prop name="error" type="ImportError" deprecated mode="output">
If the import fails, this object provides details about the error.
<PillAccordion title={<>Properties of <strong>error</strong></>}>
<Prop.List>
<Prop name="message" type="string" required mode="output">
A human-readable description of what went wrong.
</Prop>
<Prop name="code" type="string" required mode="output">
A short string indicating why the upload failed. This field can be used to handle errors programmatically.
<Prop.Extras>
**Available values:**
* `file_too_big`
* `import_failed`
</Prop.Extras>
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
</Prop.List>
</PillAccordion>
</Prop> </Prop.List>
Example responses
In progress job
json
{
"job": {
"id": "e08861ae-3b29-45db-8dc1-1fe0bf7f1cc8",
"status": "in_progress"
}
}Successfully completed job
json
{
"job": {
"id": "e08861ae-3b29-45db-8dc1-1fe0bf7f1cc8",
"status": "success",
"asset": {
"id": "Msd59349ff",
"type": "image",
"name": "My Awesome Upload",
"tags": [
"image",
"holiday",
"best day ever"
],
"owner": {
"user_id": "oU123456AbCdE",
"team_id": "oB123456AbCdE"
},
"created_at": 1377396000,
"updated_at": 1692928800,
"thumbnail": {
"width": 595,
"height": 335,
"url": "https://document-export.canva.com/Vczz9/zF9vzVtdADc/2/thumbnail/0001.png?<query-string>"
}
}
}
}Failed job
json
{
"job": {
"id": "e08861ae-3b29-45db-8dc1-1fe0bf7f1cc8",
"status": "failed",
"error": {
"code": "file_too_big",
"message": "Failed to import because the file is too big"
}
}
}Update Asset
Update the metadata for an asset in the users Projects.
You can update the name and tags of an asset by specifying its assetId. Updating the tags replaces all existing tags of the asset.
HTTP method and URL path
PATCH https://api.canva.com/rest/v1/assets/{assetId}
This operation is rate limited to 30 requests per minute for each user of your integration.
Authentication and authorization
This endpoint requires a valid access token that acts on behalf of a user.
Scopes
The access token must have all the following scopes (permissions):
asset:write
Header parameters
<Prop.List> <Prop name="Authorization" type="string" required> Provides credentials to authenticate the request, in the form of a Bearer token.
For example: `Authorization: Bearer {token}`
</Prop>
<Prop name="Content-Type" type="string" required> Indicates the media type of the information sent in the request. This must be set to application/json.
For example: `Content-Type: application/json`
</Prop> </Prop.List>
Path parameters
<Prop.List> <Prop name="assetId" type="string" required> The ID of the asset. </Prop> </Prop.List>
Body parameters
<Prop.List> <Prop name="name" type="string"> The name of the asset. This is shown in the Canva UI. When this field is undefined or empty, nothing is updated.
<Prop.Extras>
**Maximum length:** `50`
</Prop.Extras>
</Prop>
<Prop name="tags" type="string[]"> The replacement tags for the asset. When this field is undefined, nothing is updated.
<Prop.Extras>
**Maximum items:** `50`
</Prop.Extras>
</Prop> </Prop.List>
Example request
Examples for using the /v1/assets/{assetId} endpoint:
<Tabs storageKey="example.language" disableContentTransition> <Tab name="cURL"> sh curl --request PATCH 'https://api.canva.com/rest/v1/assets/{assetId}' \ --header 'Authorization: Bearer {token}' \ --header 'Content-Type: application/json' \ --data '{ "name": "My Awesome Upload", "tags": [ "image", "holiday", "best day ever" ] }' </Tab>
<Tab name="Node.js"> ```js const fetch = require("node-fetch");
fetch("https://api.canva.com/rest/v1/assets/{assetId}", {
method: "PATCH",
headers: {
"Authorization": "Bearer {token}",
"Content-Type": "application/json",
},
body: JSON.stringify({
"name": "My Awesome Upload",
"tags": [
"image",
"holiday",
"best day ever"
]
}),
})
.then(async (response) => {
const data = await response.json();
console.log(data);
})
.catch(err => console.error(err));
```
</Tab>
<Tab name="Java"> ```java import java.io.IOException; import java.net.URI; import java.net.http.*;
public class ApiExample {
public static void main(String[] args) throws IOException, InterruptedException {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.canva.com/rest/v1/assets/{assetId}"))
.header("Authorization", "Bearer {token}")
.header("Content-Type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\"name\": \"My Awesome Upload\", \"tags\": [\"image\", \"holiday\", \"best day ever\"]}"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}
```
</Tab>
<Tab name="Python"> ```py import requests
headers = {
"Authorization": "Bearer {token}",
"Content-Type": "application/json"
}
data = {
"name": "My Awesome Upload",
"tags": [
"image",
"holiday",
"best day ever"
]
}
response = requests.patch("https://api.canva.com/rest/v1/assets/{assetId}",
headers=headers,
json=data
)
print(response.json())
```
</Tab>
<Tab name="C#"> ```csharp using System.Net.Http;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("https://api.canva.com/rest/v1/assets/{assetId}"),
Headers =
{
{ "Authorization", "Bearer {token}" },
},
Content = new StringContent(
"{\"name\": \"My Awesome Upload\", \"tags\": [\"image\", \"holiday\", \"best day ever\"]}",
Encoding.UTF8,
"application/json"
),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
};
```
</Tab>
<Tab name="Go"> ```go package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
payload := strings.NewReader(`{
"name": "My Awesome Upload",
"tags": [
"image",
"holiday",
"best day ever"
]
}`)
url := "https://api.canva.com/rest/v1/assets/{assetId}"
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer {token}")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
```
</Tab>
<Tab name="PHP"> ```php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.canva.com/rest/v1/assets/{assetId}", CURLOPT_CUSTOMREQUEST => "PATCH", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array( 'Authorization: Bearer {token}', 'Content-Type: application/json', ), CURLOPT_POSTFIELDS => json_encode([ "name" => "My Awesome Upload", "tags" => [ "image", "holiday", "best day ever" ] ]) ));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if (empty($err)) {
echo $response;
} else {
echo "Error: " . $err;
}
```
</Tab>
<Tab name="Ruby"> ```ruby require 'net/http' require 'uri'
url = URI('https://api.canva.com/rest/v1/assets/{assetId}')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request['Authorization'] = 'Bearer {token}'
request['Content-Type'] = 'application/json'
request.body = <<REQUEST_BODY
{
"name": "My Awesome Upload",
"tags": [
"image",
"holiday",
"best day ever"
]
}
REQUEST_BODY
response = http.request(request)
puts response.read_body
```
</Tab> </Tabs>
Success response
If successful, the endpoint returns a 200 response with a JSON body with the following parameters:
<Prop.List> <Prop name="asset" type="Asset" required mode="output"> The asset object, which contains metadata about the asset.
<PillAccordion title={<>Properties of <strong>asset</strong></>} defaultExpanded={true}>
<Prop.List>
<Prop name="type" type="string" required mode="output">
Type of an asset.
<Prop.Extras>
**Available values:**
* `image`
* `video`
</Prop.Extras>
</Prop>
<Prop name="id" type="string" required mode="output">
The ID of the asset.
</Prop>
<Prop name="name" type="string" required mode="output">
The name of the asset.
</Prop>
<Prop name="tags" type="string[]" required mode="output">
The user-facing tags attached to the asset.
Users can add these tags to their uploaded assets, and they can search their uploaded
assets in the Canva UI by searching for these tags. For information on how users use
tags, see the
Canva Help Center page on asset tags.
</Prop>
<Prop name="created_at" type="integer" required mode="output">
When the asset was added to Canva, as a Unix timestamp (in seconds since the Unix
Epoch).
</Prop>
<Prop name="updated_at" type="integer" required mode="output">
When the asset was last updated in Canva, as a Unix timestamp (in seconds since the
Unix Epoch).
</Prop>
<Prop name="owner" type="TeamUserSummary" required mode="output">
Metadata for the user, consisting of the User ID and Team ID.
<PillAccordion title={<>Properties of <strong>owner</strong></>}>
<Prop.List>
<Prop name="user_id" type="string" required mode="output">
The ID of the user.
</Prop>
<Prop name="team_id" type="string" required mode="output">
The ID of the user's Canva Team.
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
<Prop name="thumbnail" type="Thumbnail" mode="output">
A thumbnail image representing the object.
<PillAccordion title={<>Properties of <strong>thumbnail</strong></>}>
<Prop.List>
<Prop name="width" type="integer" required mode="output">
The width of the thumbnail image in pixels.
</Prop>
<Prop name="height" type="integer" required mode="output">
The height of the thumbnail image in pixels.
</Prop>
<Prop name="url" type="string" required mode="output">
A URL for retrieving the thumbnail image.
This URL expires after 15 minutes. This URL includes a query string
that's required for retrieving the thumbnail.
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
<Prop name="metadata" type="AssetMetadata" mode="output">
Type-specific metadata for the asset.
<Tabs>
<Tab name="image">
<Prop.List>
<Prop name="type" type="string" required mode="output">
<Prop.Extras>
**Available values:** The only valid value is `image`.
</Prop.Extras>
</Prop>
<Prop name="width" type="integer" mode="output">
The width of the image in pixels.
</Prop>
<Prop name="height" type="integer" mode="output">
The height of the image in pixels.
</Prop>
<Prop name="smart_tags" type="string[]" mode="output">
AI-generated tags for the image.
</Prop>
</Prop.List>
</Tab>
<Tab name="video">
<Prop.List>
<Prop name="type" type="string" required mode="output">
<Prop.Extras>
**Available values:** The only valid value is `video`.
</Prop.Extras>
</Prop>
<Prop name="width" type="integer" required mode="output">
The width of the video in pixels.
</Prop>
<Prop name="height" type="integer" required mode="output">
The height of the video in pixels.
</Prop>
<Prop name="duration" type="integer" mode="output">
The duration of the video in seconds.
</Prop>
</Prop.List>
</Tab>
</Tabs>
</Prop>
<Prop name="import_status" type="ImportStatus" deprecated mode="output">
The import status of the asset.
<PillAccordion title={<>Properties of <strong>import_status</strong></>}>
<Prop.List>
<Prop name="state" type="string" required mode="output">
State of the import job for an uploaded asset.
<Prop.Extras>
**Available values:**
* `failed`
* `in_progress`
* `success`
</Prop.Extras>
</Prop>
<Prop name="error" type="ImportError" deprecated mode="output">
If the import fails, this object provides details about the error.
<PillAccordion title={<>Properties of <strong>error</strong></>}>
<Prop.List>
<Prop name="message" type="string" required mode="output">
A human-readable description of what went wrong.
</Prop>
<Prop name="code" type="string" required mode="output">
A short string indicating why the upload failed. This field can be used to handle errors programmatically.
<Prop.Extras>
**Available values:**
* `file_too_big`
* `import_failed`
</Prop.Extras>
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
</Prop.List>
</PillAccordion>
</Prop>
</Prop.List>
</PillAccordion>
</Prop> </Prop.List>
Example response
json
{
"asset": {
"type": "image",
"id": "Msd59349ff",
"name": "My Awesome Upload",
"tags": [
"image",
"holiday",
"best day ever"
],
"created_at": 1377396000,
"updated_at": 1692928800,
"owner": {
"user_id": "auDAbliZ2rQNNOsUl5OLu",
"team_id": "Oi2RJILTrKk0KRhRUZozX"
},
"thumbnail": {
"width": 595,
"height": 335,
"url": "https://document-export.canva.com/Vczz9/zF9vzVtdADc/2/thumbnail/0001.png?<query-string>"
},
"metadata": {
"type": "image",
"width": 1920,
"height": 1080,
"smart_tags": [
"landscape",
"sunset",
"mountains",
"nature"
]
}
}
}Delete Asset
Delete an asset from the user's Projects.
You can delete an asset by specifying its assetId. This operation mirrors the behavior in the Canva UI. Deleting an item moves it to the trash. Deleting an asset doesn't remove it from designs that already use it.
HTTP method and URL path
DELETE https://api.canva.com/rest/v1/assets/{assetId}
This operation is rate limited to 30 requests per minute for each user of your integration.
Authentication and authorization
This endpoint requires a valid access token that acts on behalf of a user.
Scopes
The access token must have all the following scopes (permissions):
asset:write
Header parameters
<Prop.List> <Prop name="Authorization" type="string" required> Provides credentials to authenticate the request, in the form of a Bearer token.
For example: `Authorization: Bearer {token}`
</Prop> </Prop.List>
Path parameters
<Prop.List> <Prop name="assetId" type="string" required> The ID of the asset. </Prop> </Prop.List>
Example request
Examples for using the /v1/assets/{assetId} endpoint:
<Tabs storageKey="example.language" disableContentTransition> <Tab name="cURL"> sh curl --request DELETE 'https://api.canva.com/rest/v1/assets/{assetId}' \ --header 'Authorization: Bearer {token}' </Tab>
<Tab name="Node.js"> ```js const fetch = require("node-fetch");
fetch("https://api.canva.com/rest/v1/assets/{assetId}", {
method: "DELETE",
headers: {
"Authorization": "Bearer {token}",
},
})
.then(async (response) => {
const data = await response.json();
console.log(data);
})
.catch(err => console.error(err));
```
</Tab>
<Tab name="Java"> ```java import java.io.IOException; import java.net.URI; import java.net.http.*;
public class ApiExample {
public static void main(String[] args) throws IOException, InterruptedException {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.canva.com/rest/v1/assets/{assetId}"))
.header("Authorization", "Bearer {token}")
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}
```
</Tab>
<Tab name="Python"> ```py import requests
headers = {
"Authorization": "Bearer {token}"
}
response = requests.delete("https://api.canva.com/rest/v1/assets/{assetId}",
headers=headers
)
print(response.json())
```
</Tab>
<Tab name="C#"> ```csharp using System.Net.Http;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("https://api.canva.com/rest/v1/assets/{assetId}"),
Headers =
{
{ "Authorization", "Bearer {token}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
};
```
</Tab>
<Tab name="Go"> ```go package main
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.canva.com/rest/v1/assets/{assetId}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer {token}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
```
</Tab>
<Tab name="PHP"> ```php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.canva.com/rest/v1/assets/{assetId}", CURLOPT_CUSTOMREQUEST => "DELETE", CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array( 'Authorization: Bearer {token}', ), ));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if (empty($err)) {
echo $response;
} else {
echo "Error: " . $err;
}
```
</Tab>
<Tab name="Ruby"> ```ruby require 'net/http' require 'uri'
url = URI('https://api.canva.com/rest/v1/assets/{assetId}')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request['Authorization'] = 'Bearer {token}'
response = http.request(request)
puts response.read_body
```
</Tab> </Tabs>
Success response
If successful, the endpoint returns the status code 204 No content without a response body.