For an SKU, I have multiple images. Every time I change something related to the SKU, I do a PUT. But before that I also DELETE the images using in a loop


Only the first image is getting deleted in this way.

For others the API is giving me "Product cannot be saved... " and does not delete.

So what is the best way to DELETE (all the images) and then POST new images. I PUT the product and then POST the images. Is this correct? Will there be any caching issues?

1 Answer 1


You can delete all images by POSTing the product with an empty media_gallery_entries key:

{"sku": sku, "media_gallery_entries": []}

You can add new ones by using the same call with a non-empty media_gallery_entries key:

{"sku": sku, "media_gallery_entries": [...]}
  • Thank you @bfontaine.This is what I ended up doing.
    – Scorpy47
    Commented Feb 8, 2021 at 23:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.