> ## Documentation Index
> Fetch the complete documentation index at: https://braintrust.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Recover or retrieve a deleted prompt

export const plans_0 = "Any"

export const deployments_0 = "Any"

export const data_plane_version_0 = undefined

export const use_case_0 = "Use case - Accidentally deleted a prompt from the UI and need to recover its content or understand deletion safeguards"

<Note>
  **Applies to:**

  * Plan - {plans_0}
  * Deployment - {deployments_0}
  * {data_plane_version_0}
  * {use_case_0}
</Note>

## Summary

**Issue:** A deleted prompt shows no undo option or unarchive control in the UI. There is no way to restore a soft-deleted prompt through the API.

**Cause:** Prompt deletion triggers a soft-delete window before permanent removal. No UI or API restore endpoint exists for prompts specifically.

**Resolution:** Retrieve prompt content via API during the soft-delete window. For prevention, restrict users to Viewer access or implement external prompt caching.

## Resolution steps

### If a prompt was recently deleted

#### Step 1: Retrieve the prompt content via API

During the soft-delete window, you can read (but not restore) a deleted prompt using its ID and version.

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
curl --location 'https://api.braintrust.dev/v1/prompt?version=<prompt version>&project_id=<project id>&id=<prompt id>' --header 'Authorization: Bearer sk-your-api-key'
```

This only works while the object is still soft-deleted. Once hard-deleted, the data is unrecoverable.

### If you want to prevent accidental deletion

Keep users who should not delete objects in the **Viewers** group. This is the lowest access level and prevents destructive actions.

Custom permission groups with fine-grained destructive-action controls are available on the **Enterprise plan** only.
