diff --git a/api-reference/storage/openapi.json b/api-reference/storage/openapi.json index a6d8eac..4f3ba36 100644 --- a/api-reference/storage/openapi.json +++ b/api-reference/storage/openapi.json @@ -157,6 +157,20 @@ "required": true, "description": "The API AccessKey used for authentication.", "schema": { "type": "string" } + }, + { + "name": "allowRootDelete", + "in": "query", + "required": false, + "description": "Set to `true` to bypass the root directory deletion guard and delete the storage zone root (`/`).", + "schema": { "type": "string", "enum": ["true"] } + }, + { + "name": "allowRootDelete", + "in": "header", + "required": false, + "description": "Set to `true` to bypass the root directory deletion guard and delete the storage zone root.", + "schema": { "type": "string", "enum": ["true"] } } ], "responses": { diff --git a/storage/http.mdx b/storage/http.mdx index 9b7a4a8..10b22fb 100644 --- a/storage/http.mdx +++ b/storage/http.mdx @@ -130,10 +130,41 @@ Returns a JSON array of files and directories. ## Delete a file -Delete files using a DELETE request: +Delete files or directories using a DELETE request. Deleting a directory recursively removes all of its contents. ```bash curl -X DELETE \ https://storage.bunnycdn.com/your-zone-name/path/to/file.jpg \ -H "AccessKey: your-storage-password" +``` + +### Deleting the root directory + +By default, deleting the root directory (`/`) is blocked as a safety guard. To bypass this protection, include `allowRootDelete=true` as either a query string parameter or a request header. + + + Deleting the root directory permanently removes **all files and directories** in your storage zone. This action cannot be undone. + + +**Via query string parameter:** + +- Key: `allowRootDelete` +- Value: `true` + +```bash +curl -X DELETE \ + "https://storage.bunnycdn.com/your-zone-name/?allowRootDelete=true" \ + -H "AccessKey: your-storage-password" +``` + +**Via request header:** + +- Name: `allowRootDelete` +- Value: `true` + +```bash +curl -X DELETE \ + https://storage.bunnycdn.com/your-zone-name/ \ + -H "AccessKey: your-storage-password" \ + -H "allowRootDelete: true" ``` \ No newline at end of file