Label a thread
POST
/threads/{id}/labelsPuts labels on a conversation and takes them off in one request, and returns the labels it has afterwards.
Needs the permissionthreads:label
If a label in add can’t be used in the conversation’s mailbox, the whole request is refused with 409 not_usable and nothing changes. Taking a label off is always allowed.
Find label ids with List labels. Each change goes in the conversation’s history under the key’s name.
Path parameters
idstringrequired- The thread.
Body
addlist of stringsoptional- Ids of labels to put on it.
removelist of stringsoptional- Ids of labels to take off. Send at least one of the two.
Returns
The conversation’s labels after the change, each with:
idstring- The label.
namestring- Its name.
colourstring- A preset such as
blue-700.
Errors
400nothing_to_change- Neither
addnorremovewas sent. 400invalid_request- A label is in both lists, or a list isn’t a list.
401invalid_key- The key is wrong, expired or revoked. With no Authorization header at all, the code is
missing_credentials. 403missing_scope- The key doesn’t have
threads:label. TheX-Required-Scopeheader names what’s missing. 404not_found- There’s no such thread, or the key’s owner can’t see it.
409not_usable- A label in
addcan’t be used in this conversation’s mailbox. 429rate_limited- More than 120 requests a minute from this key. Wait for
Retry-Afterseconds.