Documentation
Sign inGet started

Update a thread

PATCH
/v1/email/threads/{thread_id}
const thread = await bird.email.threads.update("thr_01abc", {
  labels: { add: ["archive"] },
});
console.log(thread.id);
Applies label changes to a conversation, and links or unlinks a contact. Adding spam files the conversation, and its received messages, as spam. Adding archive files it away without deleting it. Adding inbox, or removing spam, blocked, or archive, returns it to the inbox, and its unread count recomputes to match. An archived conversation returns to the inbox by itself when a new message arrives. To block a sender going forward, add a receive rule instead. Any field you leave out stays unchanged.
Cuerpo de la solicitud
labels
object
Label changes to apply. Labels in add are applied and labels in remove are taken off; other labels are left untouched. Adding a label that is already present, or removing one that is not, has no effect. System labels express state changes: on a conversation, adding spam files it as spam, adding archive files it away without deleting it, adding inbox (or removing spam, blocked, or archive) returns it to the inbox, and removing unread marks all retained received messages as read in one call; on a message, adding or removing unread flips read state, and adding or removing trash moves it to or out of the trash. Changes that contradict this model are rejected: adding more than one placement label in one request, adding blocked (blocking a sender is a receive-rule decision), removing inbox without adding a destination, adding trash or unread to a conversation (removing unread is the mark-all-read shortcut; trash uses the DELETE verb), placement labels on a message (move its conversation instead), and unread on a sent message. Custom labels are 1-64 characters with no commas, control characters, or leading or trailing whitespace. System label names and a small reserved set (all, archived, deleted, draft, drafts, flagged, important, junk, muted, none, outbox, pinned, read, scheduled, snoozed, starred) cannot be used as custom labels, in any casing. A conversation or message has at most 20 labels, system labels included.
Mostrar parámetros secundarios
labels.add
array of string
Labels to apply.
labels.remove
array of string
Labels to take off.
contact_id
nullable string
Contact to link this conversation to, or null to unlink the current contact.
Carga de respuesta
id
string
obligatorio
Thread ID.
mailbox_id
string
obligatorio
Mailbox this conversation belongs to.
channel
string
obligatorio
Channel this conversation lives on. Always email.
contact_id
nullable string
obligatorio
Contact linked to this conversation, or null when none is linked.
subject
nullable string
obligatorio
Subject of the conversation, taken from its first message. Null when that message had no subject.
participants
array of string
obligatorio
Addresses that appear on the retained messages in this conversation, including the mailbox's own address.
message_count
integer
obligatorio
Number of retained messages in this conversation, both directions.
unread_count
integer
obligatorio
Number of retained received messages that are still unread. Spam and blocked mail is not counted.
last_message_at
string
obligatorio
When the most recent retained message in this conversation was received or sent.
last_direction
string
obligatorio
Direction of the most recent message: inbound for a received message, outbound for a sent one.
Possible values: inbound, outbound
labels
array of string
obligatorio
Labels on this conversation. Exactly one system placement label is always present, set by the message that started the conversation:
  • inbox: The conversation is in the inbox.
  • archive: The conversation was filed away and is done for now.
  • spam: The conversation's opening message failed sender authentication.
  • blocked: The conversation's opening message was rejected by the mailbox's receive policy or rules.
Move a conversation by updating its labels. Add spam to file it as spam, add archive to clean it out of the inbox, and add inbox, or remove spam, blocked, or archive, to bring it back. An archived conversation returns to the inbox by itself when a new message arrives. Custom labels share the same list, and a conversation has at most 20 labels in total.
created_at
string
obligatorio
When the thread was created.
updated_at
string
obligatorio
When the thread last changed.
highlights
object
Matched search fragments, keyed by the field that matched. Returned only by thread search. Omitted when listing threads.
Mostrar atributos secundarios
highlights.subject
array of string
Matched fragments from the conversation's subject.
highlights.text
array of string
Matched fragments from a message's body text.