pydo.microvms.upload_file()
Generated on 6 Nov 2026
from pydo version
v0.45.0
Usage
client.microvms.upload_file(
microvm_id="01a0ef1a-d873-793d-ae6a-5dd6239be62a",
path="/app/config.json",
mode=None,
uid=None,
gid=None,
sha256=None,
body={...},
)Description
To write a file into a MicroVM’s workload container, send a PUT request to
/v2/microvms/{microvm_id}/files?path=<absolute path> with the raw file content as the
request body and a Content-Type of application/octet-stream.
The file replaces any existing regular file at path atomically. The parent directory
must already exist. The request must carry a Content-Length header; chunked bodies are
rejected. A body of up to 64 MiB is accepted, and a Content-Length of 0 writes an empty
file. Pass sha256 to have the API verify the content before it replaces the target.
Your team needs the file_transfer feature. Check GET /v2/microvms/options. If the MicroVM
is paused and auto-resume is on, the request resumes it.
Parameters
microvm_idstring requiredThe unique ID of the MicroVM.
pathstring requiredThe absolute path of the file inside the workload container.
modestring optionalThe octal permission bits for the file, from
0001to0777. Defaults to0644. Setuid, setgid, sticky bits, and0000are rejected.uidinteger optionalThe owner user ID. Set it together with
gid. Defaults to the workload container's user.gidinteger optionalThe owner group ID. Set it together with
uid. Defaults to the workload container's group.sha256string optionalThe lowercase hex SHA-256 of the request body. When set, the API verifies the content before it replaces the target. A mismatch returns 422 and leaves the existing file unchanged.
bodyJSON or IO[bytes] requiredThe raw file content.
Response Example
More Information
See /v2/microvms/{microvm_id}/files in the API reference for additional detail on responses, headers, parameters, and more.