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

# Recover or retrieve a deleted prompt

> [!NOTE]
>
> **Applies to:**
>
> * Plan - Any
> * Deployment - Any
> *
> * Use case - Accidentally deleted a prompt from the UI and need to recover its content or understand deletion safeguards

## 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.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.