Skip to main content

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_ASSET or READ_WRITE_ASSET

Path Parameters​

ParameterTypeDescription
idStringRequired. 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​

FieldTypeDescription
idStringUnique identifier of the asset.
nameStringName of the file or folder.
typeStringfolder for folders, or the file type for files (for example image/webp).
parentFolderStringID of the folder that contains the asset. null at the top level.
linkStringPublic URL of the file. Files only.
keyStringStorage path of the file. Files only.
sizeNumberSize in bytes.
titleStringTitle of the file.
altTextStringAlternative text for images.
tagsArrayTags added to the asset.
assignedProductsArrayIDs of the products the asset is assigned to.
assignedCategoriesArrayIDs of the categories the asset is assigned to.
sourceUrlStringOriginal URL the file was imported from, if any.
createdAtStringDate and time the asset was created (ISO 8601).
updatedAtStringDate and time the asset was last updated (ISO 8601).

Notes​

  • If no asset matches the ID, data is an empty object.