How can I get a list of Image files in the CMS? And how can I delete a list of them?

I need to get a list of image files in the CMS (File Manager) so I can delete some of them. I also need to know if any of the APIs allow deletion by File ID.

Good morning, André!

You can export a spreadsheet with the link to all images in the Catalog module, under the Import and Export menu → in the Export Images option.

If you’d like to download these images, you can do so using the links obtained with an external bulk download tool.

To delete the images, you can use the Delete SKU image file API

It turns out that no images appear in my Image List

But when I check the CMS, there are several images that had been uploaded previously

This accumulation occurred when we were in the development phase and ran the Manutenção de Base (Full Cleanup) | VTEX Help Center procedure, in which the associated items should have been deleted but were not.

Hi @andre16!

I understand the situation… Did those images that ended up remaining in the CMS after the Full Cleanup cause any additional issues in your store? Did you notice any errors or run into any problems because of it?

I’m looking into this internally, but unfortunately I don’t think there’s a way to obtain the list you’re looking for after the Full Cleanup has been performed.

And how can I delete these files, considering the high volume?

Good morning, @andre16!

Let’s get into it… Regarding the images remaining in the CMS after the Full Cleanup: This is actually the expected behavior. I understand there’s no warning about this in the documentation, and that’s why we’ve requested a review. However, many customers end up using the same images when re-registering their catalog.

If the images remaining in the CMS aren’t causing any additional errors in your store — which I believe is the case, based on the analysis I’ve done on a few other stores — we don’t recommend deleting them, okay?

Now, if you really do want to delete them, there’s no native way to perform a bulk deletion after the Full Cleanup. The only way is through the button available in the admin:

To speed up the process, there’s the option of creating a Python automation script to control the browser and perform the “manual deletion” in an automated way — but this will require some programming knowledge from your team.

Is there any way to link the SKU to the photos via API?

It does exist!

Through the Create SKU file API or, depending on the situation, through the Update SKU file API.

Karina Mota
Field Software Engineer | VTEX

In both APIs, it is done through an External Link. Is there a way to link an Image that is already in the CMS to a SKU?

Good morning, @andre16!

I ran a test here using an internal CMS link and it worked fine, see:

The thing in this case is that to use an internal link I already had the address of that image, which can be obtained via export. That said, for this method to work, you would need to have exported the image files and their respective URLs before performing the Full Cleanup.