Delete Thread
Soft delete a thread and all its messages
Overview
Soft delete a thread and all messages within it. Deleted threads are not permanently removed but are marked as deleted and excluded from future queries.
Warning
This operation deletes the thread AND all messages in it. Use with caution.
Authentication
AuthorizationstringpathrequiredInbox API Key
Path Parameters
idstringpathrequiredThe inbox ID (e.g., inb_abc123)
threadIdstringpathrequiredThe thread ID (e.g., thr_xyz789)
Request
curl -X DELETE https://api.daimon.email/v1/inboxes/inb_abc123/threads/thr_xyz789 \
-H "Authorization: Bearer dm_free_7d8a9b0c1d2e3f4g5h6i7j8k9l0m1n2o"import { DaimonClient } from 'daimon-email';
const client = new DaimonClient({
apiKey: 'dm_free_7d8a9b0c1d2e3f4g5h6i7j8k9l0m1n2o'
});
const result = await client.inboxes.threads.delete('inb_abc123', 'thr_xyz789');
console.log(`Deleted thread: ${result.thread_id}`);
console.log(`Messages deleted: ${result.messages_deleted}`);from daimon_email import DaimonClient
client = DaimonClient(
api_key='dm_free_7d8a9b0c1d2e3f4g5h6i7j8k9l0m1n2o'
)
result = client.inboxes.threads.delete('inb_abc123', 'thr_xyz789')
print(f"Deleted thread: {result['thread_id']}")
print(f"Messages deleted: {result['messages_deleted']}")Response
{
"result": {
"deleted": true,
"thread_id": "thr_xyz789",
"messages_deleted": 3
},
"next_steps": [
"Deleted threads will not appear in GET /v1/inboxes/{id}/threads",
"Use labels like 'archive' instead of deletion for soft archiving",
"Contact support if you need to restore a deleted thread"
]
}Response Fields
result.deletedbooleanWhether the deletion was successful (always true if request succeeds)
result.thread_idstringThe ID of the deleted thread
result.messages_deletednumberNumber of messages that were deleted along with the thread
next_stepsarraySuggested actions the agent can take next
Alternative: Soft Archive
Instead of deleting threads, consider using labels for archiving:
// Archive instead of delete
await client.inboxes.threads.update('inb_abc123', 'thr_xyz789', {
labels: ['archived']
});
// Later, query non-archived threads
const activeThreads = await client.inboxes.threads.list('inb_abc123', {
label: '!archived' // Exclude archived threads
});This allows you to restore threads later if needed.
Info
Soft delete: Threads are marked as deleted but not permanently removed from the database. This allows for potential recovery if needed. Contact support if you need to restore a deleted thread.