---
title: "Write box file"
method: POST
path: "/boxes/{boxId}/fs/write"
tags: ["File System"]
---

# Write box file

`POST /boxes/{boxId}/fs/write`

Creates or overwrites a file. Creates necessary directories in the path if they don't exist. If the target path already exists, the write will fail.

## Path parameters

- `boxId` string, required

## Response `200`

Write file

- File — File system file representation
  - `type` 'file', required — File type indicator
  - `name` string, required — Name of the file
  - `path` string, required — Full path to the file in the box
  - `size` string, required — Size of the file
  - `mode` string, required — File metadata
  - `lastModified` string, date-time, required — Last modified time of the file

## Other responses

- `409` — Path is already a directory

---

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