curl --request POST \
--url https://{sandbox_key}.{domain}/files \
--header 'Content-Type: multipart/form-data' \
--header 'X-Access-Token: <api-key>' \
--form 'file=@example-file;type=application/octet-stream'import requests
url = "https://{sandbox_key}.{domain}/files"
files = { "file": ("example-file", open("example-file", "rb"), "application/octet-stream") }
headers = {"X-Access-Token": "<api-key>"}
response = requests.post(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {'X-Access-Token': '<api-key>'}};
options.body = form;
fetch('https://{sandbox_key}.{domain}/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://{sandbox_key}.{domain}/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 => [
"Content-Type: multipart/form-data",
"X-Access-Token: <api-key>"
],
]);
$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://{sandbox_key}.{domain}/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("X-Access-Token", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{sandbox_key}.{domain}/files")
.header("X-Access-Token", "<api-key>")
.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://{sandbox_key}.{domain}/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Access-Token"] = '<api-key>'
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[
{
"path": "/home/user/data.bin",
"name": "data.bin",
"type": "file"
}
]{
"code": "Resource.NotFound",
"message": "file not found",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Auth.Unauthorized",
"message": "unauthorized",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Resource.NotFound",
"message": "file not found",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Resource.NotFound",
"message": "file not found",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Resource.NotFound",
"message": "file not found",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Resource.NotFound",
"message": "file not found",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Resource.NotFound",
"message": "file not found",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Resource.NotFound",
"message": "file not found",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Resource.NotFound",
"message": "file not found",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Resource.NotFound",
"message": "file not found",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Resource.NotFound",
"message": "file not found",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Resource.NotFound",
"message": "file not found",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}Upload a sandbox file
Writes one file to the given absolute path inside the sandbox via multipart/form-data, overwriting any existing file.
Authentication, host, and the error envelope are identical to the download endpoint (see GET /files).
Request constraints
- The target path is given only in the
pathquery parameter; send it exactly once. Apathform field in the body is ignored or rejected with400, depending on the data center. Repeatingpathin the query returns400in some data centers and uses the first value in others. - The request body must be
multipart/form-data. Some IDCs also acceptmultipart/mixed. In either type the file part must carryname="file"inContent-Disposition; a part with any other name is ignored and the call still returns200with an empty array, so check that the array is not empty. Any otherContent-Typereturns415. - One file per request.
- No chunked/resumable upload. There is no
Rangesemantics for uploads; an interrupted upload must be resent in full. A data center may enforce a per-file size limit and return413when exceeded; the limit is not exposed through the API.
curl --request POST \
--url https://{sandbox_key}.{domain}/files \
--header 'Content-Type: multipart/form-data' \
--header 'X-Access-Token: <api-key>' \
--form 'file=@example-file;type=application/octet-stream'import requests
url = "https://{sandbox_key}.{domain}/files"
files = { "file": ("example-file", open("example-file", "rb"), "application/octet-stream") }
headers = {"X-Access-Token": "<api-key>"}
response = requests.post(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {'X-Access-Token': '<api-key>'}};
options.body = form;
fetch('https://{sandbox_key}.{domain}/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://{sandbox_key}.{domain}/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 => [
"Content-Type: multipart/form-data",
"X-Access-Token: <api-key>"
],
]);
$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://{sandbox_key}.{domain}/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("X-Access-Token", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{sandbox_key}.{domain}/files")
.header("X-Access-Token", "<api-key>")
.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://{sandbox_key}.{domain}/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Access-Token"] = '<api-key>'
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[
{
"path": "/home/user/data.bin",
"name": "data.bin",
"type": "file"
}
]{
"code": "Resource.NotFound",
"message": "file not found",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Auth.Unauthorized",
"message": "unauthorized",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Resource.NotFound",
"message": "file not found",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Resource.NotFound",
"message": "file not found",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Resource.NotFound",
"message": "file not found",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Resource.NotFound",
"message": "file not found",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Resource.NotFound",
"message": "file not found",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Resource.NotFound",
"message": "file not found",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Resource.NotFound",
"message": "file not found",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Resource.NotFound",
"message": "file not found",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Resource.NotFound",
"message": "file not found",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}{
"code": "Resource.NotFound",
"message": "file not found",
"request_id": "req-3f2b6c1e-8a0d-4f6b-9c3e-2d7a1b5e9f40"
}Authorizations
Sandbox data-plane token — the sandbox_access_token returned by the create/connect endpoints. Used for /files, Sandbox-Exec, and other data-plane endpoints; the control plane (/api/v2) does not accept it, and conversely the control plane's Authorization: Bearer is invalid on the data plane.
The token is bound to its sandbox: using sandbox A's token against sandbox B's host fails. It stays valid until the sandbox's lifetime ends; there is no separate rotation endpoint (rotate_traffic_token rotates the port traffic token traffic_access_token and does not affect this one).
Query Parameters
Absolute path inside the sandbox. Must start with / and be normalized: relative segments such as . / .. and // are rejected, and a path that points to a directory (for example one ending in /) returns 400. No semantic interpretation is applied beyond existence checks; for writes, the parent directory must already exist.
1Response
Write complete. The array shape exists for compatibility with existing SDKs; it currently always holds a single element.