puter.threads.delete()
Deletes a thread and optionally its child threads.
puter.threads.delete(uuid, options);
uuid
(string) (required)
The UUID of the thread to delete.
options
(object) (optional)
An object containing the following properties:
recursive
(boolean) (optional): If set to true
, deletes all child threads recursively. Default is false
.An empty object (reserved for future use).
The current actor needs the thread:UUID-OF-THREAD:delete
permission to delete the thread, unless they are the owner.
To delete child threads recursively, the actor needs either:
thread:UUID-OF-THREAD:children-of:delete
permission (to delete any child thread)thread:UUID-OF-THREAD:own-children-of:delete
permission (to delete only child threads they own)<html>
<body>
<script src="https://js.puter.com/v2/"></script>
<script>
// Delete a single thread
puter.threads.delete('550e8400-e29b-41d4-a716-446655440000')
.then(() => {
console.log("Thread deleted successfully");
})
.catch(error => {
console.error("Error deleting thread:", error);
});
// Delete a thread and all its children
puter.threads.delete('550e8400-e29b-41d4-a716-446655440000', { recursive: true })
.then(() => {
console.log("Thread and all children deleted successfully");
})
.catch(error => {
console.error("Error deleting thread hierarchy:", error);
});
</script>
</body>
</html>