Upload one or more files to R2 storage
curl --request POST \
--url https://your-instance.example.com/api/upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'files[0]=<binary: invoice.pdf>' \
--form 'files[1]=<binary: receipt.png>' \
--form files.items='@example-file'import requests
url = "https://your-instance.example.com/api/upload"
files = { "files.items": ("example-file", open("example-file", "rb")) }
payload = {
"files[0]": "<binary: invoice.pdf>",
"files[1]": "<binary: receipt.png>"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('files[0]', '<binary: invoice.pdf>');
form.append('files[1]', '<binary: receipt.png>');
form.append('files.items', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://your-instance.example.com/api/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-instance.example.com/api/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 => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files%5B0%5D\"\r\n\r\n<binary: invoice.pdf>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files%5B1%5D\"\r\n\r\n<binary: receipt.png>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://your-instance.example.com/api/upload"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files%5B0%5D\"\r\n\r\n<binary: invoice.pdf>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files%5B1%5D\"\r\n\r\n<binary: receipt.png>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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-instance.example.com/api/upload")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files%5B0%5D\"\r\n\r\n<binary: invoice.pdf>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files%5B1%5D\"\r\n\r\n<binary: receipt.png>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files%5B0%5D\"\r\n\r\n<binary: invoice.pdf>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files%5B1%5D\"\r\n\r\n<binary: receipt.png>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"files": [
{
"key": "orgs/65b1f0a2c3d4e5f6a7b8c9d0/uploads/2026-05-18/invoice.pdf",
"type": "application/pdf",
"name": "invoice.pdf",
"size": 184221,
"signedUrl": "https://r2.example.com/orgs/65b1.../invoice.pdf?token=...",
"bucket": "tether-uploads"
}
]
}{
"error": "NO_FILES",
"message": "No files uploaded"
}{
"error": "NO_FILES",
"message": "No files uploaded"
}{
"error": "NO_FILES",
"message": "No files uploaded"
}{
"error": "NO_FILES",
"message": "No files uploaded"
}Upload
Upload one or more files to R2 storage
Accepts up to 10 files as multipart/form-data under the files field. Each file is uploaded to R2 under a per-organization storage key and returned with a freshly generated signed URL.
POST
/
api
/
upload
Upload one or more files to R2 storage
curl --request POST \
--url https://your-instance.example.com/api/upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'files[0]=<binary: invoice.pdf>' \
--form 'files[1]=<binary: receipt.png>' \
--form files.items='@example-file'import requests
url = "https://your-instance.example.com/api/upload"
files = { "files.items": ("example-file", open("example-file", "rb")) }
payload = {
"files[0]": "<binary: invoice.pdf>",
"files[1]": "<binary: receipt.png>"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('files[0]', '<binary: invoice.pdf>');
form.append('files[1]', '<binary: receipt.png>');
form.append('files.items', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://your-instance.example.com/api/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-instance.example.com/api/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 => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files%5B0%5D\"\r\n\r\n<binary: invoice.pdf>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files%5B1%5D\"\r\n\r\n<binary: receipt.png>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://your-instance.example.com/api/upload"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files%5B0%5D\"\r\n\r\n<binary: invoice.pdf>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files%5B1%5D\"\r\n\r\n<binary: receipt.png>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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-instance.example.com/api/upload")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files%5B0%5D\"\r\n\r\n<binary: invoice.pdf>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files%5B1%5D\"\r\n\r\n<binary: receipt.png>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files%5B0%5D\"\r\n\r\n<binary: invoice.pdf>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files%5B1%5D\"\r\n\r\n<binary: receipt.png>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files.items\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"files": [
{
"key": "orgs/65b1f0a2c3d4e5f6a7b8c9d0/uploads/2026-05-18/invoice.pdf",
"type": "application/pdf",
"name": "invoice.pdf",
"size": 184221,
"signedUrl": "https://r2.example.com/orgs/65b1.../invoice.pdf?token=...",
"bucket": "tether-uploads"
}
]
}{
"error": "NO_FILES",
"message": "No files uploaded"
}{
"error": "NO_FILES",
"message": "No files uploaded"
}{
"error": "NO_FILES",
"message": "No files uploaded"
}{
"error": "NO_FILES",
"message": "No files uploaded"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
multipart/form-data
Multipart form. Send each file as a separate files part. Example with curl: curl -F "files=@invoice.pdf" -F "files=@receipt.png" -H "Authorization: Bearer $TOKEN" /api/upload.
Up to 10 binary files, each ≤50 MB. Field name must be exactly files.
Maximum array length:
10Response
Files uploaded
Show child attributes
Show child attributes
⌘I