A shared AnythingLLM workspace gathers a team's chat history, embedded documents and tuned prompt settings, and a single delete removes all of it for every user. For Docker installations on Linux, workspace deletion protection is a server setting that takes the Delete Workspace button out of workspace settings and makes the developer API refuse requests to delete a workspace.
The switch is the WORKSPACE_DELETION_PROTECTION variable in the server's environment file, and AnythingLLM looks only at whether that variable exists, never at its value. Writing false therefore still keeps workspaces protected; allowing deletion again means removing the line. Protection covers every workspace on the instance at once, including the delete action in an administrator's workspace list on a multi-user instance, while workspace contents, documents and settings stay editable as before.
A Docker installation picks up the variable from its mounted .env file only when the server starts, so the container must be restarted, and the instance is unreachable for everyone for roughly half a minute. Developer API calls carrying a valid key still list, read and create workspaces after the restart; only deletion is refused.
Steps to enable workspace deletion protection in AnythingLLM:
- Check that the General Settings tab of a workspace you want to protect shows a Delete Workspace button.
The gear icon beside the workspace name in the sidebar opens its settings on the General Settings tab. Team Handbook is the workspace used here; the setting applies to every workspace on the instance, so any of them shows the change.
- Open the AnythingLLM environment file from the Docker storage directory in a text editor with sudo.
$ sudo nano "$HOME/anythingllm/.env"
The Docker installation mounts this file into the container as /app/server/.env. Its directory is owned by UID 1000 with mode 700, so sudo is needed from any other account and works the same for the owning one. The existing lines hold provider credentials and the keys that encrypt AnythingLLM's saved data and must stay as they are. A different storage location has its own .env path.
- Enable workspace deletion protection with a new
WORKSPACE_DELETION_PROTECTIONline at the end of the environment file.WORKSPACE_DELETION_PROTECTION="true"
Only the variable's presence matters, so "false" or any other value also turns protection on. If the file already contains a WORKSPACE_DELETION_PROTECTION line, protection is already configured and a second line adds nothing. To allow deletion again later, the line has to be removed and the container restarted.
- Save the environment file in nano.
The save keys are Ctrl+O followed by Enter to confirm the filename; Ctrl+X exits to the shell. nano saves into the existing file, keeping the owner and permissions the container needs to read it. AnythingLLM keeps running with its previous settings until the restart.
- Restart the AnythingLLM container to load the new variable.
The instance goes offline for every user until the server is ready again, about half a minute on a small host. Chats being answered and documents being embedded at that moment are interrupted.
$ docker restart --timeout 30 anythingllm anythingllm
anythingllm is the container name chosen during the Docker installation. A restart reuses the same container and rereads the mounted .env file. Values passed with -e when the container was created can only change by re-creating the container.
Related: How to manage the AnythingLLM Docker service - Confirm that the workspace's General Settings tab no longer shows the Delete Workspace section.
Reload the page if it was already open before the restart. A Delete Workspace section that is still present means the server did not read the variable, usually because of a misspelled name or a restart that has not finished.
- Open instance settings with the wrench icon at the bottom of the workspace sidebar.

- Expand Tools in the instance settings sidebar.

- Select Developer API in the expanded Tools category.

- Select Generate New API Key on the API Keys page.
A developer API key grants access to the whole instance, including reading and changing all workspaces; it has no per-workspace scope. The creation dialog and the API Keys page display the key in full, and it stays visible in settings after the dialog closes. Anyone who can open these settings can read it.
- Select Create API Key in the Create new API key dialog.
The Name field is optional; leaving it empty still creates a key.
- Close the key creation dialog with Close.

- Copy the new key with Copy API Key in its table row.
The link changes to Copied once the key is on the clipboard.
- Paste the copied key into a hidden
readprompt that stores it asANYTHINGLLM_API_KEY.$ read -rs ANYTHINGLLM_API_KEY
-s keeps the pasted key off the screen and -r leaves it unchanged. Nothing is shown while pasting, and Enter ends the input. The variable exists only in this shell session and does not enter the shell history.
- Send a developer API request that tries to delete the protected workspace.
If the previous check still showed Delete Workspace, protection is not active and this request permanently deletes the workspace with its chats and embeddings.
$ curl -sS -X DELETE -H @- -w '\nHTTP status %{http_code}\n' \ http://localhost:3001/api/v1/workspace/team-handbook \ <<< "Authorization: Bearer $ANYTHINGLLM_API_KEY" {"success":false,"error":"Workspace deletion is blocked by the system administrator."} HTTP status 403team-handbook is the workspace's slug, the last part of its address in the browser such as http://localhost:3001/workspace/team-handbook. -H @- reads the Authorization header from the here-string on the last line, so the key does not appear in the process list. A missing or wrong key also returns 403, but with No valid api key found., which says nothing about deletion protection. An instance on another host uses its own address in place of localhost:3001.
- Confirm through the developer API that the workspace still exists after the refused delete.
$ curl -sS -H @- http://localhost:3001/api/v1/workspace/team-handbook \ <<< "Authorization: Bearer $ANYTHINGLLM_API_KEY" | python3 -m json.tool { "workspace": [ { "id": 1, "name": "Team Handbook", "slug": "team-handbook", ##### snipped ##### "documents": [], "threads": [] } ] }python3 -m json.tool only indents the JSON. A deleted workspace would come back as an empty "workspace": [] list; a returned entry with the same name and slug shows that it survived the request.