---
title: "Document Expiration: Studio View"
description: "Enable and configure document expiration for a database using Studio's Document Expiration view, and schedule a document's deletion by setting its @expires metadata property."
url: "https://docs.ravendb.net/7.2/documents/document-expiration/document-expiration-view"
version: "7.2"
---

# Document Expiration: Studio View

> RavenDB publishes an official agent skill for coding assistants at https://docs.ravendb.net/skills/ravendb/SKILL.md (also installable with `npx skills add ravendb/skills`). The skill describes itself as: "Read this before writing any RavenDB query, client call or /databases/ request. Covers server setup, document modelling, the Node.js, .NET and Python clients, RQL, indexes, vector search and AI agents. Code written from recall tends to run and return the wrong rows, because RQL resembles SQL and the clients take field names as plain strings."

## Document Expiration: Studio View

> **Note**
>
> - The **document expiration** feature deletes a document once the time you schedule for it has passed.  
>   Use *document expiration* for documents that are needed only for a limited time, like documents that hold shopping
>   carts, login sessions, or cached data.  
>   Deleting the document triggers features that react to the deletion of documents, like indexing, replication, and ETL tasks.
>
> - To schedule a document's expiration, set the `@expires` metadata property of the document to the intended expiration time.
>
> - Use Studio's **Document Expiration** view to enable *document expiration* for a database, set the interval between
>   checks for documents whose expiration time has passed, and limit the number of documents the feature processes in a
>   single run.
>
> - To enable and configure *document expiration* using the client API, and to learn how the feature deletes documents, see
>   [Document Expiration: Client API](https://docs.ravendb.net/7.2/documents/document-expiration/client-api.md).
>
> - In this article:
>   - [The Document Expiration view](#the-document-expiration-view)
>   - [Scheduling a document's expiration](#scheduling-a-document-s-expiration)

## The Document Expiration view {#the-document-expiration-view}

The Document Expiration view can be opened by users with `Admin` access to the database,
or with an `Operator` or `Cluster Admin` [security clearance](https://docs.ravendb.net/7.2/server/security/authorization/security-clearance-and-permissions.md).  
**`Settings` > `Document Expiration`**

![The Document Expiration view](https://docs.ravendb.net/assets/images/document-expiration-942abbdba0164da8fe4e7d535217dee7.png)

1. **Settings**  
   Open the Settings menu.

2. **Document Expiration**  
   Open the Document Expiration view.

3. **Document Expiration configuration**
   - **Save**  
     Save the configuration.  
     Changes to the configuration take effect only after you save them.
   - **Enable Document Expiration**  
     Toggle this option **on** to enable *document expiration* for the database, or **off** to disable the feature.
     - Turning this option on also turns on **Set max number of documents to process in a single run** (see below), with a
       value of 65536.
     - On a license that sets a minimum expiration frequency (e.g., a Community license), turning this option on also turns
       on **Set custom expiration frequency** (see below), with the minimum value.
     - Turning this option off also turns off the two options below it.
   - **Set custom expiration frequency**  
     Toggle this option **on** to set the interval at which the *document expiration* feature runs, in hours, minutes, and
     seconds.  
     The **Hours**, **Minutes**, and **Seconds** fields appear while this option is on.  
     Each time the feature runs, it checks the database for documents whose expiration time has passed and deletes these
     documents.  
     When this option is **off**, the default interval (60 seconds) applies.

     > **Note**
     >
     > #### The allowed expiration frequency with a Community license:
     >
     > When using a [Community license](https://ravendb.net/buy), the *document expiration* feature cannot run more often
     > than every 36 hours (129600 seconds).  
     > Turning **Enable Document Expiration** on sets **Set custom expiration frequency** to this minimum (36 hours).
     >
     > - To see the minimum expiration interval (in hours) allowed for each license, click the **Licensing** box at the bottom
     >   right of the view to open the **License comparison** dialog.
     >
     >   ![Minimum expiration frequency](https://docs.ravendb.net/assets/images/min-check-frequency-1c8823ccaf035b0ea7e584a0a1ad5750.png)
     > - While *document expiration* is enabled, a frequency lower than the allowed minimum displays a warning, and **Save** is
     >   disabled.  
     >   If you turn **Set custom expiration frequency** off, the warning will be displayed and **Save** will be disabled as well,
     >   since the 60-second default then applies.
   - #### Set max number of documents to process in a single run
     Toggle this option **on** to limit the number of documents the feature processes in a single run.  
     When this option is **off**, any number of documents can be processed during a single run.
     - Each run processes the documents due for deletion in the order of their expiration times, earliest first.  
       Documents that share an expiration time are processed in the order of their document IDs.
     - If the number of documents due for deletion exceeds the set limit, the documents will be processed over multiple
       consecutive runs.

4. **Example of a document scheduled for expiration**  
   **About this view** shows a sample document whose `@expires` metadata property is set to an expiration time one year
   from today.  
   See [Scheduling a document's expiration](#scheduling-a-document-s-expiration) below.

## Scheduling a document's expiration {#scheduling-a-document-s-expiration}

To schedule a document's expiration using Studio, open the document from the
[Documents view](https://docs.ravendb.net/7.2/studio/database/documents/documents-and-collections.md#the-documents-view), add an `@expires` property
to its metadata, and save the document.

![Scheduling a document's expiration](https://docs.ravendb.net/assets/images/document-expiration-edit-document-0c0f2787d2e2c1cbe2e8ed517e6f40cf.png)

1. **`@expires`**  
   Add an `@expires` property to the document's `@metadata`, and set the property's value to the intended expiration time.

   > **Note**
   >
   > Add a **time zone designator** to the value (`Z` for UTC, or an offset from UTC) to specify the time zone of the
   > expiration time.  
   > An expiration time set without a time zone designator is read in the server machine's time zone. If this time zone
   > differs from the one you meant, the document will be deleted earlier or later than you intended.
   >
   > Examples:
   >
   > - `"@expires": "2027-11-05T08:00:00.0000000Z"` sets the expiration time to 08:00 UTC.
   > - `"@expires": "2027-11-05T10:00:00.0000000+02:00"` sets the expiration time to 10:00 in a time zone two hours ahead of
   >   UTC, which is 08:00 UTC.
   > - `"@expires": "2027-11-05T08:00:00.0000000"` sets the expiration time to 08:00 in the server machine's time zone.

2. **Expires**  
   Once the document is saved, the **Properties** panel, on the right side of the document view, shows the time left until
   the document's expiration.  
   Hovering over the time left until the expiration shows the expiration date and time in UTC.

   > **Note**
   >
   > If *document expiration* **is disabled for the database**, a warning icon is displayed next to the time left until the
   > expiration:
   > ![Document expiration is disabled](https://raw.githubusercontent.com/ravendb/docs/main/docs/documents/document-expiration/assets/document-view_expiration-disabled.png)
   >
   > The expiration is **still scheduled**:
   >
   > - If you enable the feature before the expiration time, the document will be deleted in the feature's first run after
   >   the expiration time.
   > - If the expiration time passes while the feature is disabled, the document will be deleted after the feature is
   >   enabled, during its first run.
   > - In both cases, the document may be deleted in a later run if the number of documents due for deletion exceeds the
   >   maximum set for a single run using the
   >   [Set max number of documents to process in a single run](#set-max-number-of-documents-to-process-in-a-single-run)
   >   option above.

3. **Save**  
   Save the document.  
   The expiration is scheduled once you save the document.

## See also

- [Document Expiration: Client API](https://docs.ravendb.net/7.2/documents/document-expiration/client-api.md)
- [How to Get and Modify Metadata](https://docs.ravendb.net/7.2/client-api/session/how-to/get-and-modify-entity-metadata.md)
