Skip to content

Update Product Images

Update image order or delete images for a product variant.

Endpoint

PUT /v1/products/variant/image/store/?id={variant_id}&product_id={product_id}

Authentication

Required (Store role)

Query Parameters

Parameter Type Required Description
id integer Yes Variant ID
product_id integer Yes Product ID

Request Body

Content-Type: multipart/form-data

Form Fields

Field Type Required Description
order_images string No JSON string for updating image order
delete_images string No Comma-separated image IDs to delete

Order Images Format

The order_images field should be a JSON string:

[
  {
    "id": 1,
    "order": 2
  },
  {
    "id": 2,
    "order": 1
  }
]

Response

Success (200 OK)

{
  "success": "Product Images Updated"
}

Error Responses

Product Not Found (404)

{
  "error": "Product not found"
}

Variant Not Found (404)

{
  "error": "Product Variant not found"
}

Example Request

curl -X PUT "https://api.luxmart.site/v1/products/variant/image/store/?id=1&product_id=5" \
  -H "Authorization: Token your_access_token" \
  -F 'order_images=[{"id":1,"order":2},{"id":2,"order":1}]' \
  -F "delete_images=3,4"

Notes

  • Product must belong to the authenticated store
  • Variant must belong to the specified product
  • Image order can be updated by providing order_images
  • Images can be deleted by providing delete_images
  • Both operations can be performed in the same request