Edit project
edit_projectChange a project's files on one variation (main unless variation names another), creating a new version that becomes that variation's head. Files not mentioned are kept from the head. Text files go inline as content, or by upload when a script wrote them; a picture, video, sound, font or 3D model goes up with create_upload and in by its uploadId (a file already in the workspace by fromVersionId). replacements change text, fonts, images or video by layer id without sending data.json. Without expectedHeadVersionId the change applies to whatever the head is (and is made again on a newer head if another change lands first, up to three tries, then head_moved: send it again); with it, the call fails with head_moved unless that is still the head. An edit whose files, soundtrack and text fitting baseline end up the same as the head creates no version and returns the head, unless the head has problems (it is checked again), the edit gives a different name, or it names an upload. Sent again after it used its uploads, the same edit returns the version it made. A version whose files would total more than the plan's project size (get_usage's limits.maxProjectBytes) is refused with project_too_large; one already larger may stay that size or shrink. Pass idempotencyKey to make any retry safe. A request over 1 MB must arrive within two minutes (too_slow), and a workspace sends one at a time: two more wait their turn, and another is refused with large_body_busy; send it again after the seconds its message gives.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"projectId": "<projectId>"
},
"name": "edit_project"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Optional version name, used in download file names. A version keeps its name: to name the current state, send an edit with only name, which makes a new version with the same files. | |
| files | No | Files to add or replace: each gives exactly one of content, uploadId or fromVersionId. Text files (data.json, text_fitting.json) go as content or an uploadId; pictures, video, audio, fonts and models as an uploadId. | |
| delete | No | Paths of files to remove. | |
| message | No | What changed, cut at 500 characters. Default: "Update", or the list of replaced layers. | |
| moveHead | No | Default true. False makes the version without moving any head: a draft to check or render, whose parent is the version it starts from (restoreFromVersionId, or the head) and which no variation's history contains. Drafts made at once never collide. | |
| projectId | Yes | Project id, from list_projects. | |
| variation | No | The variation to change, from list_variations; default main. | |
| soundtrack | No | The audio renders of this version play. Later versions keep it while the file stays. A render's audio overrides it. | |
| replacements | No | Change layers of the head's data.json by layer id (from inspect_layers): text and font keep the text's style; an image is fitted into the size its asset declares, and a video is stretched to that size without keeping its aspect ratio. Not together with a data.json in files. | |
| idempotencyKey | No | Makes a retry safe: for 24 hours the same edit with the same key returns the version the first one made. The same key with a different edit fails with idempotency_key_reused; while the first is still running, idempotency_key_in_use. | |
| removeSoundtrack | No | true removes the soundtrack and keeps its audio file. Not with soundtrack. | |
| fontLicenseAccepted | No | Required true when files adds a font file (.ttf, .otf, .woff, .woff2): the user confirms they are licensed to render with it. | |
| restoreFromVersionId | No | Start from the files of this version of the project, from list_versions, instead of the head's (undo). The new version still goes on the head, unless moveHead is false. | |
| expectedHeadVersionId | No | Optional: the headVersionId this change was made on, so it fails with head_moved if the head has moved since. Null or left out applies it to the current head. | |
| textFittingBaselineVersionId | No | Optional, with text_fitting.json in the version: an earlier version in the variation's history whose text originalBounds measures. Without it, a changed text_fitting.json measures against the version it was edited on, and an unchanged one keeps its baseline. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| name | Yes | ||
| files | Yes | ||
| number | Yes | ||
| message | Yes | ||
| problems | Yes | ||
| warnings | Yes | ||
| createdAt | Yes | ||
| projectId | Yes | ||
| renderable | Yes | ||
| soundtrack | Yes | ||
| composition | Yes | ||
| parentVersionId | Yes | ||
| textFittingBaselineVersionId | Yes |