Upload API
Base
https://tmp-file-media-func-4epls.bunny.run
Max 100 MB · Expires in 10 sec to 1 week ·
Use the same
secretToken for all three calls so the server knows the files are yours.
GET
/temp-file-url
Returns an upload URL and the headers you must send when PUTting the file. Only filename is required. Adds a random folder if you don't pass secretToken.
Request
curl \ "https://tmp-file-media-func-4epls.bunny.run/temp-file-url" \ -G \ --data-urlencode "filename=cat.png" \ --data-urlencode "contentType=image/png" \ --data-urlencode "cacheDuration=604800" \ --data-urlencode "secretToken=550e8400-e29b-41d4-a716-446655440000"
Response
{
"uploadUrl": "https://s3.example.com/.../happy-blue-cat-john/cat.png?X-Amz-...",
"requiredHeaders": {
"Content-Type": "image/png",
"Cache-Control": "public, max-age=604800"
},
"filename": "cat.png",
"storageKey": "happy-blue-cat-john/cat.png",
"publicUrl": "https://cdn.tempfile.com/happy-blue-cat-john/cat.png"
}
Include every header from requiredHeaders when you PUT — they're part of the signature.
POST
/upload-complete
Call this after your PUT succeeds. Purges the CDN cache so the file is served fresh. Uses your secretToken to check ownership — returns 403 if it doesn't match.
Request
curl -X POST "https://tmp-file-media-func-4epls.bunny.run/upload-complete" \
-H "Content-Type: application/json" \
-d '{"publicUrl":"https://cdn.tempfile.com/happy-blue-cat-john/cat.png","secretToken":"550e8400-e29b-41d4-a716-446655440000"}'
Response
{
"success": true,
"purged": "https://cdn.tempfile.com/happy-blue-cat-john/cat.png"
}
POST
/delete-file
Permanently deletes the file. Same ownership check — needs the secretToken you used when creating it. Returns {"success":true} or 403.
Request
curl -X POST "https://tmp-file-media-func-4epls.bunny.run/delete-file" \
-H "Content-Type: application/json" \
-d '{"publicUrl":"https://cdn.tempfile.com/happy-blue-cat-john/cat.png","secretToken":"550e8400-e29b-41d4-a716-446655440000"}'
Response
{
"success": true,
"deleted": "https://cdn.tempfile.com/happy-blue-cat-john/cat.png"
}