Upload Object
curl --request POST \
--url https://cdn.sacul.cloud/{bucketName}/{*path} \
--header 'Content-Type: <content-type>' \
--data '
{
"files": [
null
]
}
'import requests
url = "https://cdn.sacul.cloud/{bucketName}/{*path}"
payload = { "files": [None] }
headers = {"Content-Type": "<content-type>"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>'},
body: JSON.stringify({files: [null]})
};
fetch('https://cdn.sacul.cloud/{bucketName}/{*path}', 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://cdn.sacul.cloud/{bucketName}/{*path}",
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([
'files' => [
null
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: <content-type>"
],
]);
$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://cdn.sacul.cloud/{bucketName}/{*path}"
payload := strings.NewReader("{\n \"files\": [\n null\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://cdn.sacul.cloud/{bucketName}/{*path}")
.header("Content-Type", "<content-type>")
.body("{\n \"files\": [\n null\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cdn.sacul.cloud/{bucketName}/{*path}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request.body = "{\n \"files\": [\n null\n ]\n}"
response = http.request(request)
puts response.read_bodyCore CDN
Upload Object
Upload one or more files directly.
POST
/
{bucketName}
/
{*path}
Upload Object
curl --request POST \
--url https://cdn.sacul.cloud/{bucketName}/{*path} \
--header 'Content-Type: <content-type>' \
--data '
{
"files": [
null
]
}
'import requests
url = "https://cdn.sacul.cloud/{bucketName}/{*path}"
payload = { "files": [None] }
headers = {"Content-Type": "<content-type>"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>'},
body: JSON.stringify({files: [null]})
};
fetch('https://cdn.sacul.cloud/{bucketName}/{*path}', 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://cdn.sacul.cloud/{bucketName}/{*path}",
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([
'files' => [
null
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: <content-type>"
],
]);
$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://cdn.sacul.cloud/{bucketName}/{*path}"
payload := strings.NewReader("{\n \"files\": [\n null\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://cdn.sacul.cloud/{bucketName}/{*path}")
.header("Content-Type", "<content-type>")
.body("{\n \"files\": [\n null\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://cdn.sacul.cloud/{bucketName}/{*path}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request.body = "{\n \"files\": [\n null\n ]\n}"
response = http.request(request)
puts response.read_bodyUpload one or more files to a specific bucket and optional path.
As stated before and following our recent API update, uploading files is now exclusively supported via multipart/form-data.Old methods such as binary or base64 are now deprecated and removed from the API.
Authentication
Requires an API Key viaAuthorization, X-API-Key, or apiKey query parameter.
Headers
string
default:"multipart/form-data"
required
multipart/form-dataQuery Parameters
boolean
default:"false"
If
false, handle duplicates with Windows-style (1) suffix.boolean
default:"false"
If
true, randomizes the filename with a UUID.Form Data
file[]
required
One or more files to upload.
Response
{
"success": true,
"message": "Successfully uploaded X file(s)",
"url": "https://cdn.sacul.cloud/bucket/file.png",
"urls": ["..."]
}
Examples
Standard Upload
curl -X POST https://cdn.sacul.cloud/my-bucket/images/ \
-H "Authorization: Bearer <your-api-key>" \
-F "files=@/path/to/your/image.png"
Batch Upload
curl -X POST https://cdn.sacul.cloud/my-bucket/uploads/ \
-H "Authorization: Bearer <your-api-key>" \
-F "[email protected]" \
-F "[email protected]"
Was this page helpful?
⌘I
