# set_storage_root_visibility

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

Sets whether new files uploaded with no visibility default to public or private at the top level of a site's storage.

- Title: Set the default visibility for new root files
- Scope: `data:write`
- Access: Makes changes
- Endpoint: `POST /v1/set_storage_root_visibility`

The default covers files uploaded with no visibility straight to the top level, and into a folder that has no default of its own and sits under no folder that has one. A folder carrying its own default, or sitting inside one that does, keeps following that folder, as [Which files are private](https://modulify.ai/docs/data/storage#which-files-are-private) describes.

It changes nothing about files that already exist, and `get_storage_info` reports the current value as `rootVisibility`. 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).

## Request

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

It makes changes, so send an [Idempotency-Key](https://modulify.ai/docs/api/idempotency) header whenever you might retry it. A retry with the same key gets the first answer back instead of running again.

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

Over MCP, the same method is the [set_storage_root_visibility tool](https://modulify.ai/docs/mcp/storage/set-storage-root-visibility).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id. |
| `visibility` | string | Yes | `public` or `private`. |

## Response

Every call answers with the [JSON envelope](https://modulify.ai/docs/api/requests-and-responses#the-response) 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](https://modulify.ai/docs/api/requests-and-responses#headers-on-every-method-call) 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](https://modulify.ai/docs/api/errors) explains every status code a call can answer with.