History API
These routes read a flow’s version history, restore a version, keep a copy in GitHub, and promote a flow from Dev to Prod. The app uses them for Version history, the version page, the Version History settings page and the promote page (From Dev on the saved Dev and Prod pair). Drafts, Publish, Roll back and the behavior check before Publish are in the Drafts API. How to use all of it from the app: Version history, starting with the lifecycle at a glance.
All routes are under /api/v1/flow-versions. A signed-in session works. New scoped keys support the granted item reads described below; retained legacy keys keep their earlier permission-based behavior. With an API key, the workspace is the key’s workspace.
The flow must be in the caller’s active workspace. Any other flow id returns 404. A version id (:sha) is 7 to 40 lowercase hex characters, a full or short Git commit id. Anything else returns 400.
| Method | Route | Permission |
|---|---|---|
GET |
/status |
chatflows:view or agentflows:view |
GET |
/:chatflowId |
chatflows:view or agentflows:view |
GET |
/:chatflowId/:sha |
chatflows:view or agentflows:view |
GET |
/:chatflowId/:sha/diff |
chatflows:view or agentflows:view |
POST |
/:chatflowId/:sha/restore |
chatflows:update or agentflows:update, then the update permission for the flow’s type |
The GitHub routes and global environment configuration require both the instance operator and active organization ownership. The promote routes retain their organization-owner gate without an added operator requirement.
New scoped access keys may read a granted flow’s versions with api:read plus its workspace view permission. Restore and other canvas/publication mutations require a signed-in session; the permission-based API-key behavior below applies to retained legacy keys. Enforcement defaults to off; see Access keys.
Status
Section titled “Status”GET /api/v1/flow-versions/status
{ "enabled": true }enabled is false when CUTTLELY_VERSIONS turns history off. See History settings.
List versions
Section titled “List versions”GET /api/v1/flow-versions/:chatflowId
Returns the flow’s newest 200 versions, newest first.
{ "enabled": true, "versions": [ { "sha": "3413dc1a…", "shortSha": "3413dc1", "date": "2026-10-08T04:19:12-05:00", "author": "Alex Rivera", "authorId": "<user id>", "authorKind": "user", "title": "Changed System Message on Conversation Chain", "details": [], "kind": "save", "name": "Bakery helper", "hiddenSecrets": 0, "published": false } ], "lastError": null, "liveSha": "3413dc1a…", "lastPublished": null}| Field | Meaning |
|---|---|
sha |
Full commit id. Use it, or its first 7 characters, as :sha. |
date |
When it was saved, ISO 8601 with the server’s UTC offset. |
author |
Display name of the person who saved it, or cuttlely for an API key or system save. |
authorId |
That person’s user id. null for an API key or system save. |
authorKind |
user or system. |
title |
The version name Cuttlely wrote from the change. |
details |
More lines about the change. Can be empty. |
kind |
create, save, restore, publish, rollback, promote, or delete. unknown for a commit Cuttlely did not write. |
promotedFrom |
For a promote version, the full id of the previous environment’s version. Otherwise null. On the saved Dev and Prod pair that version is Dev’s. |
name |
The flow’s name in that version. |
hiddenSecrets |
How many secret-looking values this version holds as [secret hidden]. 0 when none. |
published |
true for a version put Live by Publish, Roll back Live or Promote (kind publish, rollback or promote). See Drafts API. |
lastError is the reason a save of this flow could not be added to history, when the server’s most recent history failure since it started was for this flow. Otherwise it is null. A later successful save does not clear it, so a version list can have both a recorded latest version and a lastError. It clears when the server restarts or a save of another flow fails.
liveSha is the version that is Live now: the newest version, when the flow has not changed since it was recorded. It is null when there are no versions, the newest version has another flow type or category, or the latest change to the flow could not be added to history. The flow is compared the way history stores it, so values history never keeps (passwords, and text hidden as [secret hidden]) are not compared: a change to only such a value does not move the marker.
lastPublished is the last Publish or Roll back Live, { "sha": …, "date": … }, or null. See Drafts API.
With history off the response is { "enabled": false, "versions": [], "lastError": null, "liveSha": null, "lastPublished": null }.
Read one version
Section titled “Read one version”GET /api/v1/flow-versions/:chatflowId/:sha
Returns that version as a canvas you can load.
{ "sha": "5e45b8a", "name": "Bakery helper", "type": "CHATFLOW", "flowData": "{\"nodes\":[…],\"edges\":[…]}", "missingCredentials": [{ "name": "OpenAI trial", "credentialName": "openAIApi" }], "ambiguousCredentials": [{ "name": "OpenAI main", "credentialName": "openAIApi", "count": 2, "using": "current" }], "hiddenSecrets": [ { "node": "conversationChain_0", "label": "Conversation Chain", "input": "systemMessagePrompt", "inputLabel": "System Message", "count": 1 } ]}flowData is a JSON string, the same shape as a chatflow’s flowData. Credentials are mapped by name and type to credentials in the caller’s workspace. Fields that are never stored, such as passwords, are filled from the flow as it is now. Secret-looking text that was hidden stays [secret hidden]. See What is stored, and what is not.
| Field | Meaning |
|---|---|
missingCredentials |
Credentials this version names that the workspace does not have. Those nodes have no credential selected. |
ambiguousCredentials |
Credentials this version names that more than one workspace credential matches. count is how many match. using is current when the one the flow uses now was picked, or oldest when none of them is in use and the oldest was picked. |
hiddenSecrets |
Inputs where secret-looking text was hidden when this version was saved: node (id), label (node label), input, inputLabel, and count. Those inputs hold [secret hidden]. Empty when none. |
A version id that is not in this flow’s history returns 404 Version <sha> was not found for this flow. With history off, every version returns 404.
Compare
Section titled “Compare”GET /api/v1/flow-versions/:chatflowId/:sha/diff?against=previous
Lists what the version :sha has compared with another state of the flow.
against |
Compared with |
|---|---|
previous |
This flow’s version before :sha. The default. |
current |
The flow as it is saved now. |
| a version id | That version of this flow. |
Any other value returns 400 against is previous, current, or a version id.
{ "sha": "3249e7c", "against": "5e45b8a1…", "added": [], "removed": [], "changed": [{ "id": "conversationChain_0", "label": "Conversation Chain", "fields": ["systemMessagePrompt"] }], "moved": ["bufferMemory_0", "conversationChain_0"], "edgesChanged": false, "renamed": null}| Field | Meaning |
|---|---|
against |
The commit id compared with, current, or null when :sha is the flow’s first version. |
added |
Nodes in :sha that are not in the other state. |
removed |
Nodes in the other state that are not in :sha. |
changed |
Nodes in both whose settings differ. fields are input names, or the setting’s key. |
moved |
Ids of nodes whose position differs. |
edgesChanged |
true when the connections differ. Connections are compared by their ends. |
renamed |
{ "from": …, "to": … } when the flow’s name differs, else null. |
A field that is never stored, such as a password, never shows as a change. With current, secret-looking text in the flow now is hidden the same way before comparing, so a hidden value does not show as a change.
Restore
Section titled “Restore”POST /api/v1/flow-versions/:chatflowId/:sha/restore
No body. Saves version :sha as the flow’s live canvas, with its name, type and category, through the normal chatflow update. When the flow saves to a draft (see Drafts API), the version becomes the draft instead, as described below. The caller needs the update permission for the flow’s type and for the version’s type: chatflows:update for a chatflow, agentflows:update for an agentflow, assistants:update for an assistant.
The save is recorded as a new version of kind restore, titled Restored: <title> (<short sha>), with the caller as its author. An API key’s restore is recorded as cuttlely.
{ "chatflow": { "id": "<flow id>", "name": "Bakery helper", "type": "CHATFLOW", "updatedDate": "2026-10-08T09:21:40.000Z" }, "restoredFrom": "5e45b8a", "restoredTo": "live", "version": { "sha": "afc07f3…", "kind": "restore", "title": "Restored: Changed credential, Temperature on ChatOpenAI (5e45b8a)", "…": "…" }, "unchanged": false, "recorded": true, "historyError": null, "missingCredentials": [], "ambiguousCredentials": [], "hiddenSecrets": []}| Field | Meaning |
|---|---|
chatflow |
The flow after the restore. Load the flow again for its flowData. |
restoredTo |
live, or draft when the flow saves to a draft (see below). |
version |
The new history entry, in the list format. null when nothing was recorded. |
unchanged |
true when the flow already matched the version, including the inputs the version holds as [secret hidden]. Nothing is saved and version is null. |
recorded |
true when the restore was added to history as a new version. false when nothing was added: either the flow already matched (unchanged: true, historyError: null) or the history write failed (unchanged: false). |
historyError |
Why the history write failed, when unchanged is false, recorded is false, and the reason is known. Otherwise null. |
missingCredentials |
As in Read one version. Those nodes are saved with no credential selected. |
hiddenSecrets |
As in Read one version. Those inputs are saved with [secret hidden]. Replace it before you run the flow. |
ambiguousCredentials |
As in Read one version. |
| Status | When |
|---|---|
| 403 | You do not have permission to change this type of flow. |
| 404 | The flow is not in the caller’s workspace, or the version is not found. |
| 409 | Version history is off on this server. A Live update that lands after Restore has read the canvas returns Live changed while this was being saved, so nothing was changed. Try again. |
Restore when the flow saves to a draft
Section titled “Restore when the flow saves to a draft”With drafts on and the flow in draft mode, Restore puts the version’s canvas in the draft and leaves Live alone until Publish. The flow’s name, type and category are not changed, because a draft holds the canvas only. Nothing is added to history. To change Live at once, use Roll back Live.
The response has restoredTo: "draft", draft (the draft status), version: null and recorded: false. unchanged is true when the version matches Live, so there is nothing to publish. A version of another kind of flow returns 409 This version is a different kind of flow, so it cannot become the draft. Use Roll back Live instead.
Copy to GitHub
Section titled “Copy to GitHub”The instance operator, signed in as an active organization owner, can connect a GitHub repository so every new version is copied there. In the app this is the GitHub card on Admin, then Version History (/version-history), which only an owner sees. How to set it up, and which token to make: Keep a copy in GitHub. These GitHub and global environment configuration routes require both active organization ownership and the instance operator. A role grant is not enough, and API keys cannot configure this server-wide connection.
| Method | Route | What it does |
|---|---|---|
GET |
/github |
The connection and copy status |
PUT |
/github |
Check a repository and token, save them, and start a copy |
DELETE |
/github |
Forget the repository and token |
POST |
/github/push |
Copy now instead of waiting for the next try |
POST |
/github/repos |
List the repositories a token can write to |
POST |
/github/repos/new |
Create a new private, empty repository |
PUT |
/environment |
Label this server Dev or Prod |
The connect, disconnect, copy and label routes answer with the status. It never holds the token.
{ "enabled": true, "connected": true, "credential": { "id": "<credential id>", "name": "GitHub: acme/cuttlely-flows" }, "repo": "acme/cuttlely-flows", "url": "https://github.com/acme/cuttlely-flows", "host": "github.com", "state": "up-to-date", "message": "Up to date. Every version on this server is on GitHub.", "code": null, "waiting": 0, "lastCopiedAt": "2026-10-08T23:41:05.000Z", "lastCopiedVersion": "3413dc1", "nextTryAt": null, "connectedAt": "2026-10-08T23:40:58.000Z", "environment": "dev", "environments": [ { "name": "dev", "branch": "main", "server": "dev" }, { "name": "prod", "branch": "main", "server": "prod" } ], "promotes": false, "role": "copy", "lastCheckedAt": null, "incomingVersion": null}| Field | Meaning |
|---|---|
enabled |
false when history is off. Then state is off and nothing is copied. |
credential |
The Github API credential that holds the token: its id and name, never the token. |
state |
One of the states below. |
message |
One plain sentence for the screen. |
code |
LIST_UNREADABLE when the environment file cannot be read, CONNECTION_UNREADABLE when the connection file cannot be read, or null. |
waiting |
Versions on this server that are not on GitHub yet. null when it cannot be counted. |
lastCopiedAt |
When the last copy finished, since the server started. null before the first copy. |
lastCopiedVersion |
The short id of the newest version on GitHub after that copy. |
nextTryAt |
When Cuttlely tries again after a failure, while state is retrying. |
environment |
This server’s identity in environments: dev, prod, another server identity, or null. |
environments |
Promotion order. A saved Dev or Prod label with no list is dev, then prod. |
promotes |
true when this server promotes from the previous environment. |
role |
copy when this server publishes versions. read on the last environment: it only reads the repository. |
lastCheckedAt |
When this server last looked for new versions from the previous environment. null on the first environment. On the saved pair that environment is Dev. |
incomingVersion |
The short id of the newest version it found there. null on the first environment or when empty. |
host |
The GitHub host this connection uses. github.com when the saved connection has no host. null when nothing is connected. |
state |
Meaning |
|---|---|
not-connected |
No repository. History stays on the server. |
up-to-date |
Every version is on GitHub. |
waiting |
New versions are queued and are copied in a few seconds, or a reader is waiting for its first real version. |
copying |
A copy is running. |
retrying |
GitHub could not be reached, refused the token, or the copy failed for another reason. Cuttlely tries again on its own, waiting longer each time, up to 15 minutes. |
stopped |
Copying needs you. The branch is not a descendant of the accepted history, a version path clashes with or changes a GitHub-owned path, a server-owned path changed or disappeared, a branch rule or ruleset refuses the copy, a version holds secret-shaped text, or the GitHub credential was deleted or is empty. A descendant tip with unrelated GitHub-added files is copied onto. message says which. |
off |
History is off on this server. |
Connect
Section titled “Connect”PUT /api/v1/flow-versions/github
{ "repo": "acme/cuttlely-flows", "token": "<fine-grained token>", "credentialName": "GitHub: acme/cuttlely-flows", "host": "github.com" }host is optional. Omit it, or send github.com, for the public service. A GitHub Enterprise host is the name you open in a browser, such as github.example.com or example.ghe.com. The repository address has to be on that same host. See Which GitHub host.
The token needs only Contents set to Read and write on that one repository (Read-only on a Prod server). GitHub adds Metadata read-only on its own. See Which GitHub token to use.
Or use a Github API credential already in the caller’s workspace instead of pasting a token:
{ "repo": "acme/cuttlely-flows", "credentialId": "<credential id>" }repo is owner/name or that repository’s https://<host>/owner/name address. On github.com the address is https://github.com/owner/name. Cuttlely first asks that host for the repository’s branches and tags with that token. Nothing is saved unless that works. The saved connection records the host. If the host and the saved remote no longer agree, copying stops and the token is not sent. A credential is bound to the host it was created for. A credential saved before custom hosts is treated as github.com. Using it with another host is refused before any request. A copying server can connect a repository that already has files and commits. The first copy adds the version files in new commits on top of that history and only fast-forwards. Files added on GitHub later stay: the next copy adds new versions on top of them and still only fast-forwards. Several pending versions are composed in order, with each result becoming the baseline for the next version. Cuttlely never force-pushes or rewrites history. A normal later version can update a version file this server actually wrote, such as its earlier flow.json, only while the repository still has the same file bytes and mode this server wrote. Deleting or moving a published version path on GitHub stops the copy before anything is written, even when the local version deletes it too. A flow deletion produced by this server removes the path and clears its ownership, so a later version can add it again. A path that merely matched a local version exactly remains GitHub-owned; changing or deleting it in a later local version stops the copy. An existing README.md is left as it is, in any capitalization. A missing GitHub-owned root README is not added; removing a root README supplied by the first direct copy stops the next copy. If a version path would replace a different existing path, or a copied path was changed on GitHub, the connect is refused, nothing is saved, and GitHub is unchanged. History that does not descend from this server’s latest copy is refused the same way, including after Disconnect and Connect. An empty repository, and Make a new private repository, still work: the new repository is created empty, and an empty one is copied as this server’s own commits. A repository this server already copied to, including one it copied onto existing history, is connected again and only the new versions are copied. With the saved Dev and Prod pair, a read-only server does not need the repository to be empty when Dev has already copied. A non-empty repository with no real version commit from Dev is refused at Connect. After Connect, an empty repository, a README-only tip, or a history-start-only tip leaves a reader waiting and polling without recording or installing it. A middle server does not publish while that read is waiting. A real version commit must have a well-formed Flow id, a recognized Kind, a Name, and a matching flow path in its tree, or be a deletion version whose change removes that path. A Flow marker in unrelated commit text is not a version. With a named list, the check is this server’s own publish branch: that branch may be absent, already part of this server’s history, or already have other files that the copy can sit on top of. Other environments’ branches may already be in the repository. The list is read again after that listing and again immediately before the connection is saved, and the first copy uses that same list. A server that is not first needs the previous environment’s branch in the listing, a reachable real version, and the recorded list on the newest copied version reachable below that branch’s tip has to be this server’s list. A later GitHub commit on top is allowed. A branch by itself (including one created with only a README), a history-start commit, a missing note on its newest copied version, or a different list is refused, and nothing is saved. That read checks the same tip again, so a missing record does not install it and does not copy. A read-only server (the last in the list) does not need main and does not need its own publish branch. Then a pasted token is saved as a new Github API credential in the caller’s workspace, named credentialName or GitHub: <owner/name>, and Cuttlely saves the connection and copies every version. A token that fails the check is never saved.
Each local history store keeps a durable accepted-tip ref per repository and branch. Its value can advance only to a descendant. A paired ownership record lists the current paths this server actually wrote, and both records advance in one local ref transaction. Both survive Disconnect. Connect advances an accepted descendant tip with the unchanged paired ownership set. A prepared-copy record for the same scope keeps the complete intended set while a network result is uncertain; when the remote contains that landed copy, retry records every path from the whole pass, including after Disconnect and Connect. Publishers record direct and graft pushes, including a confirmed push whose result returns after Disconnect. Readers record a tip only after a real version commit and the required environment-list provenance checks pass, before moving incoming; they never write GitHub or change the paired ownership set. A rejected read retains the earlier incoming ref. On upgrade, a connected publisher backfills the scoped records from its validated active graft ref, or its active direct-copy ref, before the first remote check and before Disconnect removes active refs. A remote tip that is also an ancestor of local history counts as this scope’s earlier direct copy only when this exact repository-and-branch record proves it, or when the prepared-copy record proves that an uncertain write landed. A new repository or branch scope, including a duplicated repository with the same commit ids, treats its existing paths as GitHub-owned. Unknown ownership is treated as GitHub-owned unless this server’s own scoped record proves it wrote the path. GitHub and GitHub Enterprise owner and repository names are case-insensitive for this scope; branch spelling remains exact, and local file remotes retain exact paths.
Deleting a repository and creating another at the same owner and name does not clear the accepted tip. Connect remains refused because this is indistinguishable from a destructive reset. Use a different repository name or publish branch. There is no automatic clear action.
| Status | When |
|---|---|
| 400 | The repository or token is not valid, GitHub did not accept the token, the repository is not there, GitHub could not be reached, or a named list’s previous environment has no versions in that repository yet. The message says which. Nothing is saved. |
| 409 | For a copying server: history is off, a version path would replace a different existing path, a published path is missing, a copied path has different bytes or mode, or the branch no longer descends from this server’s copy. For the saved pair at Connect, a read-only server also returns 409 when the repository has content and no real version commit from Dev. When a reader sees a non-descendant tip after its initial repository check, Connect saves the connection and returns 200; the read pass sets its state to stopped with the not-our-history message, retains the earlier accepted versions, and does not offer the rejected tip. GitHub is unchanged. |
Disconnect
Section titled “Disconnect”DELETE /api/v1/flow-versions/github
Cuttlely forgets the active repository connection. Nothing on GitHub changes. The durable accepted-tip and path-ownership records stay in the local history store, so reconnecting cannot adopt an older branch tip or claim a GitHub-owned path. The Github API credential stays on the Credentials page; delete it there if nothing else uses it.
Copy now
Section titled “Copy now”POST /api/v1/flow-versions/github/push
No body. Copies at once, and answers when the copy is done or has failed. 409 GitHub is not connected. when there is no connection.
List repositories
Section titled “List repositories”POST /api/v1/flow-versions/github/repos
{ "token": "<token>", "host": "github.example.com" }or { "credentialId": "<credential id>", "host": "github.com" }. host defaults to github.com. Asks that host which repositories the token can write to, most recently changed first, so the app can offer a list instead of a typed address. It reads up to 1,000 repositories. Archived repositories are left out. Nothing is saved. A saved credential for a different host is refused and the token is not sent.
{ "account": "acme-bot", "repos": [{ "repo": "acme/cuttlely-flows", "private": true, "empty": true, "pushedAt": null }]}empty is true when GitHub reports no content. What can be connected is the rule in Connect: a copying server can use an empty repository or one that already has files. It updates only version paths it wrote whose bytes and mode are unchanged. With the saved Dev and Prod pair, a read-only server can use an empty repository or one Dev has already copied to, and refuses non-empty history with no real version commit. With a named list, a server that is not first also needs the previous environment’s branch in the listing and this server’s list recorded on the newest copied version reachable below that branch’s tip. A later GitHub commit on top is allowed. A different list or no note on that copied version is refused. A read-only server does not need main. A token GitHub refuses, or GitHub out of reach, is 400 with a plain message.
Create a repository
Section titled “Create a repository”POST /api/v1/flow-versions/github/repos/new
{ "token": "<token>", "name": "cuttlely-flows", "host": "github.example.com" }host is required for a GitHub Enterprise host. Omit it, or send github.com, only for the public service. Leaving it out sends the request to github.com. credentialId works here too.
Creates a private, empty repository with that name in the token’s account and answers with it, in the list format. Connect it next. A fine-grained token can create repositories only with Administration set to Read and write for all repositories, so most fine-grained tokens get 400 This token cannot create repositories…; create the repository on GitHub instead. A name that is taken is 409.
Label this server
Section titled “Label this server”PUT /api/v1/flow-versions/environment
{ "environment": "prod" }dev, prod, or null to clear it. That is the saved pair: dev, then prod. It is kept in the history repo’s .git folder, not in a version, and an existing file with only environment still loads as that pair.
To put another environment between them, send the ordered list. Each entry has a name (shown in the app), a branch (where that environment publishes), and a server (the identity environment matches). Names, server identities and branches have to be different. The saved pair is the one exception: both branches stay main.
{ "environment": "staging", "environments": [ { "name": "Dev", "branch": "main", "server": "dev" }, { "name": "Staging", "branch": "staging", "server": "staging" }, { "name": "Prod", "branch": "prod", "server": "prod" } ]}environment has to be one of the server values, or null. Sending environment alone later picks another server in the list that is already saved. If that file cannot be read, sending environment alone, including null, is 409 The environment list could not be read. Save it again. and nothing is written. Send the list again to repair it. GET /github then sets code to LIST_UNREADABLE and environments to an empty list. A connection file that cannot be read is a different failure: code is CONNECTION_UNREADABLE, the sentence is The saved GitHub connection could not be read. Disconnect and connect again., and the saved list is still returned. Saving the saved Dev and Prod pair in place of a named list that still parses, when that save would not change what this server reads or copies, is 409 The environment list on this server is still valid, so it was not replaced. and the file is left as it is. A server that is not in the list is 400. On a named list, connect is refused until environment is one of those servers. Saving a longer list while this server still publishes the same branch rewrites the fingerprint on the versions already copied, so the next environment can read them without a new version.
The first environment copies its versions to its branch. Each later one reads the previous environment’s branch and can promote from it. The last environment only reads. One in the middle reads the previous branch and copies its own published versions, including promotions, to its own branch, so the next environment can read them. Promotion does not skip: Dev to Prod is refused while Staging is between them. On every hop the behavior check and the credential-name check still run.
Switching this server, or saving a list that changes what it reads or copies, while a repository is connected is 409; disconnect first. A saved Dev or Prod label with no list behaves as before: Dev copies to main, and Prod reads main. A list change that keeps the same read and the same copy rewrites the fingerprint on the versions already copied.
How copying works
Section titled “How copying works”- A new version, from a save, Publish, Roll back, restore or delete, is copied a few seconds after it is recorded. Drafts are not versions, so they are not copied.
- Copying runs in the background. It never slows down or fails a save, Publish or Roll back.
- Cuttlely copies this server’s versions to the repository branch for this environment. With the saved Dev and Prod pair, that branch is
main. With a longer list, each environment that publishes uses its own branch. It never force-pushes. On the first copy, it adds version commits on top of the branch’s existing history. After that, a branch tip that descends from this server’s prior copy is kept, including files added in later GitHub commits, and the next version commits are added on top as another fast-forward. A normal later version may update paths in the ownership record while their bytes and mode are unchanged. An exact match does not add a path to that record. Copying stops withstate: "stopped"when history is not a descendant of the recorded copy, a version would replace a different existing path, a server-owned path changed bytes or mode, a branch protection or repository rule refuses the update, a version contains secret-shaped text, or the saved credential was deleted or has no token. A retryable non-fast-forward response causes another fetch; a descendant tip is copied onto, while a non-descendant tip stops. GitHub keeps its files. - Before each copy, the versions being copied, their files and their titles, are checked again for key-shaped text, with the same patterns as a commit (see Version files). A hit stops the copy and names the version and pattern, never the text.
- The token is a Github API credential, encrypted like every credential. Change it on the Credentials page and the next copy uses the new one. The connection itself (repository, its address, credential id and name) is a file in the history repo’s
.gitfolder, outside the files Git tracks, so it is never in a version. The token reaches Git only in the environment of the copy, as an HTTP header for that repository. It is not written into the repo’s settings, a remote address, a command line, or the logs. - Flow credentials are never copied. Each version names the credentials a flow uses by name and type, as in Version files, so another server can match them to its own Credentials by name.
- Cuttlely does not add a remote to the history repo. It keeps the active connection’s last copied local version in
refs/versions/github. Separate hashed refs record the latest remote commit and the paths this server wrote for each repository and branch. They advance together and survive Disconnect, so reconnecting cannot accept an older copy or claim a path that only matched. - With that copy, the publishing server records a fingerprint of its environment list. The copy is not finished until that fingerprint is on the repository. The publisher brings in any fingerprint already recorded and retries when another server records one at the same time. If the fingerprint cannot be recorded, the copy stays unfinished. A reading server offers new versions only when a real version commit is reachable and the applicable fingerprint matches its own list. The named-list check uses the note on the newest copied version reachable below the tip, so later GitHub commits may sit above it. If the notes ref is absent for a named list, or no real version commit is reachable, every poll rejects the tip and retains the versions already offered. The saved Dev and Prod pair may omit the fingerprint only when the repository has no fingerprint record at all.
How Prod reads
Section titled “How Prod reads”- Prod connects to the repository the previous environment copies to, with the same
PUT /github. With the saved Dev and Prod pair, an empty repository is fine (Dev has not copied yet), and a repository Dev has already copied to is fine even when that copy sits on top of older files. A repository with unrelated history and no versions from Dev is refused, including one with only a README, or other branches and nomain. With a named list, connect checks this server’s own publish branch, and a server that is not first also needs the previous environment’s branch in the listing and this server’s list recorded on the newest copied version reachable below that branch’s tip. A later GitHub commit on top is allowed. A different list or no note on that copied version is refused, and nothing is saved. A read-only server does not needmain. The token needs Contents: Read only. - Every two minutes, and on
POST /github/push(Try again), Prod reads the previous environment’s branch into the refrefs/versions/incoming. With the saved Dev and Prod pair, that branch ismain. It changes nothing else: not its own history, not a flow, not a draft, not Live. A failed read retries like a failed copy and never affects Live flows. Every poll first requires a reachable real version commit; a README-only or history-start-only tip is not installed or recorded. New versions are installed only when the fingerprint on the newest copied version reachable below the tip matches this server’s list; later GitHub commits on top do not move the note. A different list, an absent notes ref for a named list, or a failure to read the record leaves the previous versions in place and offers nothing new. With the saved Dev and Prod pair, a repository with no fingerprint record at all is the one case that still installs real versions. - Disconnecting forgets
refs/versions/incomingtoo.
Promote from Dev to Prod
Section titled “Promote from Dev to Prod”On a server that has a previous environment (Prod, in the saved pair), these routes list the flows with a new version from that environment, show one with what it changes and the credentials it needs, run the behavior check against Live, and promote it. Promotion moves only to the next environment. How to use it from the app: Move a flow from Dev to Prod. They need a signed-in organization owner; unlike global GitHub/environment configuration, promotion does not add an instance-operator gate. On the first environment the list is empty and Promote is 409. Staging, and any environment that is not first, may promote from the previous one.
The list also returns environments (the order), source (the previous server identity) and target (this server). A saved Dev and Prod label returns dev, then prod, with source dev.
POST /incoming/:chatflowId/promote accepts an optional from, the previous server identity. A from that is not the previous environment is 409 Promotion only moves to the next environment. Omitting from promotes from the previous environment, as the app does.
| Method | Route | What it does |
|---|---|---|
GET |
/incoming |
Flows in this workspace with a new version from the previous environment |
GET |
/incoming/:chatflowId |
That flow’s new version: changes, credentials, check readiness |
POST |
/incoming/:chatflowId/promote |
Put that version Live here |
GET |
/incoming/:chatflowId/check |
Behavior check setup: recent questions, risky steps, last run |
POST |
/incoming/:chatflowId/check |
Start the behavior check |
GET |
/incoming/:chatflowId/check/:checkId |
Check progress and answers |
DELETE |
/incoming/:chatflowId/check/:checkId |
Stop the check |
GET /api/v1/flow-versions/incoming
{ "enabled": true, "connected": true, "lastCheckedAt": "2026-10-08T23:52:10.000Z", "flows": [ { "flowId": "4b6f0c2e-…", "name": "Bakery helper", "type": "CHATFLOW", "status": "update", "version": { "sha": "<40 hex>", "shortSha": "3413dc1", "date": "…", "author": "Dana", "title": "Published: Changed instructions" }, "changes": [ { "sha": "<40 hex>", "shortSha": "3413dc1", "date": "…", "author": "Dana", "title": "Published: Changed instructions" } ], "moreChanges": false, "hasDraft": false, "lastPromoted": { "sha": "<40 hex>", "date": "…" } } ]}- One entry per flow: the newest version Dev published.
statusisupdatefor a flow this server has,newfor one it does not have yet. changeslists what Dev published since the version last promoted here, newest first, at most 20 (moreChangessays when there are more).- A flow is left out when its newest version was already promoted, when Live already matches it, when Dev deleted it, or when a flow with that id is in another workspace here.
hasDraft: this server has unpublished changes for the flow. Promote keeps them (see below).
One flow
Section titled “One flow”GET /api/v1/flow-versions/incoming/:chatflowId answers with the list entry plus:
| Field | Meaning |
|---|---|
diff |
What Promote changes compared with Live here, as in Compare. For a new flow every node is added. |
missingCredentials |
Credentials the version uses, by name and type, that this workspace does not have. Promote is refused until they are added on the Credentials page. |
ambiguousCredentials |
Names that match more than one credential here, and which one is used, as in Read one version. |
hiddenSecrets |
How many inputs hold a hidden-secret placeholder. Values Live has here for the same inputs are kept. |
checkUnavailable |
null when the behavior check can run. Otherwise code is new-flow (no Live to compare with), type (not a chatflow, an agentflow, or a harness, or Live and the version from the previous environment are different kinds; a pipeline and a legacy multi-agent flow stay here, with The check works on chatflows and agentflows.), start (the two versions do not start the same way, or there is no Start input to replay) or credentials, with a message. A form, webhook or schedule start can be checked when both versions use that start. A harness can be checked: it replays recent questions. |
placements |
On a named list, one entry per environment, in order: server, name, place (here, previous, earlier, or later), state (seen, none, unseen, or local-only), and version (the same shape as version above, or null). seen is the newest version of this flow that this server could read there. none means that environment has not published it. unseen means the read failed. local-only is the last environment, which does not publish, when this server is not that one. The saved Dev and Prod pair returns []. |
404 when the flow has no new version from the previous environment.
Promote
Section titled “Promote”POST /api/v1/flow-versions/incoming/:chatflowId/promote
{ "sha": "<40 hex>" }sha is the full id of the version from the list. Cuttlely checks again that it is still the newest version from the previous environment for this flow and that every credential it uses is here, then puts it Live through the normal update path, as Roll back does. The answer has the shape of Restore, plus created and hasDraft. On the saved Dev and Prod pair that environment is Dev.
- History gets a version titled
Promoted from <previous environment>: <title on that environment> (<short id>), of kindpromote, published, with the trailerVersion-Fromset to that previous environment’s version id (see Version files). On the saved Dev and Prod pair the name is Dev. Roll back undoes it like any Publish. - A flow this server does not have is created with the id it has on the previous environment, in the caller’s workspace, so the next versions from that environment find it.
- Credentials are matched by name and type in the caller’s workspace. Values never travel: Dev’s files hold names only.
- A draft here is kept, unchanged, and stays marked as started from the old Live, so Publish asks before replacing what was promoted.
- Nothing is ever promoted on its own.
| Status | When |
|---|---|
| 400 | sha is the full id of the version to promote: 40 lowercase hex characters. |
| 409 | A newer version arrived, the version is no longer offered, a credential is missing (the message lists each one), this server is the first environment (it publishes and does not promote), or from is not the previous environment. Staging may promote. With the saved pair, the first environment is Dev and the message still says this server is not Prod. |
Behavior check
Section titled “Behavior check”The check routes work like the publish check in the Drafts API, with the version from the previous environment in place of the draft. A chatflow or a chat-started agentflow replays recent questions from this server’s chats against Live and that version, mapped to this server’s credentials. A harness replays recent questions from the full prompts saved for that harness. A form, webhook or schedule agentflow replays recorded inputs from this server’s executions, not from the previous environment. A pipeline is not checked: its review is the change list only. When this server has none, setup stays available and starting with count answers 400 with how to create a run here. On the saved Dev and Prod pair that version is Dev’s. The same count chooses how many, from 1 to the question cap (CUTTLELY_CHECK_COUNT_MAX, 100 by default). Setup limits.counts lists the picker choices for that cap. It writes nothing. It is a separate check from a draft check of the same flow.