Skip to main content
POST
Upload a sandbox file

Authorizations

X-Access-Token
string
header
required

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

path
string
required

Absolute path inside the sandbox. Must start with /; relative segments such as . / .. are rejected. No semantic interpretation is applied beyond existence checks; for writes, the parent directory must already exist.

Minimum string length: 1
username
string

Perform the file operation as this user; defaults to the sandbox's default user. Optional capability: some data centers ignore this parameter and always act as the default user, so do not rely on it for permission isolation.

Body

multipart/form-data
file
file
required

The file content.

Response

Write complete. The array shape exists for compatibility with existing SDKs; it currently always holds a single element.

path
string
required

Absolute path of the file inside the sandbox

Example:

"/home/user/data.bin"

name
string
required

File name (the last segment of path)

Example:

"data.bin"

type
enum<string>
required

Entry type. Only files are written today, so this is always file.

Available options:
file