How to get private image using public id with Admin API?

Kyriacos Member Posts: 8


I am using signed uploads, which means my backend generates parameters, including a public id, and a signed signature for the frontend to use to upload an image.

Some of the images that are uploaded have type = private. On my backend, I query Cloudinary for the images that the backend has generated a signature for using the get resource by public id Admin API However, I noticed that if an image is private, this endpoint returns a 404. On the other hand, if I query for the image using the get resource by asset id API, it works.

The problem is that I do not have the asset id on the backend at the moment I'm trying to query for the resource, since the backend has only generated a signature and has no knowledge of the upload progress made by the frontend. (I have webhook notifications setup - but for I'm implementing a mechanism to sync without webhooks.) Therefore, I can only query for the asset using the public id, but this does not seem to work.

Is there any way around this?


  • Zachary
    Zachary Member, Cloudinary Staff Posts: 35

    Hi there,

    If you are looking up a single resource by public id the default type will be upload, you'll need to update this for assets of type private.

    { type: 'private'})
    I hope this helps, please let us know if you still run into any issues and feel free to always open a ticket with support.

    Read more via our documentation on the subject

  • Kyriacos
    Kyriacos Member Posts: 8
    edited June 27

    Hi Zachary,

    Your suggestion has been very helpful. Thank you very much!