How to delete all ChatGpt conversation history at once.

Shahid Ullah Khan
2 min readJan 13, 2024

--

Chatgpt doesn’t provide an option to clear all chat history, so you must be woundering how do i manually go around and delete tons of those conversations all at once?

Here are simple steps that you can follow to delete all conversations at once.

  1. First login to your ChatGpt site from chrome / similar browser (chat.openai.com)
  2. Now hit right click in any empty area of the page and click inspect from the options.
Chat GPT context menu

3. This will open debug tool on your browser, click console menu in the debug window.

4. Now copy and paste following script to your empty area in the console and hit Enter / Return (in the above screenshot, 2 is written in that empty area):

const anchors = document.querySelectorAll(".flex.items-center.gap-2.p-2");
const ids = Array.from(anchors)
.map((a) => a.href?.split("/").slice(-1)[0])
.filter((id) => !!id);

const deleteAllConversations = async () => {
const { accessToken } = await fetch("https://chat.openai.com/api/auth/session", {
method: "GET",
credentials: "include",
}).then(res => res.json());
const idPromises = ids.map(async (id) => {
fetch(`https://chat.openai.com/backend-api/conversation/${id}`, {
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${accessToken}`
},
body: JSON.stringify({is_visible: false}),
method: "PATCH",
credentials: "include",
});
});
Promise.all(idPromises);
};

deleteAllConversations();

After you putthis script in your console, and hit Return / Enter, This should delete all conversations at once, wait a few seconds and then you can refresh your page. All conversation history should be clear.

--

--

Shahid Ullah Khan

A passionate javascript developer constantly learning new techniques to create awesome solutions.