POST
/v1/me/mail/messages/{id}/labelsOne 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}'
| Field | Type | Description |
|---|---|---|
label_id | string | The id of a label of this environment, such as lbl_p6m3x8b2k9q4w7td. Required |
on | boolean | On or off. Required |
conversation | boolean | Apply 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
| Status | Code | Meaning |
|---|---|---|
| 400 | missing_idempotency_key | Every POST needs one |
| 403 | insufficient_scope | This device does not hold mail:write |
| 404 | resource_not_found | No such message, or no such label here. A number in the path finds no message |
| 422 | validation_failed | label_id or on missing, or label_id sent as a number rather than a string |