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={...},
)
Returns JSON Raises HttpResponseError

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_id string required

The unique ID of the MicroVM.

path string required

The absolute path of the file inside the workload container.

mode string optional

The octal permission bits for the file, from 0001 to 0777. Defaults to 0644. Setuid, setgid, sticky bits, and 0000 are rejected.

uid integer optional

The owner user ID. Set it together with gid. Defaults to the workload container's user.

gid integer optional

The owner group ID. Set it together with uid. Defaults to the workload container's group.

sha256 string optional

The 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.

body JSON or IO[bytes] required

The raw file content.

Response Example

Show Response Example
{
  "path": "/app/config.json",
  "size_bytes": 1024,
  "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
  "mode": "0600",
  "uid": 0,
  "gid": 0
}

More Information

See /v2/microvms/{microvm_id}/files in the API reference for additional detail on responses, headers, parameters, and more.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.