curl --request POST \
--url https://shardcloud.app/api/cdn/files/multipart \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"filename": "<string>",
"mime_type": "<string>",
"size": 123,
"folder": "<string>",
"expire_at": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://shardcloud.app/api/cdn/files/multipart"
payload = {
"filename": "<string>",
"mime_type": "<string>",
"size": 123,
"folder": "<string>",
"expire_at": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
filename: '<string>',
mime_type: '<string>',
size: 123,
folder: '<string>',
expire_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://shardcloud.app/api/cdn/files/multipart', 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://shardcloud.app/api/cdn/files/multipart",
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([
'filename' => '<string>',
'mime_type' => '<string>',
'size' => 123,
'folder' => '<string>',
'expire_at' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://shardcloud.app/api/cdn/files/multipart"
payload := strings.NewReader("{\n \"filename\": \"<string>\",\n \"mime_type\": \"<string>\",\n \"size\": 123,\n \"folder\": \"<string>\",\n \"expire_at\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <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://shardcloud.app/api/cdn/files/multipart")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"filename\": \"<string>\",\n \"mime_type\": \"<string>\",\n \"size\": 123,\n \"folder\": \"<string>\",\n \"expire_at\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://shardcloud.app/api/cdn/files/multipart")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"filename\": \"<string>\",\n \"mime_type\": \"<string>\",\n \"size\": 123,\n \"folder\": \"<string>\",\n \"expire_at\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filename": "<string>",
"parts": [
{
"part_number": 1,
"url": "<string>",
"size": 123
}
],
"expires_at": "2023-11-07T05:31:56Z"
}{
"error": "<string>"
}Start a large file upload
Starts an upload for files too large for a single POST /cdn/files request (which is limited to 100 MB). Reserves the file name and the storage quota, and returns one upload URL per 64 MiB part. Send each part with PUT to its URL, then call the finalize endpoint. Requires a valid subscription. The file is not publicly available until it is finalized.
curl --request POST \
--url https://shardcloud.app/api/cdn/files/multipart \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"filename": "<string>",
"mime_type": "<string>",
"size": 123,
"folder": "<string>",
"expire_at": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://shardcloud.app/api/cdn/files/multipart"
payload = {
"filename": "<string>",
"mime_type": "<string>",
"size": 123,
"folder": "<string>",
"expire_at": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
filename: '<string>',
mime_type: '<string>',
size: 123,
folder: '<string>',
expire_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://shardcloud.app/api/cdn/files/multipart', 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://shardcloud.app/api/cdn/files/multipart",
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([
'filename' => '<string>',
'mime_type' => '<string>',
'size' => 123,
'folder' => '<string>',
'expire_at' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://shardcloud.app/api/cdn/files/multipart"
payload := strings.NewReader("{\n \"filename\": \"<string>\",\n \"mime_type\": \"<string>\",\n \"size\": 123,\n \"folder\": \"<string>\",\n \"expire_at\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <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://shardcloud.app/api/cdn/files/multipart")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"filename\": \"<string>\",\n \"mime_type\": \"<string>\",\n \"size\": 123,\n \"folder\": \"<string>\",\n \"expire_at\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://shardcloud.app/api/cdn/files/multipart")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"filename\": \"<string>\",\n \"mime_type\": \"<string>\",\n \"size\": 123,\n \"folder\": \"<string>\",\n \"expire_at\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"filename": "<string>",
"parts": [
{
"part_number": 1,
"url": "<string>",
"size": 123
}
],
"expires_at": "2023-11-07T05:31:56Z"
}{
"error": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Name for the file, without extension (the extension is added from the MIME type). 1–64 characters: letters, numbers, underscores, and hyphens.
MIME type of the file. Must be one of the supported file types.
Exact file size in bytes (2 KB – 10 GB, and within your remaining CDN quota).
Optional folder prefix (same character rules as filename; "error-pages" is reserved).
Optional expiration time in RFC3339 format. Must be more than 3h50m from now.
Response
Upload started
Upload ID, used in the finalize call.
The name the file is stored under (folder, name and extension). Also what you pass to DELETE /cdn/files?fileName= to cancel the upload.
Show child attributes
Show child attributes
When the part URLs stop working and finalize is refused.