Is it possible to limit access to a specific folder using the Upload and/or Media Library Widget?

Alexander Member Posts: 2
edited February 2023 in Developer APIs

Hello everyone,

I'm building an application where my clients are able to upload images to Cloudinary. In order to make their experience better I would like to use the Upload Widget as well as the Media Library Widget.

But I don't want them to have access to all images, only to those they have uploaded.

My idea was to (automatically) create a folder for each client and then limit the access for them to their specific folder.

My question is, as I didn't find anything in the documentation that this is possible: Is this possible somehow and if not, is there another or better approach to achieve this?

Kind regards,




  • Akshay_joshi
    Akshay_joshi Administrator, Cloudinary Staff Posts: 6

    The Upload Widget and Media Library Widget do not have built-in functionality for creating or managing folders. We don't have a off the box method to do this but I feel like something like this would be doable

    • When a new client is registered, create a new folder in Cloudinary using the Cloudinary API or Admin Console. You can name the folder after the client ID or username, for example.
    • To create a new folder, make a POST request to the folders endpoint of the Cloudinary API. The request body should include the name of the folder you want to create, as well as any additional parameters you want to set, such as access control or backup options.

    For example, to create a folder named "client1" with default permissions, you can use the following python code:

    result = cloudinary.api\
    • When a client uploads an image using the Upload Widget or selects an image from the Media Library Widget, specify the folder parameter to limit access to only their specific folder. For example, if the client's folder is named "client1", set the folder parameter to "client1" when uploading or searching for images.
    • If you want to further restrict access to only images uploaded by the client, you can add a tag to the uploaded image with the client's ID or username, and then filter the Media Library Widget by that tag when displaying images to the client.

    This approach should ensure that each client only has access to their own images and that their images are stored in a separate folder to prevent accidental or intentional access to other clients' images.

  • Alexander
    Alexander Member Posts: 2

    Hello @Akshay_joshi

    Thanks so much for your helpful suggestions!

    I tried the approach and I'm able to create a specific folder for each user. In the Media Widget I set the folder name, so the widget opens the specific folder. But it is still possible to navigate to other folders. So it looks like that the folder parameter only sets the initially opened folder, but doesn't restrict the access only to this specific one.

    For example, I create the widget with this code:

        cloud_name: cloudName,
        api_key: apiKey,
        timestamp: timestamp,
        signature: signature,
        username: userName,
        multiple: false,

    and then I open it with this:{folder: {path: "test"}})

    The correct folder "test" is opened. But I am able to navigate through the whole media library if I click on the cloud-icon at the top left:

    Is this the intended behavior or am I missing something?