Mint a client-upload URL
curl --request POST \
--url https://your-site.com/api/storage-bunny/storage/upload \
--header 'Content-Type: application/json' \
--cookie payload-token= \
--data '
{
"collectionSlug": "<string>",
"filename": "<string>",
"mimeType": "<string>",
"filesize": 123
}
'import requests
url = "https://your-site.com/api/storage-bunny/storage/upload"
payload = {
"collectionSlug": "<string>",
"filename": "<string>",
"mimeType": "<string>",
"filesize": 123
}
headers = {
"cookie": "payload-token=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'payload-token=', 'Content-Type': 'application/json'},
body: JSON.stringify({
collectionSlug: '<string>',
filename: '<string>',
mimeType: '<string>',
filesize: 123
})
};
fetch('https://your-site.com/api/storage-bunny/storage/upload', 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://your-site.com/api/storage-bunny/storage/upload",
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([
'collectionSlug' => '<string>',
'filename' => '<string>',
'mimeType' => '<string>',
'filesize' => 123
]),
CURLOPT_COOKIE => "payload-token=",
CURLOPT_HTTPHEADER => [
"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://your-site.com/api/storage-bunny/storage/upload"
payload := strings.NewReader("{\n \"collectionSlug\": \"<string>\",\n \"filename\": \"<string>\",\n \"mimeType\": \"<string>\",\n \"filesize\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "payload-token=")
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://your-site.com/api/storage-bunny/storage/upload")
.header("cookie", "payload-token=")
.header("Content-Type", "application/json")
.body("{\n \"collectionSlug\": \"<string>\",\n \"filename\": \"<string>\",\n \"mimeType\": \"<string>\",\n \"filesize\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-site.com/api/storage-bunny/storage/upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cookie"] = 'payload-token='
request["Content-Type"] = 'application/json'
request.body = "{\n \"collectionSlug\": \"<string>\",\n \"filename\": \"<string>\",\n \"mimeType\": \"<string>\",\n \"filesize\": 123\n}"
response = http.request(request)
puts response.read_body{
"filename": "<string>",
"method": "PUT",
"prefix": "<string>",
"url": "<string>"
}API reference
Mint a client-upload URL
Returns a short-lived signed (edge) or presigned (S3) URL so the browser can PUT file bytes straight to Bunny. Runs the collection’s clientUploads.access check and validates the file against upload.mimeTypes and upload.limits.fileSize. See Client uploads.
POST
/
api
/
storage-bunny
/
storage
/
upload
Mint a client-upload URL
curl --request POST \
--url https://your-site.com/api/storage-bunny/storage/upload \
--header 'Content-Type: application/json' \
--cookie payload-token= \
--data '
{
"collectionSlug": "<string>",
"filename": "<string>",
"mimeType": "<string>",
"filesize": 123
}
'import requests
url = "https://your-site.com/api/storage-bunny/storage/upload"
payload = {
"collectionSlug": "<string>",
"filename": "<string>",
"mimeType": "<string>",
"filesize": 123
}
headers = {
"cookie": "payload-token=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'payload-token=', 'Content-Type': 'application/json'},
body: JSON.stringify({
collectionSlug: '<string>',
filename: '<string>',
mimeType: '<string>',
filesize: 123
})
};
fetch('https://your-site.com/api/storage-bunny/storage/upload', 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://your-site.com/api/storage-bunny/storage/upload",
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([
'collectionSlug' => '<string>',
'filename' => '<string>',
'mimeType' => '<string>',
'filesize' => 123
]),
CURLOPT_COOKIE => "payload-token=",
CURLOPT_HTTPHEADER => [
"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://your-site.com/api/storage-bunny/storage/upload"
payload := strings.NewReader("{\n \"collectionSlug\": \"<string>\",\n \"filename\": \"<string>\",\n \"mimeType\": \"<string>\",\n \"filesize\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "payload-token=")
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://your-site.com/api/storage-bunny/storage/upload")
.header("cookie", "payload-token=")
.header("Content-Type", "application/json")
.body("{\n \"collectionSlug\": \"<string>\",\n \"filename\": \"<string>\",\n \"mimeType\": \"<string>\",\n \"filesize\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-site.com/api/storage-bunny/storage/upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cookie"] = 'payload-token='
request["Content-Type"] = 'application/json'
request.body = "{\n \"collectionSlug\": \"<string>\",\n \"filename\": \"<string>\",\n \"mimeType\": \"<string>\",\n \"filesize\": 123\n}"
response = http.request(request)
puts response.read_body{
"filename": "<string>",
"method": "PUT",
"prefix": "<string>",
"url": "<string>"
}Authorizations
Payload authentication cookie. These endpoints run Payload access control; an authenticated admin session is required.
Body
application/json