---
title: Content versioning configuration
related:
  - https://docs.kentico.com/documentation/business-users/content-versioning.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

When content versioning is [enabled](#set-up-content-versioning), Xperience by Kentico automatically stores previously published versions of [reusable content items](https://docs.kentico.com/documentation/business-users/content-hub/content-items.md), [pages](https://docs.kentico.com/documentation/business-users/website-content.md), and [headless items](https://docs.kentico.com/documentation/business-users/headless-content.md). Once content versioning is in use, storing newly published versions can be [prevented](#suspend-versioning-in-custom-code) in contexts where it's not desirable.

## Set up content versioning

> **Note:** Once enabled, content versioning starts tracking published versions. Only versions published after enabling it will be included in the version history.

1. Open the **Settings** application.

2. Select **Content** -> **Content versioning**.

3. Select the **Enable content versioning** setting.

4. Enter the **Number of stored versions**.
   - The number of versions determines how many published versions of one language variant of an item the system stores.
   - To track all versions that will be published, enter 0. However, we recommend considering whether you need all versions and how this affects your system's performance.
   > **Note:** Storing too many versions can be detrimental to the system's performance. The optimal number of versions depends on your project and environment. We don't recommend storing more versions than you need.

5. **Save** the settings.

   ![Save configuration](https://docs.kentico.com/docsassets/documentation/content-versioning-configuration/settings_save.png "Save configuration")

## Permissions

The following table shows which permissions are needed for users to be able to [restore a previous version](https://docs.kentico.com/documentation/business-users/content-versioning.md#restore-previously-published-versions) of an item or view its [version history](https://docs.kentico.com/documentation/business-users/content-versioning.md#view-version-history).

| Content                | Permissions related to content versioning                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Pages                  | Users with permission to _Read_ a page can view its [version history](https://docs.kentico.com/documentation/business-users/content-versioning.md#view-version-history). Users with permission to _Update_ a page can [restore](https://docs.kentico.com/documentation/business-users/content-versioning.md#restore-previously-published-versions) its previous versions.                                                                                                                                                           |
| Reusable content items | Users with the _View_ permission for a workspace in [Content hub](https://docs.kentico.com/documentation/business-users/content-hub.md) can [view version history](https://docs.kentico.com/documentation/business-users/content-versioning.md#view-version-history) for all items in that workspace. Users with _Update_ permission for a workspace can [restore](https://docs.kentico.com/documentation/business-users/content-versioning.md#restore-previously-published-versions) previous versions of items in that workspace. |
| Headless items         | Users with permission to _View_ a headless channel application can [view version history](https://docs.kentico.com/documentation/business-users/content-versioning.md#view-version-history) for all items in that channel. Users with _Update_ permission for a headless channel application can [restore](https://docs.kentico.com/documentation/business-users/content-versioning.md#restore-previously-published-versions) previous versions of items in this channel.                                                           |

An item can be restored when the item is in any [workflow step](https://docs.kentico.com/documentation/developers-and-admins/configuration/workflows.md). Users can restore a previous version of an item even when the item is in a step they don't have permission for. The item is restored to the _Draft_ step with the data from the selected version, and the item has to go through the regular workflow from the start.

## Suspend versioning in custom code

If you need to suspend content versioning in custom code (for example, in integration scenarios), you can do so by enclosing the code into a `using` statement with a declared `ContentItemVersionActionContext` instance and the `EnableStoreVersion` property set to `false`.

```csharp title="Example"
using CMS.ContentEngine;
using CMS.Websites;
using CMS.Websites.Routing;

...

// Disables Versioning
using (new ContentItemVersionActionContext { EnableStoreVersion = false })
{
    ...

    await webPageManager.TryCreateDraft(pageId, languageName);

    ...

    // Page is published without creating a version in the version history
    await webPageManager.TryPublish(pageId, languageName);

}
```
