Get Asset by ID
Retrieves a single item from your store's asset library. An item is either a folder or a file, such as an image or a PDF.
HTTP Request
- URL:
/asset/{id} - Method:
GET - Headers:
accessToken: Required. Your API access token.
- Required scope:
READ_ASSETorREAD_WRITE_ASSET
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | String | Required. The ID of the asset to retrieve. |
cURL Example
curl --location '<BASE_URL>/asset/6650d4e1a2b3c4d5e6f70812' \
--header 'accessToken: <ACCESS_TOKEN>'
Response
- 200 OK: The asset was returned successfully.
- 400 Bad Request: The access token is missing, invalid or lacks the required scope, or the asset ID is not valid.
Sample JSON Response
{
"success": true,
"data": {
"id": "6650d4e1a2b3c4d5e6f70812",
"name": "cordless-drill-18v.webp",
"type": "image/webp",
"parentFolder": "664f1e685ef340dfe52581ea",
"link": "https://cdn.example.com/assets/products/cordless-drill-18v.webp",
"key": "assets/products/cordless-drill-18v.webp",
"size": 48213,
"title": "Cordless drill 18V",
"altText": "18V cordless drill with battery pack",
"tags": ["drills", "power-tools"],
"assignedProducts": ["65f1c9a2b7e4d3a1c2f00a11"],
"assignedCategories": [],
"sourceUrl": "https://images.example.com/drill-18v.png",
"createdAt": "2024-05-24T09:12:33.410Z",
"updatedAt": "2024-09-06T14:06:10.817Z"
}
}
Response Details
Asset Data
| Field | Type | Description |
|---|---|---|
id | String | Unique identifier of the asset. |
name | String | Name of the file or folder. |
type | String | folder for folders, or the file type for files (for example image/webp). |
parentFolder | String | ID of the folder that contains the asset. null at the top level. |
link | String | Public URL of the file. Files only. |
key | String | Storage path of the file. Files only. |
size | Number | Size in bytes. |
title | String | Title of the file. |
altText | String | Alternative text for images. |
tags | Array | Tags added to the asset. |
assignedProducts | Array | IDs of the products the asset is assigned to. |
assignedCategories | Array | IDs of the categories the asset is assigned to. |
sourceUrl | String | Original URL the file was imported from, if any. |
createdAt | String | Date and time the asset was created (ISO 8601). |
updatedAt | String | Date and time the asset was last updated (ISO 8601). |
Notes
- If no asset matches the ID,
datais an empty object.