Cloud HostingLaunch UnoPim on fully-managed cloud hosting — fast, secure and cost-effective plans.
Skip to content

Media Files API

This page shows you how to upload media files (such as images) for a product or a category and get back the stored file path, plus how to read and delete existing media. Uploaded files are linked to their SKU or category code and a specific attribute.

Common Headers

Every request on this page sends the same two headers:

KeyValue
Acceptapplication/json
AuthorizationBearer access_token

Product Media Upload

Uploads a media file and attaches it to a product's media attribute.

Gallery Attribute file type support

Gallery-type attributes now support video files along with images. This API can be used to upload both images and videos, but only when the target attribute is of type gallery.

POST {{url}}/api/v1/rest/media-files/product

Headers — use the Common Headers.

The request takes these parameters:

NameDescriptionType
fileThe media file to be uploaded.File
skuProduct SKU to associate the fileString
attributeMedia attribute (e.g., image)String

Send them as form fields, for example:

KeyValue
file(Select file)
sku1111111304
attributeimage

🔔 Note: The "file" field here represents the local file path on your system for illustrative purposes. In a real API call, the file is uploaded via multipart/form-data, not as JSON.

Response

The stored file path is returned so you can reference it in product values:

Response
json
{
  "success": true,
  "message": "Product file uploaded successfully.",
  "data": {
    "attribute": "image",
    "sku": "1111111304",
    "filePath": "product/12/image/4099514009964_2.jpg"
  }
}

Category Media Upload

Uploads a media file and attaches it to a category's media field.

POST {{url}}/api/v1/rest/media-files/category

Headers — use the Common Headers.

The request takes these parameters:

NameDescriptionType
fileThe media file to be uploaded.File
codeCategory code to associate the fileString
category_fieldMedia attribute (e.g., image)String

Send them as form fields, for example:

KeyValue
file(Select file)
codeelectronic3
category_fieldfile

🔔 Note: The "file" field here represents the local file path on your system for illustrative purposes. In a real API call, the file is uploaded via multipart/form-data, not as JSON.

Response

The stored file path is returned so you can reference it in category data:

Response
json
{
  "success": true,
  "message": "Category file uploaded successfully.",
  "data": {
      "field": "file",
      "code": "master",
      "filePath": "category/2/file/4099514009964_2.jpg"
  }
}

Read Media 3.0

Lists the file paths already stored for a product, category, or swatch. Media files are identified by query parameters, not path segments:

GET {{url}}/api/v1/rest/media-files/product?sku=shirt-1&attribute=image
GET {{url}}/api/v1/rest/media-files/category?code=apparel&category_field=banner
GET {{url}}/api/v1/rest/media-files/swatch?code=red&attribute_code=color

Response

The matching file paths come back as a simple array:

json
{
    "data": [
        "product/1/image/shirt-front.webp"
    ]
}

Delete Media 3.0

Removes stored media using the same parameter scheme with the DELETE verb:

DELETE {{url}}/api/v1/rest/media-files/product?sku=shirt-1&attribute=image

Response

A successful deletion returns a confirmation message:

json
{
    "success": true,
    "message": "Deleted successfully."
}

Released under the MIT License.