Avoiding duplicate images in cloudflare

Hi, I’m doing a Cloudflare Images implementation in a microservice architecture but I would like to only create a given image once and then update that given image with potential changes instead of uploading a new image.

I see 3 ways to solve this:

  1. Query images for an ID reference that I store in the uploaded image’s metadata, however it seems i would have to make paginated list calls to see if the image already exists.
  2. Just upload a new image, leaving alot of unused images, however since there is not expiration for unused images, I would have to create a job to iterate all images and clean up unused images.
  3. Maintain a table of Cloudflare image ID’s locally in my service.

I would obviously prefer option 1 if there was some way to search for specific meta properties, but it looks like i might have to go with option 3?

Hi, there is no metadata search in Images. What type of search you’d like to have for your use case?

The below link helped me solve my issue by using a custom ID when uploading the image:

Although I should note this “id” parameter is not documented in the API reference :slight_smile: