Created
July 11, 2024 05:20
-
-
Save apeckham/e2170ff13c5905bd8f0a84107f07219a to your computer and use it in GitHub Desktop.
claude delete all conversations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function deleteAllConversations() { | |
const organizationId = 'XXXXXXX'; | |
const conversations = await fetch(`https://claude.ai/api/organizations/${organizationId}/chat_conversations`) | |
.then(response => response.json()); | |
console.log(`Found ${conversations.length} conversations to delete.`); | |
for (const conversation of conversations) { | |
const deleteUrl = `https://claude.ai/api/organizations/${organizationId}/chat_conversations/${conversation.uuid}`; | |
try { | |
const response = await fetch(deleteUrl, { | |
method: 'DELETE', | |
headers: { | |
'Content-Type': 'application/json' | |
} | |
}); | |
if (response.ok) { | |
console.log(`Deleted conversation: ${conversation.name}`); | |
} else { | |
console.error(`Failed to delete conversation: ${conversation.name}`); | |
} | |
} catch (error) { | |
console.error(`Error deleting conversation: ${conversation.name}`, error); | |
} | |
} | |
console.log('Finished deleting conversations.'); | |
} | |
deleteAllConversations(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment