Deployment Retention
Deployment Retention is available on all plans
Deployment retention refers to the configured policies that determine how long different types of deployments are kept before they are automatically deleted.
These configured retention policies allow you to control how long your deployment data is stored, providing:
- Enhanced protection: Remove outdated deployments with potential vulnerabilities or sensitive data
- Compliance support: Configure retention policies to align with your compliance requirements.
- Efficient storage management: Automatically clear out unnecessary deployments
Your retention policy determines when deployments become eligible for automatic deletion. Retained deployment output contributes to Deployment Storage while Vercel stores it.
Unless a team or project uses a custom policy, the default retention periods are:
| Plan | Canceled | Errored | Pre-Production | Production |
|---|---|---|---|---|
| Hobby | 30 days | 30 days | 30 days | 30 days |
| Pro and Enterprise | 30 days | 90 days | 180 days | 1 year |
A team policy can replace these defaults for new projects or all existing projects. A project policy applies only to that project and replaces the team default.
You can configure retention durations for the following deployment states:
- Canceled deployments
- Errored deployments
- Preview deployments
- Production deployments
For example, imagine you created a production deployment with a 60-day retention period on 01/01/2024 and later replaced it with a newer deployment. The origin deployment would expire on 03/01/2024, entering the recovery period, and users accessing it would see a 410 status code. If required, you could still restore it until 03/31/2024, when all associated resources are permanently removed and restoring the deployment is no longer possible.
After a deployment reaches its configured retention limit, a background job typically marks it for deletion within 48 hours. If a deployment is protected by one of the exceptions to the retention policy when it's first evaluated, it won't be deleted at that time. Once the exception no longer applies (for example, when a production alias moves to a newer deployment), the background job re-evaluates the deployment. This re-evaluation can take up to 30 days.
To configure a retention policy, open Settings in the sidebar of your project and follow these steps:
- Select Security on the side panel of the project settings page
- Scroll down to the Deployment Retention Policy section
- Select the drop down menu with the appropriate duration
- Save the new retention policy for your project
You can view your deployments retention policy using Vercel CLI and running the following command from your terminal:
vercel list [project-name] [--policy errored=6m]Deployments older than the configured retention interval are not always deleted. Vercel keeps a deployment while any of the following is true.
These recent deployment exceptions depend on your plan:
| Exception | Hobby | Pro and Enterprise |
|---|---|---|
| Last deployments created in the project | Last 3 | Last 10 |
| Production deployments in state Ready | Last 3 | Last 20 |
| Non-production deployments in state Ready | Not applied | Last 20 |
These exceptions apply on every plan:
- The deployment has a production alias assigned to it.
- The deployment is the target of a branch alias for a custom environment.
- The deployment is a non-production deployment and has any custom alias assigned to it.
- The deployment is the latest preview deployment for a Git branch that is still active. A branch is considered active when it has not been deleted and its associated pull request has not been merged or closed.
When a deployment is marked for deletion either accidentally or as part of the retention policy, you can restore it within the recovery period. This period is 30 days for successfully built deployments, but unsuccessful deployments may be garbage collected sooner.
To restore a deleted deployment, open Settings in the sidebar of your project:
- Select Security on the side panel of the project settings page
- Scroll down to the Recently Deleted section
- Find the deployment that needs to be restored, and click on the dropdown menu item Restore
- Complete the modal
Was this helpful?