---
title: "Uploads a file from the sandbox filesystem to H2O Drive."
method: POST
path: "/v1/{name}/h2oDrive:uploadFile"
tags: ["H2ODriveService"]
---

# Uploads a file from the sandbox filesystem to H2O Drive.

`POST /v1/{name}/h2oDrive:uploadFile`

## Request

- Base URL: `https://docs.h2o.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://docs.h2o.ai/v1/{name}/h2oDrive:uploadFile`
- Auth: none declared
- TypeScript: <https://skmtc.dev/h2o/apis/ai-h2o-engine-sandbox-v1-filesystem-proto/docs/v1/:name/h2oDrive:uploadFile/post.ts> (a function with typed inputs; its response is checked against the schema)

Reads a file from the sandbox filesystem and stores it in the remote
storage at the specified path. If the file already exists in H2O Drive,
it will be overwritten. The caller must have write permissions for the
specified workspace.

Authorization: Only the creator of the parent SandboxEngine is allowed to call this method.

## Path parameters

- `name` string, required

## Request body

- object: Request to upload a file to H2O Drive.
  - `workspace` string: Optional. The workspace resource name. Format: workspaces/{workspace} If not specified, the default workspace in which the sandbox engine is running will be used.
  - `localPath` string, required: Required. The absolute path in the sandbox filesystem to read the file from. Must start with a forward slash (e.g., "/home/sandbox/output/results.json").
  - `remotePath` string, required

## Response `200`

A successful response.

- V1UploadFileResponse: Response after uploading a file.
  - `bytesUploaded` string, int64: Output only. The number of bytes read from the local filesystem and uploaded.

## Other responses

- `default`: An unexpected error response.

---

[API](https://skmtc.dev/h2o/apis/ai-h2o-engine-sandbox-v1-filesystem-proto.md) - [All operations](https://skmtc.dev/h2o/apis/ai-h2o-engine-sandbox-v1-filesystem-proto/llms.txt) - [OpenAPI document](https://skmtc.dev/h2o/apis/ai-h2o-engine-sandbox-v1-filesystem-proto/revisions/297cfadc1d39?raw)
