Skip to content

Instantly share code, notes, and snippets.

@Jalalx
Last active August 19, 2024 02:05
Show Gist options
  • Save Jalalx/6b99f5ff4a0aef17b4e4eff37b0ad235 to your computer and use it in GitHub Desktop.
Save Jalalx/6b99f5ff4a0aef17b4e4eff37b0ad235 to your computer and use it in GitHub Desktop.
Script to delete Claude AI conversations history without any dependency or using external tool.

What is this?

You want to delete all your conversations with Claude AI, but there is no button to clean them by one click (Like what ChatGPT has). Using this instructions, you can clean all conversations. No dependency or external tool is needed (except your Google Chrome browser!)

To delete all chats with the Claude AI:

  1. Open Google Chrome and go to https://claude.ai
  2. Login to your account and start a new chat conversation
  3. Open DevTools and go to the Network tab
  4. You need to find the origanization id. Paste the https://claude.ai/api/bootstrap in the Filter input to find the calls to that URL. If you could not find it, reload the page. Also make sure you are selecting the "All" type. You will see calls that contain a uuid in the url which is your organization id.
  5. Now move to the Console tab and then paste the following two functions:
    function deleteConversation(organizationID, uuid) {
      return fetch(`https://claude.ai/api/organizations/${organizationID}/chat_conversations/${uuid}`, {
        method: 'DELETE'
      })
        .then(response => {
          if (response.ok) {
            console.log(`Successfully deleted conversation: ${uuid}`);
            return true;
          } else {
            console.log(`Failed to delete conversation: ${uuid}`);
            return false;
          }
        })
        .catch(error => {
          console.error('Error:', error);
          return false;
        });
    }
    
    
    function fetchAndDeleteConversations(organizationID) {
      let deletedCount = 0;
    
      fetch(`https://claude.ai/api/organizations/${organizationID}/chat_conversations`)
        .then(response => response.json())
        .then(data => {
          const deletePromises = data.map(conversation => deleteConversation(organizationID, conversation.uuid));
          return Promise.all(deletePromises);
        })
        .then(results => {
          deletedCount = results.filter(result => result === true).length;
        })
        .catch(error => console.error('Error:', error));
    }
  6. And now run it like this: fetchAndDeleteConversations("put your organization uuid here")

Thank you ac1982 for the Chrome Extension, I took the 2 functions, because an extension for this was too much for me :D

@ShaunLWM
Copy link

Still working as of 19th August 2024. Thanks @Jalalx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment