# set_storage_visibility

Source: https://modulify.ai/docs/mcp/storage/set-storage-visibility

Makes stored files or whole folders public or private.

- Title: Make files or folders public or private
- Scope: `data:write`
- Access: Destructive

A public file is served at its permanent CDN address and can be embedded in pages, while a private file has no address and is readable only by the site's own server code. A key ending in a slash changes a whole folder, everything inside it and the default for files uploaded into it later. A plain key changes one file, or the whole folder when no file has that name but a folder does.

Making something public publishes it, and making something private breaks every link that pointed at it, so the tool tells the client to confirm the exact list with you before flipping anything you did not just upload. A key already at the requested visibility, or one that does not exist, is skipped, and a file that sits on both sides is settled onto the requested side, keeping the newest copy.

One call moves at most 20,000 objects out of the folders it was given and sets `complete` to false when more remain, so call it again with the same input until `complete` is true. The response counts `changed`, `skipped`, `failed` and `tooLong`. When `failed` is above zero the call reports an error, because those items may still be on their old side, so call it again.

A folder whose path is longer than 1001 bytes has no room for the `.modulify-keep` file that holds its default, so it is left unchanged and counted in `tooLong`, and once `complete` is true the call answers with a `400` that still carries the counts. Move that folder to a shorter path first, since a single file inside it can still be changed on its own.

A key inside the `CMS` folder at the top level, or the `CMS` folder itself, is refused with a `403` and `The CMS folder holds the files of your CMS items, so it cannot be changed from storage. Add files from a CMS field, and they are deleted with their item!` The CMS manages that folder, and a CMS file is deleted with the item that uses it. See [The CMS folder](https://modulify.ai/docs/data/storage#the-cms-folder).

While a storage backup is being restored, the call is refused with a `409` and `Your storage is being restored from a backup. Try again when the restore finishes!` See [While a restore runs](https://modulify.ai/docs/editor/backups#while-a-restore-runs).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id. |
| `keys` | array of strings | Yes | The full keys to change, from `list_storage_files`, at most 200. A key ending in a slash changes the whole folder. |
| `visibility` | string | Yes | `public` or `private`. |