Delete File
curl --request DELETE \
--url https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName} \
--header 'AccessKey: <api-key>'import requests
url = "https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName}"
headers = {"AccessKey": "<api-key>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {AccessKey: '<api-key>'}};
fetch('https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"AccessKey: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("AccessKey", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName}")
.header("AccessKey", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["AccessKey"] = '<api-key>'
response = http.request(request)
puts response.read_bodyManage Files
Delete File
Delete an object from the storage zone. In case the object is a directory all the data in it will be recursively deleted as well.
DELETE
/
{storageZoneName}
/
{path}
/
{fileName}
Delete File
curl --request DELETE \
--url https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName} \
--header 'AccessKey: <api-key>'import requests
url = "https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName}"
headers = {"AccessKey": "<api-key>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {AccessKey: '<api-key>'}};
fetch('https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"AccessKey: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("AccessKey", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName}")
.header("AccessKey", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://storage.bunnycdn.com/{storageZoneName}/{path}/{fileName}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["AccessKey"] = '<api-key>'
response = http.request(request)
puts response.read_bodyAuthorizations
The storage zone password also doubles as your API key. You can find it in your storage zone details page in the bunny.net dashboard.
Headers
The API AccessKey used for authentication.
Set to true to bypass the root directory deletion guard and delete the storage zone root.
Available options:
true Path Parameters
The name of your storage zone where you are connecting to.
The directory path to your file. If this is the root of your storage zone, you can ignore this parameter.
The name of the file that you wish to delete.
Query Parameters
Set to true to bypass the root directory deletion guard and delete the storage zone root (/).
Available options:
true Response
Object was successfully deleted
Last modified on June 12, 2026
Was this page helpful?