Modulify

Make files or folders public or private

set_storage_visibility

Makes stored files or whole folders public or private.

POST /v1/set_storage_visibilityScopedata:writeDestructive

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.

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.

Request

Call it with a POST to https://api.modulify.ai/v1/set_storage_visibility, sending the inputs below as a JSON object. The token needs the data:write scope.

This method is marked destructive: it deletes or overwrites data. Check the inputs before you call it, and send an Idempotency-Key header whenever you might retry it.

curl -X POST https://api.modulify.ai/v1/set_storage_visibility \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"projectId":"PROJECT_ID","keys":[],"visibility":"VISIBILITY"}'

Over MCP, the same method is the set_storage_visibility tool.

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.

Response

Every call answers with the JSON envelope of success, message, data, code and version. data holds the result described above, and on a method that returns a total, count carries it. The response headers carry the call's X-Request-Id and what is left of your per-minute budget in X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset. Errors explains every status code a call can answer with.