Update Thread
Update thread labels and metadata
Overview
Update a thread's labels. Labels help organize and categorize email conversations for your AI agent.
You can also add/remove individual labels using:
POST /v1/inboxes/{id}/threads/{threadId}/labels- Add a single labelDELETE /v1/inboxes/{id}/threads/{threadId}/labels/{label}- Remove a specific label
Authentication
AuthorizationstringpathrequiredInbox API Key
Path Parameters
idstringpathrequiredThe inbox ID (e.g., inb_abc123)
threadIdstringpathrequiredThe thread ID (e.g., thr_xyz789)
Body Parameters
labelsarraybodyrequiredArray of label strings to set on this thread. Replaces all existing labels.
Request
# Replace all labels
curl -X PATCH https://api.daimon.email/v1/inboxes/inb_abc123/threads/thr_xyz789 \
-H "Authorization: Bearer dm_free_7d8a9b0c1d2e3f4g5h6i7j8k9l0m1n2o" \
-H "Content-Type: application/json" \
-d '{
"labels": ["important", "order", "processed"]
}'
# Add a single label
curl -X POST https://api.daimon.email/v1/inboxes/inb_abc123/threads/thr_xyz789/labels \
-H "Authorization: Bearer dm_free_7d8a9b0c1d2e3f4g5h6i7j8k9l0m1n2o" \
-H "Content-Type: application/json" \
-d '{
"label": "urgent"
}'
# Remove a specific label
curl -X DELETE https://api.daimon.email/v1/inboxes/inb_abc123/threads/thr_xyz789/labels/processed \
-H "Authorization: Bearer dm_free_7d8a9b0c1d2e3f4g5h6i7j8k9l0m1n2o"import { DaimonClient } from 'daimon-email';
const client = new DaimonClient({
apiKey: 'dm_free_7d8a9b0c1d2e3f4g5h6i7j8k9l0m1n2o'
});
// Replace all labels
const thread = await client.inboxes.threads.update('inb_abc123', 'thr_xyz789', {
labels: ['important', 'order', 'processed']
});
console.log('Updated labels:', thread.labels);
// Add a single label
await client.inboxes.threads.addLabel('inb_abc123', 'thr_xyz789', 'urgent');
// Remove a specific label
await client.inboxes.threads.removeLabel('inb_abc123', 'thr_xyz789', 'processed');from daimon_email import DaimonClient
client = DaimonClient(
api_key='dm_free_7d8a9b0c1d2e3f4g5h6i7j8k9l0m1n2o'
)
# Replace all labels
thread = client.inboxes.threads.update('inb_abc123', 'thr_xyz789', {
'labels': ['important', 'order', 'processed']
})
print(f"Updated labels: {thread['labels']}")
# Add a single label
client.inboxes.threads.add_label('inb_abc123', 'thr_xyz789', 'urgent')
# Remove a specific label
client.inboxes.threads.remove_label('inb_abc123', 'thr_xyz789', 'processed')Response
{
"result": {
"thread": {
"id": "thr_xyz789",
"inbox_id": "inb_abc123",
"subject": "Order Confirmation #12345",
"labels": ["important", "order", "processed"],
"message_count": 3,
"created_at": "2024-03-11T14:23:45Z",
"updated_at": "2024-03-11T17:30:00Z"
}
},
"next_steps": [
"Use GET /v1/inboxes/{id}/threads?label={label} to filter threads by label",
"Use GET /v1/inboxes/{id}/threads/{threadId} to view full thread details",
"Labels are searchable in the account-wide GET /v1/threads endpoint"
]
}Response Fields
result.threadobjectUpdated thread object
Thread object
idstringUnique thread identifier
inbox_idstringThe inbox this thread belongs to
subjectstringThread subject line
labelsarrayUpdated array of label strings
message_countnumberTotal number of messages in this thread
created_atstringISO 8601 timestamp when thread was created
updated_atstringISO 8601 timestamp when thread was last updated
next_stepsarraySuggested actions the agent can take next
Label Best Practices
Labels are a powerful way to organize threads for your AI agent:
- Status labels:
pending,processed,completed,archived - Priority labels:
urgent,important,low-priority - Category labels:
order,support,billing,onboarding - Workflow labels:
needs-reply,waiting-for-customer,escalated
Info
Labels are case-sensitive. We recommend using lowercase with hyphens for consistency (e.g., needs-reply instead of Needs Reply).