Publish a step graph as a new version
Authorizations
A secret API key. Publishable keys cannot reach this API. A key may carry an expiry, and an expired key is refused exactly like an unknown one, with a 401 that names no reason; check the key's expires_at in the dashboard rather than inferring it from a response. When a merchant rolls a key's secret they choose a grace window of up to 3 days, and for its duration BOTH the new secret and the one it replaced authenticate, so an integration moves over on its own deploy schedule instead of at the instant the button is pressed. Move before the window closes: after it, the old secret is refused. Nothing else about this contract moves with a roll. The key keeps its id and its scopes, so the only thing an integration updates is the credential itself.
Headers
A unique key per logical write. Replaying a request with the same key returns the first response byte for byte instead of applying the write twice.
Path Parameters
Body
Freezes a step graph and points the flow at it, in one transaction under the flow's row lock. The version row is physically immutable, so an edit appends version N+1 rather than rewriting N. RUNS IN FLIGHT ARE NOT AFFECTED. Every run resolves its graph through its own pinned flow_version_id, so a contact three days into a five-day program finishes the program they started rather than being teleported into a step that did not exist when they enrolled. THIS TAKES THE FLOW LIVE, whatever it was. The status is set in the same statement that points the flow at the new version, because a live flow requires a version and a two-call version of this could leave a live flow with no graph. The consequence to know about is that publishing to a PAUSED flow RESUMES it: read status back from this response and pause again if that was not the intent. An archived flow is 409 invalid_transition. THE VERSION NUMBER IS NOT ON THIS BODY. The server allocates it under the flow's row lock; a caller-chosen one would let two publishes claim the same number, and runs are pinned to a version by id, so a forked sequence is unrecoverable. THE GRAPH IS VALIDATED ONCE, HERE: every successor resolves to a real step, the graph is acyclic, every step is reachable and at least one exit is reachable. A failure is 400 invalid_definition naming the offending step, and nothing is stored.
Response
Created
