curl --request POST \
--url https://api.bunny.net/storagezone \
--header 'AccessKey: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"Name": "<string>",
"Region": "<string>",
"ReplicationRegions": [
"<string>"
]
}
'import requests
url = "https://api.bunny.net/storagezone"
payload = {
"Name": "<string>",
"Region": "<string>",
"ReplicationRegions": ["<string>"]
}
headers = {
"AccessKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {AccessKey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({Name: '<string>', Region: '<string>', ReplicationRegions: ['<string>']})
};
fetch('https://api.bunny.net/storagezone', 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://api.bunny.net/storagezone",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'Name' => '<string>',
'Region' => '<string>',
'ReplicationRegions' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"AccessKey: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.bunny.net/storagezone"
payload := strings.NewReader("{\n \"Name\": \"<string>\",\n \"Region\": \"<string>\",\n \"ReplicationRegions\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("AccessKey", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.bunny.net/storagezone")
.header("AccessKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"Name\": \"<string>\",\n \"Region\": \"<string>\",\n \"ReplicationRegions\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bunny.net/storagezone")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["AccessKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"Name\": \"<string>\",\n \"Region\": \"<string>\",\n \"ReplicationRegions\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"Id": 123,
"UserId": "<string>",
"Name": "<string>",
"Password": "<string>",
"DateModified": "2023-11-07T05:31:56Z",
"Deleted": true,
"StorageUsed": 123,
"FilesStored": 123,
"Region": "<string>",
"ReplicationRegions": [
"<string>"
],
"PullZones": [
{
"Id": 123,
"Name": "<string>",
"OriginUrl": "<string>",
"Enabled": true,
"Suspended": true,
"Hostnames": [
{
"Id": 123,
"Value": "<string>",
"ForceSSL": true,
"IsSystemHostname": true,
"IsManagedHostname": true,
"HasCertificate": true,
"Certificate": "<string>",
"CertificateKey": "<string>"
}
],
"StorageZoneId": 123,
"EdgeScriptId": 123,
"MiddlewareScriptId": 123,
"MagicContainersAppId": "<string>",
"MagicContainersEndpointId": "<string>",
"AllowedReferrers": [
"<string>"
],
"BlockedReferrers": [
"<string>"
],
"BlockedIps": [
"<string>"
],
"EnableGeoZoneUS": true,
"EnableGeoZoneEU": true,
"EnableGeoZoneASIA": true,
"EnableGeoZoneSA": true,
"EnableGeoZoneAF": true,
"ZoneSecurityEnabled": true,
"ZoneSecurityKey": "<string>",
"ZoneSecurityIncludeHashRemoteIP": true,
"IgnoreQueryStrings": true,
"MonthlyBandwidthLimit": 123,
"MonthlyBandwidthUsed": 123,
"MonthlyCharges": 123,
"AddHostHeader": true,
"OriginHostHeader": "<string>",
"AccessControlOriginHeaderExtensions": [
"<string>"
],
"EnableAccessControlOriginHeader": true,
"DisableCookies": true,
"BudgetRedirectedCountries": [
"<string>"
],
"BlockedCountries": [
"<string>"
],
"EnableOriginShield": true,
"CacheControlMaxAgeOverride": 123,
"CacheControlPublicMaxAgeOverride": 123,
"BurstSize": 123,
"RequestLimit": 123,
"BlockRootPathAccess": true,
"BlockPostRequests": true,
"LimitRatePerSecond": 123,
"LimitRateAfter": 123,
"ConnectionLimitPerIPCount": 123,
"PriceOverride": 123,
"OptimizerPricing": 123,
"AddCanonicalHeader": true,
"EnableLogging": true,
"EnableCacheSlice": true,
"EnableSmartCache": true,
"EdgeRules": [
{
"Guid": "<string>",
"ActionParameter1": "<string>",
"ActionParameter2": "<string>",
"ActionParameter3": "<string>",
"Triggers": [
{
"PatternMatches": [
"<string>"
],
"Parameter1": "<string>"
}
],
"ExtraActions": [
{
"ActionParameter1": "<string>",
"ActionParameter2": "<string>",
"ActionParameter3": "<string>"
}
],
"Description": "<string>",
"Enabled": true,
"OrderIndex": 123,
"ReadOnly": true
}
],
"EnableWebPVary": true,
"EnableAvifVary": true,
"EnableCountryCodeVary": true,
"EnableCountryStateCodeVary": true,
"EnableMobileVary": true,
"EnableCookieVary": true,
"CookieVaryParameters": [
"<string>"
],
"EnableHostnameVary": true,
"CnameDomain": "<string>",
"AWSSigningEnabled": true,
"AWSSigningKey": "<string>",
"AWSSigningSecret": "<string>",
"AWSSigningRegionName": "<string>",
"LoggingIPAnonymizationEnabled": true,
"EnableTLS1": true,
"EnableTLS1_1": true,
"VerifyOriginSSL": true,
"ErrorPageEnableCustomCode": true,
"ErrorPageCustomCode": "<string>",
"ErrorPageEnableStatuspageWidget": true,
"ErrorPageStatuspageCode": "<string>",
"ErrorPageWhitelabel": true,
"OriginShieldZoneCode": "<string>",
"LogForwardingEnabled": true,
"LogForwardingHostname": "<string>",
"LogForwardingPort": 123,
"LogForwardingToken": "<string>",
"LoggingSaveToStorage": true,
"LoggingStorageZoneId": 123,
"FollowRedirects": true,
"VideoLibraryId": 123,
"DnsRecordId": 123,
"DnsZoneId": 123,
"DnsRecordValue": "<string>",
"OptimizerEnabled": true,
"OptimizerTunnelEnabled": true,
"OptimizerDesktopMaxWidth": 2500,
"OptimizerMobileMaxWidth": 2500,
"OptimizerImageQuality": 50,
"OptimizerMobileImageQuality": 50,
"OptimizerEnableWebP": true,
"OptimizerPrerenderHtml": true,
"OptimizerEnableManipulationEngine": true,
"OptimizerMinifyCSS": true,
"OptimizerMinifyJavaScript": true,
"OptimizerWatermarkEnabled": true,
"OptimizerWatermarkUrl": "<string>",
"OptimizerWatermarkOffset": 123,
"OptimizerWatermarkMinImageSize": 123,
"OptimizerAutomaticOptimizationEnabled": true,
"PermaCacheStorageZoneId": 123,
"OriginRetries": 123,
"OriginConnectTimeout": 123,
"OriginResponseTimeout": 123,
"UseStaleWhileUpdating": true,
"UseStaleWhileOffline": true,
"OriginRetry5XXResponses": true,
"OriginRetryConnectionTimeout": true,
"OriginRetryResponseTimeout": true,
"OriginRetryDelay": 123,
"QueryStringVaryParameters": [
"<string>"
],
"OriginShieldEnableConcurrencyLimit": true,
"OriginShieldMaxConcurrentRequests": 123,
"EnableSafeHop": true,
"CacheErrorResponses": true,
"OriginShieldQueueMaxWaitTime": 123,
"OriginShieldMaxQueuedRequests": 123,
"OptimizerClasses": [
{
"Name": "<string>",
"Properties": {}
}
],
"OptimizerForceClasses": true,
"OptimizerStaticHtmlEnabled": true,
"OptimizerStaticHtmlWordPressPath": "<string>",
"OptimizerStaticHtmlWordPressBypassCookie": "<string>",
"UseBackgroundUpdate": true,
"EnableAutoSSL": true,
"EnableQueryStringOrdering": true,
"ShieldDDosProtectionEnabled": true,
"EnableRequestCoalescing": true,
"RequestCoalescingTimeout": 123,
"OriginLinkValue": "<string>",
"DisableLetsEncrypt": true,
"EnableBunnyImageAi": true,
"BunnyAiImageBlueprints": [
{
"Name": "<string>",
"Properties": {}
}
],
"PreloadingScreenEnabled": true,
"PreloadingScreenShowOnFirstVisit": true,
"PreloadingScreenCode": "<string>",
"PreloadingScreenLogoUrl": "<string>",
"PreloadingScreenCodeEnabled": true,
"PreloadingScreenDelay": 123,
"EUUSDiscount": 123,
"SouthAmericaDiscount": 123,
"AfricaDiscount": 123,
"AsiaOceaniaDiscount": 123,
"RoutingFilters": [
"<string>"
],
"BlockNoneReferrer": true,
"StickySessionCookieName": "<string>",
"StickySessionClientHeaders": "<string>",
"UserId": "<string>",
"CacheVersion": 123,
"OptimizerEnableUpscaling": true,
"EnableWebSockets": true,
"MaxWebSocketConnections": 123,
"EnableExtendedLogging": true,
"CacheKeyHeaders": "<string>"
}
],
"ReadOnlyPassword": "<string>",
"Rewrite404To200": true,
"Custom404FilePath": "<string>",
"StorageHostname": "<string>",
"ReplicationChangeInProgress": true,
"PriceOverride": 123,
"Discount": 123
}{
"ErrorKey": "<string>",
"Field": "<string>",
"Message": "<string>"
}Add Storage Zone
curl --request POST \
--url https://api.bunny.net/storagezone \
--header 'AccessKey: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"Name": "<string>",
"Region": "<string>",
"ReplicationRegions": [
"<string>"
]
}
'import requests
url = "https://api.bunny.net/storagezone"
payload = {
"Name": "<string>",
"Region": "<string>",
"ReplicationRegions": ["<string>"]
}
headers = {
"AccessKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {AccessKey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({Name: '<string>', Region: '<string>', ReplicationRegions: ['<string>']})
};
fetch('https://api.bunny.net/storagezone', 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://api.bunny.net/storagezone",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'Name' => '<string>',
'Region' => '<string>',
'ReplicationRegions' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"AccessKey: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.bunny.net/storagezone"
payload := strings.NewReader("{\n \"Name\": \"<string>\",\n \"Region\": \"<string>\",\n \"ReplicationRegions\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("AccessKey", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.bunny.net/storagezone")
.header("AccessKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"Name\": \"<string>\",\n \"Region\": \"<string>\",\n \"ReplicationRegions\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bunny.net/storagezone")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["AccessKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"Name\": \"<string>\",\n \"Region\": \"<string>\",\n \"ReplicationRegions\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"Id": 123,
"UserId": "<string>",
"Name": "<string>",
"Password": "<string>",
"DateModified": "2023-11-07T05:31:56Z",
"Deleted": true,
"StorageUsed": 123,
"FilesStored": 123,
"Region": "<string>",
"ReplicationRegions": [
"<string>"
],
"PullZones": [
{
"Id": 123,
"Name": "<string>",
"OriginUrl": "<string>",
"Enabled": true,
"Suspended": true,
"Hostnames": [
{
"Id": 123,
"Value": "<string>",
"ForceSSL": true,
"IsSystemHostname": true,
"IsManagedHostname": true,
"HasCertificate": true,
"Certificate": "<string>",
"CertificateKey": "<string>"
}
],
"StorageZoneId": 123,
"EdgeScriptId": 123,
"MiddlewareScriptId": 123,
"MagicContainersAppId": "<string>",
"MagicContainersEndpointId": "<string>",
"AllowedReferrers": [
"<string>"
],
"BlockedReferrers": [
"<string>"
],
"BlockedIps": [
"<string>"
],
"EnableGeoZoneUS": true,
"EnableGeoZoneEU": true,
"EnableGeoZoneASIA": true,
"EnableGeoZoneSA": true,
"EnableGeoZoneAF": true,
"ZoneSecurityEnabled": true,
"ZoneSecurityKey": "<string>",
"ZoneSecurityIncludeHashRemoteIP": true,
"IgnoreQueryStrings": true,
"MonthlyBandwidthLimit": 123,
"MonthlyBandwidthUsed": 123,
"MonthlyCharges": 123,
"AddHostHeader": true,
"OriginHostHeader": "<string>",
"AccessControlOriginHeaderExtensions": [
"<string>"
],
"EnableAccessControlOriginHeader": true,
"DisableCookies": true,
"BudgetRedirectedCountries": [
"<string>"
],
"BlockedCountries": [
"<string>"
],
"EnableOriginShield": true,
"CacheControlMaxAgeOverride": 123,
"CacheControlPublicMaxAgeOverride": 123,
"BurstSize": 123,
"RequestLimit": 123,
"BlockRootPathAccess": true,
"BlockPostRequests": true,
"LimitRatePerSecond": 123,
"LimitRateAfter": 123,
"ConnectionLimitPerIPCount": 123,
"PriceOverride": 123,
"OptimizerPricing": 123,
"AddCanonicalHeader": true,
"EnableLogging": true,
"EnableCacheSlice": true,
"EnableSmartCache": true,
"EdgeRules": [
{
"Guid": "<string>",
"ActionParameter1": "<string>",
"ActionParameter2": "<string>",
"ActionParameter3": "<string>",
"Triggers": [
{
"PatternMatches": [
"<string>"
],
"Parameter1": "<string>"
}
],
"ExtraActions": [
{
"ActionParameter1": "<string>",
"ActionParameter2": "<string>",
"ActionParameter3": "<string>"
}
],
"Description": "<string>",
"Enabled": true,
"OrderIndex": 123,
"ReadOnly": true
}
],
"EnableWebPVary": true,
"EnableAvifVary": true,
"EnableCountryCodeVary": true,
"EnableCountryStateCodeVary": true,
"EnableMobileVary": true,
"EnableCookieVary": true,
"CookieVaryParameters": [
"<string>"
],
"EnableHostnameVary": true,
"CnameDomain": "<string>",
"AWSSigningEnabled": true,
"AWSSigningKey": "<string>",
"AWSSigningSecret": "<string>",
"AWSSigningRegionName": "<string>",
"LoggingIPAnonymizationEnabled": true,
"EnableTLS1": true,
"EnableTLS1_1": true,
"VerifyOriginSSL": true,
"ErrorPageEnableCustomCode": true,
"ErrorPageCustomCode": "<string>",
"ErrorPageEnableStatuspageWidget": true,
"ErrorPageStatuspageCode": "<string>",
"ErrorPageWhitelabel": true,
"OriginShieldZoneCode": "<string>",
"LogForwardingEnabled": true,
"LogForwardingHostname": "<string>",
"LogForwardingPort": 123,
"LogForwardingToken": "<string>",
"LoggingSaveToStorage": true,
"LoggingStorageZoneId": 123,
"FollowRedirects": true,
"VideoLibraryId": 123,
"DnsRecordId": 123,
"DnsZoneId": 123,
"DnsRecordValue": "<string>",
"OptimizerEnabled": true,
"OptimizerTunnelEnabled": true,
"OptimizerDesktopMaxWidth": 2500,
"OptimizerMobileMaxWidth": 2500,
"OptimizerImageQuality": 50,
"OptimizerMobileImageQuality": 50,
"OptimizerEnableWebP": true,
"OptimizerPrerenderHtml": true,
"OptimizerEnableManipulationEngine": true,
"OptimizerMinifyCSS": true,
"OptimizerMinifyJavaScript": true,
"OptimizerWatermarkEnabled": true,
"OptimizerWatermarkUrl": "<string>",
"OptimizerWatermarkOffset": 123,
"OptimizerWatermarkMinImageSize": 123,
"OptimizerAutomaticOptimizationEnabled": true,
"PermaCacheStorageZoneId": 123,
"OriginRetries": 123,
"OriginConnectTimeout": 123,
"OriginResponseTimeout": 123,
"UseStaleWhileUpdating": true,
"UseStaleWhileOffline": true,
"OriginRetry5XXResponses": true,
"OriginRetryConnectionTimeout": true,
"OriginRetryResponseTimeout": true,
"OriginRetryDelay": 123,
"QueryStringVaryParameters": [
"<string>"
],
"OriginShieldEnableConcurrencyLimit": true,
"OriginShieldMaxConcurrentRequests": 123,
"EnableSafeHop": true,
"CacheErrorResponses": true,
"OriginShieldQueueMaxWaitTime": 123,
"OriginShieldMaxQueuedRequests": 123,
"OptimizerClasses": [
{
"Name": "<string>",
"Properties": {}
}
],
"OptimizerForceClasses": true,
"OptimizerStaticHtmlEnabled": true,
"OptimizerStaticHtmlWordPressPath": "<string>",
"OptimizerStaticHtmlWordPressBypassCookie": "<string>",
"UseBackgroundUpdate": true,
"EnableAutoSSL": true,
"EnableQueryStringOrdering": true,
"ShieldDDosProtectionEnabled": true,
"EnableRequestCoalescing": true,
"RequestCoalescingTimeout": 123,
"OriginLinkValue": "<string>",
"DisableLetsEncrypt": true,
"EnableBunnyImageAi": true,
"BunnyAiImageBlueprints": [
{
"Name": "<string>",
"Properties": {}
}
],
"PreloadingScreenEnabled": true,
"PreloadingScreenShowOnFirstVisit": true,
"PreloadingScreenCode": "<string>",
"PreloadingScreenLogoUrl": "<string>",
"PreloadingScreenCodeEnabled": true,
"PreloadingScreenDelay": 123,
"EUUSDiscount": 123,
"SouthAmericaDiscount": 123,
"AfricaDiscount": 123,
"AsiaOceaniaDiscount": 123,
"RoutingFilters": [
"<string>"
],
"BlockNoneReferrer": true,
"StickySessionCookieName": "<string>",
"StickySessionClientHeaders": "<string>",
"UserId": "<string>",
"CacheVersion": 123,
"OptimizerEnableUpscaling": true,
"EnableWebSockets": true,
"MaxWebSocketConnections": 123,
"EnableExtendedLogging": true,
"CacheKeyHeaders": "<string>"
}
],
"ReadOnlyPassword": "<string>",
"Rewrite404To200": true,
"Custom404FilePath": "<string>",
"StorageHostname": "<string>",
"ReplicationChangeInProgress": true,
"PriceOverride": 123,
"Discount": 123
}{
"ErrorKey": "<string>",
"Field": "<string>",
"Message": "<string>"
}Authorizations
API Access Key authorization header
Body
The storage zone that will be added
The name of the storage zone
1The code of the main storage zone region (Possible values: DE, NY, LA, SG)
1The code of the main storage zone region (Possible values: DE, NY, LA, SG, SYD)
Determines the storage zone tier that will be storing the data
0, 1 The Storage Zone S3 support type
0, 1 Response
The storage zone that was added
The ID of the storage zone
The ID of the user that owns the storage zone
The name of the storage zone
The API access key or FTP password
The date when the zone was last modified
Determines if the zone was deleted or not
The total amount of storage used by this zone
The total number of files stored by this zone
The main region used by the storage zone
The replication regions enabled for this storage zone
The list of pull zones connected to this storage zone
Show child attributes
Show child attributes
The read-only API access key or FTP password
Determines if the storage zone will rewrite 404 status codes to 200 status codes
The custom 404 error path that will be returned in case of a missing file.
Determines the storage hostname for this zone
Determines the storage zone tier that is storing the data
0, 1 Determines if the storage zone is currently enabling a new replication region
The custom price override for this zone. Unit is $/TB/month.
The Storage Zone specific pricing discount.
The Storage Zone S3 support type
0, 1 Was this page helpful?