Multi-select chats and delete them in bulk via drag-to-trash with fast parallel delete + retry
# ChatGPT Chat Bulk Delete (Drag to Trash + Fast Retry)
Tampermonkey/Greasemonkey userscript that lets you multi-select ChatGPT chats in the sidebar and delete them quickly by dragging them onto a trash icon.
## Features
- Multi-select chats in the left sidebar:
- Single-click to toggle selection.
- Shift+Click to select a range.
- Floating trash icon at the bottom-left:
- Appears only when at least one chat is selected.
- Shows a badge with the number of selected chats.
- Drag-to-delete:
- Drag any selected chat onto the trash icon to delete all selected chats.
- Fast parallel delete:
- All delete calls are fired in parallel for speed.
- Smart retry:
- Automatically retries only retryable failures (e.g. 429/5xx, network errors).
- Failed items are highlighted with a red border.
- Keeps problematic items selected so you clearly see what did not delete.
- Double-click to open a chat:
- Double-click on a chat entry to open it as usual.
- Auth token prefetch:
- The script requests the auth token in the background so the first delete starts as fast as possible.
## Requirements
- A modern browser (Chrome, Firefox, etc.).
- A userscript manager, for example:
- [Tampermonkey](https://www.tampermonkey.net/)
- [Violentmonkey](https://violentmonkey.github.io/)
- A logged-in session on .
## Installation
1. Install Tampermonkey (or another userscript manager) in your browser.
2. Save the script file locally:
- Create a new file called `chatgpt-chat-bulk-delete.user.js`.
- Paste the contents of the script from the section below into that file and save it.
3. Open the saved `chatgpt-chat-bulk-delete.user.js` file in your browser:
- Drag-and-drop it into a browser window, **or**
- Use `File -> Open` and select the file.
4. Your userscript manager should open an install prompt.
5. Confirm installation.
The script is configured to run on:
- `https://chatgpt.com/*`
## Usage
1. Open and log in.
2. In the left sidebar under **Your chats**, you will see your normal conversation list.
3. Select chats:
- Click a chat to toggle selection.
- Shift+Click between two chats to select the whole range.
4. When one or more chats are selected:
- A circular trash icon appears bottom-left.
- A small badge on the trash icon shows how many chats are selected.
5. Drag-to-delete:
- Drag any of the selected chats onto the trash icon.
- All selected chats are sent for deletion in parallel.
6. If some deletions fail:
- Those chats remain in the list.
- They get a red border (`tm-delete-failed`) and stay selected.
- The script automatically retries retryable failures a couple of times.
7. Double-click any chat in the sidebar to open it in the main view.
## Error Handling and Retries
- Treated as *retryable*:
- HTTP `429`, `500`, `502`, `503`, `504`.
- Network errors (no HTTP status) are also treated as retryable.
- Other non-2xx status codes are considered permanent failures and not retried.
- Config constants (at the top of the script):
- `MAX_DELETE_ATTEMPTS = 2`
- `RETRY_DELAY_MS = 700` (milliseconds)
You can tweak these values if you want more retries or a different delay.
## Technical Details
- Uses `GM_xmlhttpRequest` to:
- Fetch `https://chatgpt.com/api/auth/session` and extract `accessToken`.
- Send `PATCH` requests to `https://chatgpt.com/backend-api/conversation/{conversationId}` with `{"is_visible": false}` to hide/delete chats.
- Extracts conversation IDs from sidebar links with the pattern `/c/{conversationId}` in the `href`.
- Uses `Promise.allSettled` so all delete requests run in parallel and you still get a per-item success/fail result.
- Fixed-position trash zone (`#tm-trash-zone`) is shown/hidden via CSS transitions based on selection count.
## Permissions
Tampermonkey grants:
- `GM_addStyle` — injects custom CSS (selection styling + trash UI).
- `GM_xmlhttpRequest` — talks directly to ChatGPT’s backend with your auth token.
Host permissions:
- `@match https://chatgpt.com/*`
- `@connect chatgpt.com`
No data is sent to third-party servers; all requests go directly to `chatgpt.com` using your existing session.
## Uninstall
1. Open your userscript manager dashboard.
2. Find **ChatGPT Chat bulk delete (drag to trash + fast retry)**.
3. Disable or remove the script.
## License
MIT License.