Skip to main content
POST
Write an app file

Authorizations

Authorization
string
header
required

Personal access token, sent as Authorization: Bearer <token>. Each operation lists the permission it needs: read_only or full_access. A full-access token can call every operation. A read-only token can call only the operations that list read_only; anything else returns 403 read_only_credential_route_not_allowed.

Path Parameters

app_id
string
required

ID of the app whose sandbox to operate on.

Body

application/json
path
string
required

File path relative to the app root.

content
string
required

Full file content to write. To create an empty file (e.g. .gitkeep) use run_command (touch) — the platform write path treats empty content as a delete.

Required string length: 1 - 6000000
branch_id
string | null

Optional Base44 branch ID. Omit to operate on main.

overwrite
boolean
default:false

Must be true to overwrite an existing file (destructive). Default false never clobbers.

Response

The file was written.

What the write did.

path
string
required

The normalized path that was written.

Example:

"src/pages/About.jsx"

bytes_written
integer
required

Size of the content written, in bytes.

Example:

214

created
boolean
required

true when the file did not exist before this call.

Example:

true

overwritten
boolean
required

true when the file existed and was replaced. Never true unless you sent overwrite.

Example:

false

warnings
string[]
required

Advisories about the write that did not stop it, such as writing somewhere the app editor treats specially. Empty when there are none.

Example: