---
title: "Create or replace a file in an application"
method: PUT
path: "/v2/apps/{appId}/files"
tags: ["File Manager"]
---

# Create or replace a file in an application

`PUT /v2/apps/{appId}/files`

Writes the provided content to the given path. Writes to `squarecloud.app` / `squarecloud.config` are parsed as platform config (display name, description, memory, autorestart, subdomain) and trigger plan/quota validation.

Requires the workspace Maintainer or Administrator role (or ownership) when called against a workspace-shared application. Config rewrites are rate limited to 1 request every 15 seconds per user.

## Path parameters

- `appId` string, required

## Request body

- object
  - `path` string, required — Absolute path to write inside the application.
  - `content` union, required — File content. Accepts either a UTF-8 string or a `{ type: "Buffer", data: number[] }` object.
    - string — File content as a UTF-8 string (for text files).
    - object — File content as a JSON-encoded byte array (for binary files).
      - `type` 'Buffer', required
      - `data` integer[], required — File bytes as integers in [0, 255].

## Response `200`

File written.

- object
  - `status` 'success', required

## Other responses

- `400` — The path or content failed validation, or a parsed config field was rejected.
- `401` — The Authorization header is missing, malformed, or the credentials are not valid.
- `403` — The write was blocked by the workspace's permission settings.
- `404` — The target application could not be found, or the caller is not a member of the workspace.
- `413` — The request body is larger than the maximum allowed size (100MB).
- `429` — Config rewrite cooldown is active.
- `500` — Persisting the parsed config update failed.

---

[API](https://skmtc.dev/squarecloud/apis/square-cloud-api.md) · [All operations](https://skmtc.dev/squarecloud/apis/square-cloud-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/squarecloud/square-cloud-api/revisions/54b7733a6b95/schema)
