Documentation Index
Fetch the complete documentation index at: https://docs.kaireonai.com/llms.txt
Use this file to discover all available pages before exploring further.
POST /api/v1/decision-flows/rollback
Restores a decision flow to a previously published version. Instead of overwriting history, rollback creates a new version that contains the configuration from the target version. This means the version history is fully immutable — you can always see when a rollback happened and what it restored. For example, if a flow is currently at version 5 and you roll back to version 3, the system creates version 6 whose configuration matches version 3. Versions 4 and 5 remain in the history for auditing.Authentication
Requires a valid tenant and the admin role.| Header | Required | Description |
|---|---|---|
X-Tenant-Id | Yes | Tenant identifier |
Authorization | Yes | Bearer token or API key |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The decision flow ID to roll back |
version | integer | Yes | The target version number to restore. Must be an existing published version with a valid configuration snapshot |
notes | string | No | Optional explanation for the rollback. Prepended with "Rollback to vN: " in the version history |
Example Request
Example Response
The response returns the full updated decision flow record, including the new version inpublishedVersions.
What Happens on Rollback
- The target version’s
configSnapshotis looked up from the flow’s published version history. - A new version is appended (e.g., version 6) with the restored configuration and rollback notes.
- The flow’s
draftConfigis replaced with the restored configuration. - The flow’s
statusis set toactive. - Entity caches (offers, qualification rules) are invalidated so the rolled-back configuration takes effect immediately.
- An audit log entry is recorded with the rollback details, including the source and target version numbers.
Optimistic Concurrency
The rollback usesrowVersion-based optimistic concurrency control. If another user modifies the same flow between your read and the rollback, the request returns a 409 Conflict and you should retry.
Error Responses
| Status | Cause |
|---|---|
400 | Missing id (must be a string) or missing version (must be a number) |
401 | Missing or invalid authentication credentials |
403 | Insufficient role (requires admin) |
404 | Decision flow not found, or the specified version does not exist in the published history |
409 | Concurrent modification detected — another user updated the flow. Retry the request |
500 | Internal server error |
See also: Decision Flow Versions | Decision Flows | Change History