update_site_file
Change one or a few files of an already-published site, leaving every other file untouched (a merge — unlike deploy, which replaces the whole site). Ideal for small edits: fix a typo in index.html, swap a stylesheet, add one page. Best practice: call get_site_files first, edit the returned content, then call this with the files you changed and the expected_version from that read — if the site changed in the meantime you get a clear conflict telling you to re-read. Requires site_id + edit_token. Cannot delete files (use deploy to drop a file) and cannot remove index.html.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | The files to change. Only these are written; all other files on the site survive. | |
| site_id | Yes | The site id returned at publish time. | |
| edit_token | Yes | The edit token returned at publish time. | |
| expected_version | No | Optional but recommended. The `version` you got from get_site_files. If the site has changed since, the update is rejected with a conflict so you can re-read and re-apply. Omit to force last-writer-wins. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The live URL of the site. | |
| site_id | Yes | The site's slug / id. | |
| version | Yes | The site's new version after the merge. | |
| files_total | Yes | Total number of files on the site after the merge. | |
| files_written | Yes | Paths of the files written in this update. All other files were left untouched. |