/v1/projects/{projectId}/files/{fileId}/contentAPI keyReplace a file's content
Flip an existing file onto a replacement chunk you have already uploaded, and re-derive only what changed.
The edit lane is a diff, not a rewrite. The server compares the old content-addressed derivations against the new ones and re-ingests only the differing parts; unchanged regions are untouched, and derivations that no longer have a source retire.
Upload the replacement bytes through `chunks/missing` first, exactly as for a new file. This endpoint moves the pointer; it never carries bytes.
The `fileId` does not change. Everything that cites the file — retrieval results, plan proposals, folder placement — keeps citing it.
Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
| projectId | string | required | The owning project. |
| fileId | string | required | The file to edit. |
Body
| Field | Type | Required | Description |
|---|---|---|---|
| chunkId | string | required | The replacement content's chunk id. Its bytes must already be stored. |
| fileSize | integer | optional | New total size in bytes. |
curl -X PUT "https://runlog-7613480744.us-central1.run.app/v1/projects/p7Kd2mQx/files/4mHqZ1nR8vTbC0sWyLpAeGkJ3dXfU6iO2rN/content" \
-H "Authorization: Bearer $RUNLOG_API_KEY" \
-H "X-Project-Id: p7Kd2mQx" \
-H "Content-Type: application/json" \
-d '{
"chunkId": "Yt4RcVbNm2QaZsXdCfVgBhNjMkLoPiUyTrE",
"fileSize": 42190
}'{
"chunkIds": [
"Yt4RcVbNm2QaZsXdCfVgBhNjMkLoPiUyTrE"
],
"chunking": "",
"createdAt": "2026-08-07T18:22:10Z",
"ext": "swift",
"fileId": "4mHqZ1nR8vTbC0sWyLpAeGkJ3dXfU6iO2rN",
"fileSize": 42190,
"fileType": "code",
"filepath": "Sources/Net",
"name": "Router.swift",
"projectId": "p7Kd2mQx",
"status": "queued",
"updatedAt": "2026-08-07T18:22:10Z"
}Errors
| Status | error | When |
|---|---|---|
| 400 | chunk is not stored | You named a chunk whose bytes never landed. Run `chunks/missing` and PUT the body first. |
| 400 | file is not editable | The file's family has no content-edit lane (a media container, for instance). |
| 404 | file not found | No such file in this project. |
| 403 | editor access required | You can read the project but not write to it. |
| 404 | project not found | The project does not exist, or you have no access to it. Projects are non-enumerable, so a denied read is indistinguishable from a missing one. |
| 401 | invalid API key | The `Authorization` header is missing, malformed, or names a revoked key. |
| 400 | name the target project via the X-Project-Id header or projectId query | No project was named and the key is not bound to one. |
| 429 | rate limit exceeded | You passed 60 requests/minute on this key. `Retry-After` carries the seconds to wait. |
| 500 | internal error | The relay failed to serve the request. Retry with backoff; the cause is logged server-side against your request. |