# Delete Protection (/docs/console/delete-protection) > For the complete Prisma documentation index, see [llms.txt](https://www.prisma.io/docs/llms.txt). A markdown version of any docs page is available by appending `.md` to its URL. Block deletes of a project's main apps, databases, buckets, and branches in Console, the REST API, the CLI, and MCP tools. Location: Console > Delete Protection Delete Protection makes Prisma refuse to delete the resources a project depends on. You turn it on and off in the [Prisma Console](https://console.prisma.io/?utm_source=docs\&utm_medium=content\&utm_content=console). It guards against a mistyped command, a wrong click, or a script or AI assistant that deletes the wrong thing. For example, with Availability on, `npx prisma service delete web` fails for the `web` app on your production branch, even for an Admin. (The CLI calls an app a service.) Deleting an app on a [preview branch](https://www.prisma.io/docs/compute/branching) still works, unless you pinned that branch. Delete Protection is a setting on each project, and it is off until you turn it on. It has two switches, which you can use separately or together: - **Availability** protects what serves your traffic: apps, the deployments currently serving their traffic, and their custom domains and other URLs. - **Data** protects what stores your data: databases, buckets, and the branches, project, and workspace that contain them. ## What each setting blocks [#what-each-setting-blocks] | Resource | Availability | Data | | ------------------------------------------------------------------------------------------------------------------ | ------------ | ------- | | Apps on a [protected branch](#protected-branches) | Blocked | | | The live deployment of those apps, which is the one serving traffic | Blocked | | | Custom domains and other URLs that send traffic to an app on a protected branch (Console calls these routing URLs) | Blocked | | | Databases on a protected branch | | Blocked | | [Object Storage](https://www.prisma.io/docs/storage) buckets on a protected branch | | Blocked | | The protected branches themselves | | Blocked | | The project | | Blocked | | The workspace that contains the project | | Blocked | Availability alone does not stop someone from deleting the whole project, which deletes its apps too. To protect a production project, turn on both settings. Deleting a branch by hand does not delete its apps or databases: with or without Delete Protection, Prisma refuses to delete a branch that still has any. One project with Data on is enough to block deleting its whole workspace. ## Protected branches [#protected-branches] Delete Protection covers these [branches](https://www.prisma.io/docs/compute/branching) and the resources on them: - the project's production branch: the first branch created in the project, usually `main` - the project's default branch, which is often the same branch (to change it, use **Set as default** on the project's **Git** page in Console) - any preview branch you have pinned, as described below Other preview branches and their resources can be deleted as usual, so previews are still removed when you delete their Git branch. Older apps, databases, and buckets that belong to no branch are protected too. To protect a preview branch, such as a long-lived `staging` branch, pin it. Admins and Developers can do this: open the project's **Git** page in Console, open the menu at the end of the branch's row, and choose **Pin**. Pinning always stops Prisma from removing the branch automatically, for example when its Git branch is deleted. It stops people from deleting the branch only while Data is on, and from deleting its apps only while Availability is on. Choosing **Unpin** in the same menu removes the branch's protection, even while Delete Protection is on, unless the branch is also the production or default branch. ## Turn on Delete Protection [#turn-on-delete-protection] To turn Delete Protection on or off, you need the Admin role, or the Developer role with access to the project. See [Workspace roles and project access](https://www.prisma.io/docs/console/workspace-access). 1. Open the project in Console and go to **Settings**. 2. Under **Delete Protection**, turn on **Availability**, **Data**, or both. 3. Click **Save**. To confirm that Data is on, check **Delete Project** on the same page: the button is disabled, and Console shows why. For Availability, open the page of an app on your production branch and open the menu in its header: **Delete app** is disabled, with the reason under it. You can change these settings only in Console. The REST API, the CLI, and [MCP tools](https://www.prisma.io/docs/ai/mcp-tools) (which let AI assistants work with Prisma) cannot turn them on or off. Admins can see who changed a setting under **Workspace Settings** > **Audit Log**. Each change has its own entry, whose path ends in the setting and its new state, such as `/delete-protection/data/off`. ## What happens when a delete is blocked [#what-happens-when-a-delete-is-blocked] Protection applies to everyone, including Admins and service tokens: - **Console** disables the delete button and shows the reason. For custom domains and other routing URLs the button stays enabled, and a message says why the delete was refused after you confirm it. - **The REST API** answers `409 Conflict`, and the resource stays as it was. - **CLI** delete commands fail. - **MCP tools** that delete databases, buckets, apps, or deployments return the reason to the AI assistant. - **[Prisma Composer](https://www.prisma.io/docs/composer/deploying)** cannot delete protected resources either. This applies to a deploy that removes a resource from your app, and to the `destroy` operation. For a resource on a protected branch, the REST API returns this body: ```json { "error": { "code": "client-error", "message": "This resource is on a protected branch. Turn off Delete Protection in project settings to delete it.", "hint": "Turn off Delete Protection in Console, in project settings." } } ``` The message is different when you delete a branch or a project, but the hint is the same. ## Change the default branch [#change-the-default-branch] While either setting is on, the REST API also refuses to change which branch is the project's default. You can still change it in Console, with **Set as default** on the **Git** page. The old default branch is then no longer protected, unless it is also the production branch or you pin it. ## Delete a protected resource [#delete-a-protected-resource] 1. Open the project's **Settings** and turn off the setting that covers the resource: **Availability** for apps, deployments, and URLs, or **Data** for everything else. Click **Save**. 2. Delete the resource. 3. Turn the setting back on and click **Save**. Turning a setting off removes its protection from the whole project, so turn it back on as soon as you are done. If the resource is on a pinned branch that is not the production or default branch, you can unpin that branch instead, which leaves the rest of the project protected. To delete a workspace, turn off **Data** in every project that has it on. Other rules about deleting still apply. For example, you cannot delete a project's default database directly, even with Delete Protection off. ## What it does not cover [#what-it-does-not-cover] Delete Protection blocks deleting the resources listed above. It does not block: - deleting rows, tables, or files inside a database or bucket - [restoring a backup](https://www.prisma.io/docs/postgres/database/backups#restoring-a-backup) over an existing database, which overwrites its data - deleting environment variables, bucket access keys, or database connections (the credentials your app uses) - deploying a new version, stopping a deployment, or deleting a deployment that is not live A delete that is already running when you turn a setting on can still finish. Delete Protection does not replace backups. See [Backups](https://www.prisma.io/docs/postgres/database/backups) for how to recover data. ## Next steps [#next-steps] - [Environments and branches](https://www.prisma.io/docs/compute/branching): how production and preview branches work. - [Members and deletion](https://www.prisma.io/docs/console/more/workspaces): delete a database, project, or workspace. - [Workspace roles and project access](https://www.prisma.io/docs/console/workspace-access): limit who can delete resources in a project. ## Related pages - [Concepts](https://www.prisma.io/docs/console/concepts): Understand the core concepts of the Prisma Console: user accounts, workspaces, projects, and resources - [Getting Started](https://www.prisma.io/docs/console/getting-started): Quick start guide for setting up and using the Prisma Console - [Workspace roles and project access](https://www.prisma.io/docs/console/workspace-access): Give workspace members the Admin, Developer, Viewer, or Billing role, with access to the entire workspace or to selected projects.