Skip to main content

Nodejs: How can I check if public_id exists on Cloudinary?



  • Sam Brace

    Gabriel - One technique is to try and get details for the specific asset by declaring its Public ID. If the asset doesn't exist in your system, it will return an error.

    Here's a code sample, using Node.js, to try and retrieve a file with a Public ID of "kitten". 

    const cloudinary = require('cloudinary').v2;

    .then(result => console.log(result))
    .catch(error => console.error(error));

    I would try this and see if it works for you. More details about this Admin API method can be found here:

    Yours Truly,


  • Gabriel Martinez

    Hi Sam,

    Thank you very much for your quick reply. I will check this method right away.


Post is closed for comments.