Skip to main content
POST
/
dsf
/
files
Upload a file
curl --request POST \
  --url https://panel.sendcloud.sc/api/v3/dsf/files \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: multipart/form-data' \
  --form file='@example-file'
import requests

url = "https://panel.sendcloud.sc/api/v3/dsf/files"

files = { "file": ("example-file", open("example-file", "rb")) }
headers = {"Authorization": "Basic <encoded-value>"}

response = requests.post(url, files=files, headers=headers)

print(response.text)
const form = new FormData();
form.append('file', '<string>');

const options = {method: 'POST', headers: {Authorization: 'Basic <encoded-value>'}};

options.body = form;

fetch('https://panel.sendcloud.sc/api/v3/dsf/files', 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://panel.sendcloud.sc/api/v3/dsf/files",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
  CURLOPT_HTTPHEADER => [
    "Authorization: Basic <encoded-value>",
    "Content-Type: multipart/form-data"
  ],
]);

$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://panel.sendcloud.sc/api/v3/dsf/files"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Basic <encoded-value>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://panel.sendcloud.sc/api/v3/dsf/files")
  .header("Authorization", "Basic <encoded-value>")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://panel.sendcloud.sc/api/v3/dsf/files")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"

response = http.request(request)
puts response.read_body
{ "file_token": "b90e7a70-57c6-4338-992a-eae50d637261-6170706c69636174696f6e2f706466" }
The request must be multipart/form-data with a single part named file. That part has to be a real file part: its Content-Disposition must include a filename, and it must carry a per-part Content-Type that is in the allowed list below.
Most server-side HTTP clients (Python requests, PHP Guzzle, fetch, axios, OkHttp, …) do not set a filename or a per-part Content-Type automatically — unlike the curl --form file=@... shorthand, which sets both for you. If the file part is sent without a filename, the server treats it as a plain text field and responds with 422 (“file field must contain a file object.”). Make sure your client sets both explicitly on the file part.
Limits and allowed types
  • Maximum file size: 6 MB. Larger uploads are rejected with 413 Content Too Large.
  • Allowed content types: image/*, video/*, text/*, application/pdf, application/rtf, application/msword, application/vnd.openxmlformats-officedocument.* (.docx, .xlsx, .pptx), application/vnd.ms-*, application/vnd.oasis.opendocument.* (.odt, .ods, .odp), application/xml, application/yaml, application/json. A part whose Content-Type is not in this list is rejected with 415 Unsupported Media Type. Generic types such as application/octet-stream and application/zip are not accepted, so make sure your client sends an accurate per-part Content-Type.
Which error means what
  • 400 (“file field is required.”) — there is no part named file in the request at all.
  • 422 (“file field must contain a file object.”) — a part named file is present, but it was sent without a filename, so it is not recognized as a file.

Authorizations

Authorization
string
header
required

Basic Authentication using API key and secrets is currently the main authentication mechanism.

Body

multipart/form-data
file
file
required

The file to upload, sent as a multipart/form-data file part. The part must include a filename in its Content-Disposition header and a per-part Content-Type from the allowed list (for example application/pdf). Maximum size is 6 MB.

Response

Created

file_token
string
required