Update an existing site
update_sitePatch or replace files on an existing site. Defaults to patch mode: only the listed files change; everything else stays. Pass mode:'replace' to wipe-and-replace the whole site (the legacy behaviour, surfaced explicitly so it can't happen by accident). Use delete: [paths] in patch mode to remove specific files without wiping the rest. Use dryRun: true to preview the diff before committing. LARGE FILES: a 100-250 KB text file fits in one call with encoding:'gzip+base64' (gzip locally, base64 the result) — prefer that over begin_deploy + add_file_chunk streaming. Errors if the site does not exist.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | patch (default): write only the listed files; everything else stays. replace: delete all existing files and write only the listed ones. Use replace only when you genuinely want to throw away the rest of the site. | |
| name | No | Site name (preferred). | |
| files | No | Files to write. Array form `[{path, content, encoding?}]` (preferred) supports binary via encoding:'base64'; map form `{path: content}` is utf8-only. <= 500 MB total. Optional when `delete` is provided in patch mode for delete-only deploys. | |
| delete | No | Patch-mode only: site-relative paths to remove from the pod. Files not in this list are kept. Reported back in `deletedFiles` listing only entries that actually existed. Combine with `files` to atomically rename in one call (write new path + delete old path). Rejected in mode:'replace' since replace already removes anything not in `files`. | |
| dryRun | No | If true, validate input + introspect what would change but don't write or delete. Returns the same shape with `dryRun: true` and `deletedFiles` showing what *would* be removed. Use this before any destructive call (replace mode, or patch with `delete`) to verify the diff. | |
| siteId | No | Site id (alternative to name). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | ||
| mode | Yes | The mode that was actually applied. | |
| dryRun | No | True if this was a dry-run; nothing was written or deleted. | |
| siteId | Yes | ||
| warnings | No | Surfaced issues that did not block the deploy (e.g. DOTFILE_PUBLIC, leaked-secret patterns). | |
| request_id | No | Server-assigned request correlation id. Quote it when contacting support. | |
| deletedFiles | Yes | Files removed by this call. For patch mode this is the entries from `delete` that actually existed; for replace mode it's every pre-existing file not in `files`. | |
| customHeaders | No | Result of the Netlify-style _headers sync: ship a _headers file in the site root to override default response headers (e.g. Permissions-Policy). Site-wide (/*) rules only. | |
| filesDeployed | Yes |