# How to view and restore an action version in ActionJail

The action editor keeps a history of code, parameter and documentation versions for the last 180 days: who changed what and when. You can compare an older version with the current one and restore it in one click.

---

## When this helps
- An action behaves differently after an edit and you need to see what changed.
- You need to bring the code, parameters or documentation back to an earlier version.

---

## Good to know
- A version is a change of the code (`Code`), the JSON config (`Parameters`) or the documentation. Title, description and group are not part of a version.
- The history lives in the settings log. If the log is disabled there is no history; the drawer says so.
- Versions are kept for 180 days from the last change; older ones disappear.
- Saving again without changes does not create a version.
- A restore does not change the action state (active, bot list): a disabled action stays disabled.
- Tokens in the code, parameters and documentation are masked in the history (`••••••`). Only known patterns are covered (`Authorization` headers, `api_key`, `client_secret`, and similar); a token stored in a variable with an arbitrary name or under a quoted key (`'api_key': '…'`) is not detected. The current token is still visible in the editor, so it is safer to keep tokens in Instance credentials. A restore brings back the real code, not the masked one.
- A deleted action cannot be restored and its history is not shown.

---

## Before you start
- [ ] `Menu -> ActionJail` is open and a custom (not system) action is selected.
- [ ] You can save actions: there is no separate permission for the history.

---

## Step by step
1. Open the action and click `History` next to `Make your copy`.
2. Find the version in the list (newest first): date, author, source (`Editor`, `API`, `Agent`, `MCP`, `Marketplace`, `System`) and what changed.
3. `Compare with current` shows the difference between the version and the current state; `Compare with previous` shows what this version changed.
4. Click `Restore`. Review the difference and, if shown, the notice "Changed N time(s) after this version".
5. Confirm. A "Version restored" message appears, the history refreshes and gets a new entry "Restored from the version of ...".

---

## What happens next
- The code, parameters and documentation become those of the chosen version; the action goes through the same checks as `Save`.
- Unsaved editor changes are lost.
- A "Change outside history" row means the action was changed while the log was disabled. A "State before the first recorded change" row lets you bring back the code that existed before the first record.

---

## How to check it worked
- The list has a new entry marked `Current` and "Restored from the version of ...".
- Running the action test gives the old version result.

---

## If it does not work
- "The action changed meanwhile": refresh the history and try again.
- "This version cannot be restored automatically": the entry predates the history; copy what you need manually.
- The dialog shows a validation error: the old code violates current ActionJail security rules and cannot be restored.

---

## Related guides
- [Create and maintain an action (Admin)](/en/actionjail/how-to/admin-manage-actions.md)
- [Clone an action](/en/actionjail/how-to/clone-action.md)
- [Use a saved credential in an action](/en/actionjail/how-to/use-saved-credential-in-custom-action.md)

<!-- Screenshots and GIF: the History button, the version list, the restore dialog - added by the demo. -->
