Label a message

.md

File it under a label, or take the label off.

Scopesmail:write
POST/v1/me/mail/messages/{id}/labels

One call for both directions, because a label is a toggle. The path takes the message's id, such as msg_h3k8q2w7n4r9t5vx, and label_id the id of a label from the label list.

Request

curl -X POST https://api.proppertrading.com/v1/me/mail/messages/msg_h3k8q2w7n4r9t5vx/labels \
  -H "Authorization: Bearer ptat_9f2c1a44_3b8e7d2f5c9a1b4e6d8f0a2c4e6b8d1f" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 4a2f8c11-91e0-4d3a-b7c5-2e8f0a1b3c4d" \
  -d '{"label_id": "lbl_p6m3x8b2k9q4w7td", "on": true, "conversation": true}'
FieldTypeDescription
label_idstringThe id of a label of this environment, such as lbl_p6m3x8b2k9q4w7td. Required
onbooleanOn or off. Required
conversationbooleanApply to the whole exchange. Defaults to false

A label may go on one message or on the whole exchange, unlike assignment and the answered mark. Filing a single receipt out of a long thread is a real thing to want.

Response

204, no body. Read the labels back from the conversation if you need them.

Errors

StatusCodeMeaning
400missing_idempotency_keyEvery POST needs one
403insufficient_scopeThis device does not hold mail:write
404resource_not_foundNo such message, or no such label here. A number in the path finds no message
422validation_failedlabel_id or on missing, or label_id sent as a number rather than a string