Skip to main content
PUT
Write a file

Authorizations

Authorization
string
header
required

An API token for one organization. You create and revoke tokens in the dashboard. A token scoped to one App can reach only that App, so give that kind of token to an agent. An organization-wide token can create a short-lived one with POST /api/tokens.

Scopes

apps:write
OAuth

Change the organization's Apps: edit files, run commands, deploy, and manage Secrets.

apps:write
DPoP

Headers

If-Match
string

One or more quoted ETags from earlier reads, or *. The request runs only if the file matches one of the ETags, or, for *, if the file exists. Otherwise, it returns 412.

If-None-Match
string

* to create the file only if it doesn't exist. If the file exists, the request returns 412.

Idempotency-Key
string

A key that identifies this request for retries, up to 200 printable characters. A retry with the same key and input returns the first request's result instead of repeating the work. If you omit the key, the API generates one and returns it in the Idempotency-Key response header.

Required string length: 1 - 200

Path Parameters

id
string
required

A unique ID that starts with app_.

Pattern: ^app_[0-9A-Za-z]{24}$
Example:

"app_Zj7XhMgplmTJcp5Dk4vcYuk0"

path
string
required

The file's path from the App's root, such as src/lib/util.ts.

Body

content
string
required

The file's UTF-8 text, up to 1 MiB.

Maximum string length: 1048576

Response

The replaced file.

path
string
required

The file's path from the App's root.

size
integer
required

The file's size, in bytes.

Required range: x >= 0
Example:

2048