Clear all storage
clear_storage
Permanently deletes the files and folders in a site's storage bucket, public and private alike.
This is the whole bucket, not a folder, and it cannot be undone. Every published page pointing at a stored file breaks immediately. The tool tells the client to read the bucket with list_storage_files and confirm the whole contents with you first, and never to call it to tidy up on its own initiative.
Nothing deleted here is in any archive unless one was taken first. When the client has create_storage_backup, the tool tells it to take one and wait until list_storage_backups reports that backup ready before clearing, because a file removed before the archive is read is left out of the zip.
One call removes at most 20,000 objects, and the response sets complete to false when more remain, so call it again with the same input until complete is true. The response also counts what was removed in deleted and what could not be removed in failed.
The CDN link and the private storage key survive, so the bucket keeps working, it is simply empty. Every folder visibility setting is deleted too, so files written afterwards follow the top level default until folders are made private again. The CMS folder at the top level is kept, because the CMS manages it and deletes its files with their items, as Clear storage describes.
Without the Delete projects permission in the workspace, the call is refused with a 403 and You are not allowed to clear the storage of this site! While a storage backup is being restored, it 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/clear_storage, 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/clear_storage \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"projectId":"PROJECT_ID"}'Over MCP, the same method is the clear_storage tool.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
projectId |
string | Yes | The site id. |
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.