{ result: 'not found' }

silver_seeker Member Posts: 1

Hey ,I'm always getting this response whenever I send a delete request to my files.

this is my function

(async function upload() {

  const result = await cloudinary.uploader.destroy(


    { folder: "avatars" }





Best Answer

  • aleksandar
    aleksandar Member, Cloudinary Staff Posts: 14
    Answer ✓

    Hi @silver_seeker ,

    When using the destroy() method, the first parameter should be the public_id and from the code you shared, I see you are passing a URL. Due to this, you're getting the error (correctly) because no public_id with the value you supplied exists in your cloud.

    To resolve the issue you will want to make the following changes:

    1. Removing the folder parameter since that is not relevant for destroy() calls. Please see the Documentation for the destroy() method (https://cloudinary.com/documentation/image_upload_api_reference#destroy) with details of all accepted parameters by this method/endpoint.
    2. The public_id of the asset based on the URL you shared will be avatars/td4uoxclnlmm8xhiutzo - therefore, if you supply this as the first parameter to the destroy() method your request should work. Please see this section of the Documentation in regards to the Public ID - https://cloudinary.com/documentation/cloudinary_glossary#public_id
    3. Optionally, you can also include the invalidate parameter set to true if you would like the CDN cache to be invalidated such that existing URLs of the deleted asset will now return 404 errors (when accessed) rather than potentially returning a cached copy of the deleted asset.

    Please try this out and let us know if it works for you.