---
title: "Fetch a file into a VM from a presigned URL"
method: POST
path: "/v1/vms/{id}/files/fetch"
tags: ["files"]
---

# Fetch a file into a VM from a presigned URL

`POST /v1/vms/{id}/files/fetch`

Scheduler asks the VM worker to download `url` into the guest at
`path`. `url` must be a presigned storage URL previously minted by
`POST /v1/vms/{id}/files/presign` (URLs from other sources are
rejected).

Response mirrors `/v1/vms/{id}/exec` — the worker runs the fetch
via the guest agent and reports stdout/stderr/exit code of the
underlying download+unpack operation.

Not idempotent; not retried by default.

## Request body

- FileFetchRequest
  - `url` string, uri, required — Must be the `downloadUrl` previously returned by `POST /v1/vms/{id}/files/presign` (URLs from other sources are rejected).
  - `path` string, required — Absolute destination path inside the guest filesystem.
  - `timeoutSec` integer — Per-fetch timeout in seconds.

## Response `200`

Fetch completed — command result

- ExecVMResponse
  - `exitCode` integer, required
  - `stdout` string, required
  - `stderr` string, required
  - `timedOut` boolean, required
  - `stdoutTruncated` boolean, required
  - `stderrTruncated` boolean, required
  - `durationMs` integer, required

## Other responses

- `400` — Invalid request
- `401` — Missing or invalid credentials
- `404` — Resource not found
- `409` — VM is not running
- `413` — Object too large for VM disk / insufficient guest disk space
- `500` — Internal server error
- `502` — Failed to HEAD the presigned URL

## Changes

- **2026-04-22** `fdb53b5a79b3` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/fastvm-org/apis/fastvm-api/changes/v1/vms/:id/files/fetch/post.md)

---

[API](https://skmtc.dev/fastvm-org/apis/fastvm-api.md) · [All operations](https://skmtc.dev/fastvm-org/apis/fastvm-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/fastvm-org/fastvm-api/revisions/fdb53b5a79b3/schema)
