Rename a label

.md

Change what a label is called, what colour it is, or both.

Scopesmail:write
PATCH/v1/me/mail/labels/{id}

One filing system for the whole environment, so this changes what everybody sees. That is what a shared vocabulary is for, and why there is no per-person version of it.

Either field on its own is a valid request. Sending neither is not: that would be a write that changes nothing and answers as though it did.

The path takes the label's id from the list. A number there answers 404, like a label of another environment.

Request

curl -X PATCH https://api.proppertrading.com/v1/me/mail/labels/lbl_p6m3x8b2k9q4w7td \
  -H "Authorization: Bearer ptat_9f2c1a44_3b8e7d2f5c9a1b4e6d8f0a2c4e6b8d1f" \
  -H "Content-Type: application/json" \
  -d '{"name": "Payout requests"}'
FieldTypeDescription
namestringUp to 40 characters. Compared without case against the other labels, but never against itself, so recapitalising one is allowed
colorstringOne of gray, red, orange, amber, emerald, cyan, blue, violet, pink

Response

{
    "data": {
        "id": "lbl_p6m3x8b2k9q4w7td",
        "object": "mail_label",
        "name": "Payout requests",
        "color": "blue"
    },
    "meta": { "request_id": "req_01kz4bkr1aj1gv63d8fv3133ey" }
}

Errors

StatusCodeMeaning
403insufficient_scopeThis device does not hold mail:write
404resource_not_foundNo label with that id in this environment
422validation_failedNeither field was sent, the name is taken, or the colour is not in the palette