Edit several Format files in one commit with a change set
One PUT to the Sume Format contents root commits many files at once. Learn what a change set keeps, why it cannot delete, and how If-Match guards the package.

To edit several files of a Sume Format in one commit, send one PUT to /v1/formats/{handle}/{slug}/contents with a files list and no path. The API writes every file as a single commit, with one version increase and one new package_sha. If any entry has a stale sha or breaks a package rule, it commits nothing.
That all-or-nothing behavior, plus two surprises (the list is a change set, and it cannot delete), is what this post covers. Everything here comes from Format contents API.
One round trip instead of many
Writing one path at a time costs one commit and one request per file, and leaves the package in a half-edited state between calls. The batch form removes both costs. Each entry follows the single-file rules: content is the full file in base64, and sha is required when the path already exists. To create a path, leave sha out.
| Question | One path at a time | Root PUT with `files` |
|---|---|---|
| Commits for 3 files | 3 | 1 |
| Version bumps | 3 | 1 |
If one sha is stale | Earlier files already landed | Nothing is committed |
| Files not named | Untouched | Untouched |
| Can delete a file | Via DELETE …/contents/{path} | No; use DELETE |
| Paths per request | 1 | Up to 1000 |
A change set is not the package
The docs are explicit that files is a change set. If the Format holds a path and your body does not name it, the API keeps that file as it is. An edit to two of twelve files never puts the other ten at risk, which also means you cannot remove a file by leaving it out. Use DELETE …/contents/{path} with the file's sha, and it removes the file only when you ask.
This is the opposite of a typical sync tool that makes a folder match a source tree. If your repo is the source of truth, diff the Format's file list against it and send deletes yourself.
Guard the whole package with If-Match
A per-file sha cannot say that the package has not moved since you read it. Two writers can edit different files, each holding a current sha, and both writes land, although the second plan was made against an old tree. Send the package sha as If-Match: it is commit.tree.sha from your last write and the same value as package_sha on the Format record.
If the package changed, you get 409 format_package_sha_mismatch, and error.details.package_sha holds the current value, so a read-and-retry takes one round trip. It is a bare 40-character hex string, not an opaque ETag. Formats published before package_sha existed ignore the header instead of returning a 409 you can never satisfy.
A safe edit routine
Combine the pieces in this order.
- Lint the folder locally against the package rules.
- Read the Format record and keep
package_shaand each file'ssha. - Send one
PUTwithIf-Match, a message, and only the files that changed. - On
format_package_sha_mismatch, re-read, re-plan the edit, and send again. - Send a
DELETEfor each file you removed, and carry the newpackage_shainto the next call.
Sources
Related posts
More in Developers
- Python 3.14 uuid.uuid7() as a Sume Idempotency-Key: when it is safe
uuid.uuid7() is new in Python 3.14 and makes a tidy Idempotency-Key for Sume submits, if you generate it once per intent and store it. A runnable stdlib sample.
- Python urllib gets 403 'error code: 1010' from api.sume.com: set a UA
Python's default urllib User-Agent got a plain-text HTTP 403 from api.sume.com in my test while other clients passed. Add a User-Agent and parse errors safely.
- Recover Sume jobs after a crash: match your key to GET /v1/jobs
Your worker died after submit and lost the job ids. Page GET /v1/jobs, match idempotency_key to your own keys, stop at the last page. A 29-line sample.
- Silent reference clip: stt_skipped_silent, no-audio and caption errors
A silent clip does not fail a Sume reference ingest, and STT settles to zero. Video inspect and captions do raise errors on silence.
Written by Sume