> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zocomputer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create file

> Create a new file or rewrite an existing one with the provided content.

{/* Tool: write_file */}

Returns a message indicating success or failure, including the absolute path of the file.

## Parameters

<ParamField path="target_file" type="string" required={true}>
  The absolute path of the file to create or rewrite.
</ParamField>

<ParamField path="content" type="string" default={""}>
  The content to write to the file. Defaults to empty.
</ParamField>

<ParamField path="device" type="string" default={""}>
  Optional fleet device name or id. When set, writes the file inside that running device's container instead of the host. The device must be started first. Requires the 'devices:manage' scope.
</ParamField>

<ParamField path="zapp" type="string" default={""}>
  Optional Zo App slug or id. When set, writes the file inside that Zo App's sandbox instead of the host (the app server is /zo-app/server.ts; private/user data goes under /user-data so the app stays cleanly shareable). Mutually exclusive with 'device'. Requires the 'apps:shell' scope.
</ParamField>
